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

本文关键字:之间 Xaml 返回 导航 HTML phonegap phone Windows      更新时间:2024-02-21

我正在开发一个应用程序,它将具有单独的相机功能。原因是我不喜欢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));将丢失实际页面并返回到索引

对不起,我的英语