Пример #1
0
        private async void DeleteAccountCommandHandlerAsync(object obj)
        {
            IsBusy = true;

            try
            {
                await DialogHelper.Confirm(
                    "Are you sure you want to delete your account? ALL OF YOUR DATA WILL BE DELETED! THIS ACTION CANNOT BE UNDONE.",
                    async (p) =>
                {
                    // Log in and get access token
                    await KryptPadApi.DeleteAccountAsync();

                    // Create instance to credential locker
                    var locker = new PasswordVault();

                    try
                    {
                        // Clear out the saved credential for the resource
                        var creds = locker.FindAllByResource(Constants.LOCKER_RESOURCE);
                        foreach (var cred in creds)
                        {
                            // Remove only the credentials for the given resource
                            locker.Remove(cred);
                        }
                    }
                    catch { /* Nothing to see here */ }

                    // Navigate to the login page
                    NavigationHelper.Navigate(typeof(LoginPage), null, NavigationHelper.NavigationType.Root);
                }
                    );
            }
            catch (WebException ex)
            {
                await DialogHelper.ShowMessageDialogAsync(ex.Message);
            }
            catch (Exception ex)
            {
                // Failed
                await DialogHelper.ShowGenericErrorDialogAsync(ex);
            }


            IsBusy = false;
        }