private async void DeleteAccountMenuItem_Click(object sender, RoutedEventArgs e)
        {
            if (AccountsItemControl.Items.Count == 1)
            {
                MessageBox.Show("You must have at least one account to login");
            }
            else {
                Account account = (Account)((MenuItem)sender).DataContext;
                RemoveLogin removeLogin = new RemoveLogin()
                {
                    LoginProvider = account.Provider,
                    ProviderKey = account.ProviderKey,
                };

                HttpResult result;
                using (AccountClient accountClient = ClientFactory.CreateAccountClient())
                {
                    result = await accountClient.RemoveLoginAsync(removeLogin);
                }
                
                if (result.Succeeded)
                {
                    AccountsItemControl.Items.Remove(account);
                }
                else
                {
                    ErrorDialog.ShowErrors(result.Errors);
                }
            }
        }
        public async Task <HttpResult <ErrorResponse> > RemoveLoginAsync(RemoveLogin removeLogin)
        {
            ThrowIfDisposed();
            HttpResult <ErrorResponse> result = await HttpClient.PostAsJsonAsync <RemoveLogin, ErrorResponse>(RemoveLoginUri, removeLogin);

            AddAllErrors(result, result.Content);
            return(result);
        }
        private async Task WebAccountInvokedHandlerCoreAsync(WebAccountCommand command, WebAccountInvokedArgs eventArgs)
        {
            if (eventArgs.Action == WebAccountAction.Remove)
            {
                string loginProvider = command.WebAccount.WebAccountProvider.DisplayName;
                string providerKey = command.WebAccount.UserName;

                RemoveLogin removeLogin = new RemoveLogin()
                {
                    LoginProvider = loginProvider,
                    ProviderKey = providerKey
                };

                HttpResult result;
                using (AccountClient accountClient = ClientFactory.CreateAccountClient())
                {
                    result = await accountClient.RemoveLoginAsync(removeLogin);
                }

                if (result.Succeeded)
                {
                    if (loginProvider == localProvider)
                    {
                        settings.ClearPasswordCredentials();
                    }
                }
                else
                {
                    await ErrorDialog.ShowErrorsAsync(result.Errors);
                }
            }
        }
 public async Task<HttpResult<ErrorResponse>> RemoveLoginAsync(RemoveLogin removeLogin)
 {
     ThrowIfDisposed();
     HttpResult<ErrorResponse> result = await HttpClient.PostAsJsonAsync<RemoveLogin, ErrorResponse>(RemoveLoginUri, removeLogin);
     AddAllErrors(result, result.Content);
     return result;
 }