Windows phone 8和phonegap 2.7.0,HTML页面和Xaml之间的导航以及返回
Windows phone 8 and phonegap 2.7.0, Navigation between HTML pages and Xaml and back
我正在开发一个应用程序,它将具有单独的相机功能。原因是我不喜欢phonegap内置的getPicture for windows phone,因为它会自动将图像保存在用户的设备上,这会占用大量内存。
我的应用程序当前的工作方式,
用户打开应用程序,应用程序引导他们进入login.html页面(在那里他们输入用户名/通行证),然后进入menu.html,在那里他们有很多不同的选项/功能,其中之一是拍照按钮,它在camera.html页面中打开camera.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上可能吗?
我曾经支持:
DispatchCommandResult(new PluginResult(PluginResult.Status.OK, "imaged passed back from camera.xaml should go here"));
Deployment.Current.Dispatcher.BeginInvoke(() =>
{
root = Application.Current.RootVisual as PhoneApplicationFrame;
root.GoBack();
});
如果使用root。导航(新的Uri("/MainPage.xml",UriKind.Relative));将丢失实际页面并返回到索引
对不起,我的英语
相关文章:
- 函数参数中的数据与指定变量之间的任何性能差异
- 全局变量和全局对象的属性之间有什么区别吗
- java.net和javascript之间正则表达式的差异
- JavaScript中的函数和对象之间没有区别吗?
- 获取@ResponseBody的一部分作为主干和Spring MVC控制器之间的参数
- Jquery在函数之间传递表行
- 根据某些条件在视图之间切换
- 在控制器和数据对象之间同步数据
- d3中堆栈函数和嵌套函数之间的差异
- JQuery:在页面之间滑动
- 如何使用JavaScript查找1和N之间的所有数字的总和
- 操作放置在画布上的元素之间的连接
- 在下划线中使用_(obj).map(callback)和_.map(obj,callback)之间的区别
- jquery在表单之间切换
- Nodejs API控制器,用于在API之间切换
- 如何在aspx页面之间传递参数
- 在索引.html和应用.js [node.js] 之间共享变量
- 什么是&&在没有if的行中的变量之间
- DOM元素和angular元素之间的主要区别是什么
- Windows phone 8和phonegap 2.7.0,HTML页面和Xaml之间的导航以及返回