You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by fi...@apache.org on 2012/04/25 21:27:32 UTC

wp7 commit: [CB-336] getFormatData did not return due to threading issues in Capture.cs

Updated Branches:
  refs/heads/master 3e9ad79c1 -> 51d15c2f7


[CB-336] getFormatData did not return due to threading issues in Capture.cs


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/commit/51d15c2f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/tree/51d15c2f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/diff/51d15c2f

Branch: refs/heads/master
Commit: 51d15c2f7bcab819bb85bf581a56472a5d19dccf
Parents: 3e9ad79
Author: filmaj <ma...@gmail.com>
Authored: Wed Apr 25 12:27:15 2012 -0700
Committer: filmaj <ma...@gmail.com>
Committed: Wed Apr 25 12:27:15 2012 -0700

----------------------------------------------------------------------
 framework/Cordova/Commands/Capture.cs |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/51d15c2f/framework/Cordova/Commands/Capture.cs
----------------------------------------------------------------------
diff --git a/framework/Cordova/Commands/Capture.cs b/framework/Cordova/Commands/Capture.cs
index 60feb70..8207c68 100644
--- a/framework/Cordova/Commands/Capture.cs
+++ b/framework/Cordova/Commands/Capture.cs
@@ -24,6 +24,7 @@ using Microsoft.Xna.Framework.Media;
 using WP7CordovaClassLib.Cordova.UI;
 using AudioResult = WP7CordovaClassLib.Cordova.UI.AudioCaptureTask.AudioResult;
 using VideoResult = WP7CordovaClassLib.Cordova.UI.VideoCaptureTask.VideoResult;
+using System.Windows;
 
 namespace WP7CordovaClassLib.Cordova.Commands
 {
@@ -363,16 +364,19 @@ namespace WP7CordovaClassLib.Cordova.Commands
 
                 if (mimeType.Equals("image/jpeg"))
                 {
-                    WriteableBitmap image = ExtractImageFromLocalStorage(mediaFormatOptions.FullPath);
-
-                    if (image == null)
+                    Deployment.Current.Dispatcher.BeginInvoke(() =>
                     {
-                        DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, "File not found"));
-                        return;
-                    }
+                        WriteableBitmap image = ExtractImageFromLocalStorage(mediaFormatOptions.FullPath);
+
+                        if (image == null)
+                        {
+                            DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, "File not found"));
+                            return;
+                        }
 
-                    MediaFileData mediaData = new MediaFileData(image);
-                    DispatchCommandResult(new PluginResult(PluginResult.Status.OK, mediaData));
+                        MediaFileData mediaData = new MediaFileData(image);
+                        DispatchCommandResult(new PluginResult(PluginResult.Status.OK, mediaData));
+                    });
                 }
                 else
                 {