【发布时间】:2013-12-03 14:54:44
【问题描述】:
我正在开发一个应用程序,它将具有单独的相机功能。原因是我不喜欢 phonegap 在 getPicture for windows phone 中的内置功能,因为它会自动将图像保存在用户设备上,这会占用大量内存。
我的应用目前是如何工作的,
用户打开应用程序,应用程序将他们引导到 login.html 页面(他们在其中输入用户名/密码)然后到 menu.html,在那里他们有许多不同的选项/功能,其中一个是拍照按钮,它可以打开相机camera.html 页面中的 .html 我有这个,代码调用我的单独 Echo.cs 类/插件工具
cordova.exec(function (imageData) { onPhotoDataSuccess(imageData); }, function (err) {
alert("Intent Error. Unable to call update routines");
}, "Echo", "takePicture", ["takepicture"]);
我的 takePicture 方法如下所示:
public void takePicture(string options)
{
string takePic = null;
Debug.WriteLine("Reached imageconvert method");
try
{
string[] data = JsonHelper.Deserialize<string[]>(options);
takePic = data[0];
}
catch (Exception)
{
Debug.WriteLine("ERROR OCCURED!");
DispatchCommandResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION));
return;
}
if ((takePic != null) && (takePic.Length > 0))
{
Deployment.Current.Dispatcher.BeginInvoke(() =>
{
(Application.Current.RootVisual as PhoneApplicationFrame).Navigate(new Uri("/Camera.xaml", UriKind.Relative));
//logic here some way to get the image back from camera.xaml and resume my currant page.
});
//DispatchCommandResult(new PluginResult(PluginResult.Status.OK, "imaged passed back from camera.xaml should go here"));
}
else
{
DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, "Expected one non-empty string argument."));
return;
}
}
上面的这段代码将用户重定向到我构建的单独的 camera.xaml 页面,我的自定义相机在该页面处理图像而不将其保存到用户库并将其转换为编码的 64basestring 以作为 ImageData 发送回,我现在的问题是,有没有办法以某种方式将 ImageData 信息发回并从 Camera.html 页面恢复我的应用程序? phonegap 也能做到这一点吗?
【问题讨论】:
-
你能解决上述问题吗?
标签: c# javascript cordova windows-phone-8