/// <summary> /// Вызывается при приостановке выполнения приложения. Состояние приложения сохраняется /// без учета информации о том, будет ли оно завершено или возобновлено с неизменным /// содержимым памяти. /// </summary> /// <param name="sender">Источник запроса приостановки.</param> /// <param name="e">Сведения о запросе приостановки.</param> private async void OnSuspending(object sender, SuspendingEventArgs e) { var deferral = e.SuspendingOperation.GetDeferral(); //TODO: Сохранить состояние приложения и остановить все фоновые операции if (Window.Current.Content is MainPage) { //await (Window.Current.Content as MainPage).SaveState(); } StatisticsManager.SaveStatisticInLocalSettings(); Unsubscribe(); deferral.Complete(); }
public async void SelectImage_Tapped(object sender, RoutedEventArgs e) { try { ProgressBar.Visibility = Visibility.Visible; ImagesItemsControl.IsEnabled = false; if (sender != null) { var selectedImage = ((Image)sender).DataContext as Picture; await Game.DoTurn(selectedImage); } if (Game.CurrentTurnNumber == Game.TurnsCount) { ShowFinalDialog(); } else { CurrentTurnRun.Text = (Game.CurrentTurnNumber + 1).ToString(); TotalImagesCountRun.Text = Game.TurnsCount.ToString(); GuessedImagesProcentsRun.Text = Game.CurrentTurnNumber == 0 ? 0.ToString() : ((int)(((double)Game.GuessedImagesCount / Game.CurrentTurnNumber) * 100)).ToString(); ImagesItemsControl.ItemsSource = Game.CurrentTurn.DisplayedImages; if (Game.HintsLeft > 0) { HintButton.IsEnabled = true; } } } catch (Exception ex) { ShowNoInternetMessage(sender); } finally { StatisticsManager.IncrementGamesCount(); ProgressBar.Visibility = Visibility.Collapsed; ImagesItemsControl.IsEnabled = true; } }
// Include code to be executed when the system has transitioned from the splash screen to the extended splash screen (application's first view). async void DismissedEventHandler(SplashScreen sender, object e) { // Navigate away from the app's extended splash screen after completing setup operations here... // This sample navigates away from the extended splash screen when the "Learn More" button is clicked. await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async delegate() { //await Task.Delay(5000); var mainPage = new MainPage(); await mainPage.OnLoaded(_loadState, true); StatisticsManager.SendStatisticsToServer(); FadeOutAnimation.Begin(); FadeOutAnimation.Completed += delegate { if (Window.Current.Content == this) { Window.Current.Content = mainPage; } }; }); }