public MainPage() { this.InitializeComponent(); this.NavigationCacheMode = NavigationCacheMode.Required; Current = this; // gán static resouce bên mainpage.xaml để xài _imageViewModel = Resources["imageDataContext"] as ImageRecognizeViewModel; //listpickerflyout.ItemsSource = Util.AvailableCountries.Values; //int language = Convert.ToInt32(LocalSettingHelper.GetLocalSettingValue(LocalSettingHelper.RecogLanguageKey)); //settingbtn.Content = Enum.Parse (typeof(OcrLanguage),LocalSettingHelper.GetLocalSettingValue(LocalSettingHelper.RecogLanguageKey).ToString()); _imageViewModel.Language = (OcrLanguage)Enum.Parse( typeof(OcrLanguage), LocalSettingHelper.GetLocalSettingValue(LocalSettingHelper.RecogLanguageKey).ToString()); }
private async Task <bool> AskForUseGPS() { bool isAllowed = false; if (LocalSettingHelper.IsExistsLocalSettingKey(LocalSettingHelper.AllowGPSKey) == false) { // Nếu khôgn có key setting MessageDialog msgbox = new MessageDialog("Do you want to use GPS?"); msgbox.Commands.Add(new UICommand("No") { Id = 0 }); msgbox.Commands.Add(new UICommand("Yes") { Id = 1 }); var result = await msgbox.ShowAsync() as UICommand; int id = Convert.ToInt32(result.Id); switch (id) { case 1: isAllowed = true; // localSettings.Values["AllowsGPS"] = true; break; default: isAllowed = false; // localSettings.Values["AllowsGPS"] = false; break; } //localSettings.Values["AllowsGPS"] = isAllowed; LocalSettingHelper.SetLocalSettingKeyValue(LocalSettingHelper.AllowGPSKey, isAllowed); } else { //isAllowed = Convert.ToBoolean(localSettings.Values["AllowsGPS"]); isAllowed = Convert.ToBoolean(LocalSettingHelper.GetLocalSettingValue(LocalSettingHelper.AllowGPSKey)); } return(isAllowed); }