示例#1
0
        private async Task SaveProfile()
        {
            try
            {
                // Create a new profile
                var request = new CreateProfileRequest()
                {
                    Name              = ProfileName,
                    Passphrase        = ProfilePassphrase,
                    ConfirmPassphrase = ConfirmProfilePassphrase
                };

                // Call api to create the profile.
                var profile = await KryptPadApi.CreateProfileAsync(request);

                // Go to profile
                await KryptPadApi.LoadProfileAsync(profile, ProfilePassphrase);

                // Success, tell the app we are signed in
                (App.Current as App).SignInStatus = SignInStatus.SignedInWithProfile;

                // Redirect to the main item list page
                NavigationHelper.Navigate(typeof(ItemsPage), null, NavigationHelper.NavigationType.Main);

                // Hide the dialog
                Hide();
            }
            catch (WebException ex)
            {
                // Something went wrong in the api
                await DialogHelper.ShowMessageDialogAsync(ex.Message);
            }
            catch (Exception ex)
            {
                // Failed
                await DialogHelper.ShowGenericErrorDialogAsync(ex);
            }
        }