Beispiel #1
0
        private async void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
        {
            // Disable the primary button
            IsPrimaryButtonEnabled = false;

            // Force the dialog to stay open until the operation completes.
            // We will call Hide() when the api calls are done.
            args.Cancel = true;

            try
            {
                // Change the passphrase
                await KryptPadApi.ChangePassphraseAsync(OldPassphrase, NewPassphrase);

                // Done
                await DialogHelper.ShowMessageDialogAsync("Profile passphrase changed successfully.");

                // Hide dialog
                Hide();
            }
            catch (WarningException ex)
            {
                // Operation failed
                await DialogHelper.ShowMessageDialogAsync(ex.Message);
            }
            catch (WebException ex)
            {
                // Operation failed
                await DialogHelper.ShowMessageDialogAsync(ex.Message);
            }

            // Restore the button
            IsPrimaryButtonEnabled = CanChangePassphrase;
        }