[英]Windows phone 8 and phonegap 2.7.0, Navigation between HTML pages and Xaml and back
我正在開發一個應用程序,它將具有單獨的攝像頭功能。 原因是我不喜歡Windows Phone的getPicture中phonegap的功能,因為它會自動將圖像保存在用戶設備上,這會占用大量內存。
我的應用當前的工作方式,
用戶打開應用程序,應用程序將其定向到login.html頁面(在其中輸入用戶名/密碼),然后進入menu.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.Navigate(new Uri(“ / MainPage.xaml”,UriKind.Relative)); 將丟失實際頁面並返回索引
對不起我的英語
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.