Exemple #1
0
        private async void ConfirmAndExit()
        {
            // dialog is open
            if (exitConfirmationDialog != null)
            {
                return;
            }

            exitConfirmationDialog = new MessageDialog("Are you sure you want to exit?");
            exitConfirmationDialog.Commands.Add(new UICommand {
                Label = "OK", Id = 0
            });
            exitConfirmationDialog.Commands.Add(new UICommand {
                Label = "Cancel", Id = 1
            });

            var result = await exitConfirmationDialog.ShowAsync();

            exitConfirmationDialog = null;
            if (result != null && (int)result.Id == 0)
            {
                AppPersistenceManager.SaveApplicationState(ApplicationData.Current.LocalSettings);
                Application.Current.Exit();
            }
        }
Exemple #2
0
 private void SaveApplicationState()
 {
     AppPersistenceManager.SaveApplicationState(ApplicationData.Current.LocalSettings);
 }