protected override async void OnNavigatedTo(NavigationEventArgs e) { //if (NetworkInterface.GetIsNetworkAvailable()) if (true) { await LoadData(); } else { IAsyncResult result = Guide.BeginShowMessageBox( AppResources.SplashScreen_OnNavigatedTo_No_Network, AppResources.SplashScreen_OnNavigatedTo_No_network_details, new string[] { "wifi", "3G/4G-LTE" }, 0, MessageBoxIcon.Error, null, null ); result.AsyncWaitHandle.WaitOne(); int?choice = Guide.EndShowMessageBox(result); if (choice.HasValue) { if (choice.Value == 0) { ConnectionSettingsTask con = new ConnectionSettingsTask(); con.ConnectionSettingsType = ConnectionSettingsType.WiFi; con.Show(); } else { ConnectionSettingsTask con = new ConnectionSettingsTask(); con.ConnectionSettingsType = ConnectionSettingsType.Cellular; con.Show(); } } else { MessageBoxResult res = MessageBox.Show(AppResources.SplashScreen_OnNavigatedTo_OfflineModeQuestion, AppResources.SplashScreen_OnNavigatedTo_Offline_Mode, MessageBoxButton.OKCancel); if (res == MessageBoxResult.Cancel) { StaticMethod.Quit(); } else if (res == MessageBoxResult.OK) { StaticData.isOffline = true; //Navigate to MainPage MessageBox.Show("Voucher World required a working internet connection", "We are sorry", MessageBoxButton.OK); StaticMethod.Quit(); //NavigationService.Navigate(new Uri("/PageGroups/KaraokeGroup/OfflinePage.xaml", UriKind.Relative)); } } } base.OnNavigatedTo(e); }
protected override void OnBackKeyPress(CancelEventArgs e) { if (MessageBox.Show("Are you sure to exit Voucher World?", "Close app confirmation", MessageBoxButton.OKCancel) == MessageBoxResult.OK) { StaticMethod.Quit(); } else { e.Cancel = true; } }