private async void LoadSchedule_Click(object sender, RoutedEventArgs e) { if (!Constant.checkNetworkConnection()) { ResourceLoader resourceLoader = ResourceLoader.GetForCurrentView("Resources"); await new MessageDialog(resourceLoader.GetString("Error_InternetConnection"), resourceLoader.GetString("Error")).ShowAsync(); return; } Constant.Loader(this.resourceLoader.GetString("GlobalLoading"), true); LoadSchedule.IsEnabled = false; Cities.IsEnabled = false; Database.CreateTables(); Database.DropDatabase(); Status status = await Task.Run(() => loadSchedule()); if (status.isSuccess) { Constant.Loader(this.resourceLoader.GetString("GlobalLoadingSuccess"), false); LocalProperties.SaveToLP(LocalProperties.LP_selected_city, selected.key); if (!Frame.Navigate(typeof(HubPage), "true")) { throw new Exception(this.resourceLoader.GetString("NavigationFailedExceptionMessage")); } } else if (status.reason != null) { new MessageDialog(status.reason).ShowAsync(); } }
private void ToggleSwitch_Toggled(object sender, RoutedEventArgs e) { if (isLoadedSettings) { TextBlock_ReloadApp.Visibility = Visibility.Visible; TextBlock_ReloadApp.Text = this.resourceLoader.GetString("Reload_Application"); if (LocalProperties.LoadFromToLP(LocalProperties.LP_theme) == LocalProperties.theme_light) { LocalProperties.SaveToLP(LocalProperties.LP_theme, LocalProperties.theme_dark); } else { LocalProperties.SaveToLP(LocalProperties.LP_theme, LocalProperties.theme_light); } } }
public async void CommandHandlers(IUICommand commandLabel) { var Actions = commandLabel.Label; if (this.resourceLoader.GetString("StaticButtonBuy") == Actions) { if (System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable()) { ListingInformation listing = await CurrentApp.LoadListingInformationAsync(); var superweapon = listing.ProductListings.FirstOrDefault(p => p.Value.ProductId == Constant.IAP_PREMIUN); try { ListingInformation LicensePremiumID = await Windows.ApplicationModel.Store.CurrentApp.LoadListingInformationByProductIdsAsync(new string[] { Constant.IAP_PREMIUN }); string x = await CurrentApp.RequestProductPurchaseAsync(LicensePremiumID.ProductListings.ToList()[0].Value.ProductId, false); var productLicenses = CurrentApp.LicenseInformation.ProductLicenses; ProductLicense tokenLicense = productLicenses[Constant.IAP_PREMIUN]; if (tokenLicense.IsActive) { LocalProperties.SaveToLP(LocalProperties.LP_active_premium, "true"); new MessageDialog("Платный функционал успешно активирован").ShowAsync(); } else { new MessageDialog("Не удалось активировать!").ShowAsync(); } } catch (Exception ex) { new MessageDialog("Неизвестная ошибка").ShowAsync(); } } else { new MessageDialog(resourceLoader.GetString("Error_InternetConnection"), resourceLoader.GetString("Error")).ShowAsync(); } } else { this.resourceLoader.GetString("StaticButtonCancel"); } }
private void LoadValues() { if (LocalProperties.LoadFromToLP(LocalProperties.LP_theme) == null) { this.RequestedTheme = ApplicationTheme.Light; LocalProperties.SaveToLP(LocalProperties.LP_theme, LocalProperties.theme_light); } else if (LocalProperties.LoadFromToLP(LocalProperties.LP_theme) == LocalProperties.theme_light) { this.RequestedTheme = ApplicationTheme.Light; } else { this.RequestedTheme = ApplicationTheme.Dark; } }