private async void WebAccountInvoked(WebAccountCommand command, WebAccountInvokedArgs args) { if (args.Action == WebAccountAction.Remove) { await LogoffAndRemoveAccount(); } }
private async void OnWebAccountRequested(WebAccountCommand cmd, WebAccountInvokedArgs args) { try { // Handle the different WebAccount actions... if (args.Action == WebAccountAction.Remove) { // Signs the provider out. PlatformBase.CurrentCore.Logger.Log(LogLevels.Information, "Web Account Manager - Remove account called"); await this.SignoutAsync(cmd.WebAccount.WebAccountProvider.Id); } else if (args.Action == WebAccountAction.Manage) { // Display user management UI for this account PlatformBase.CurrentCore.Logger.Log(LogLevels.Information, "Web Account Manager - Manage account called"); } } catch (Exception ex) { PlatformBase.CurrentCore.Logger.LogError(ex, "Web Token request failed"); } finally { this.Cleanup(); } }
private void WebAccountInvokedHandler(WebAccountCommand command, WebAccountInvokedArgs eventArgs) { switch (eventArgs.Action) { case WebAccountAction.Remove: Cancel(); LocalSettings.RemoveStorageValue(LOCAL_USER_NAME); LocalSettings.RemoveStorageValue(LOCAL_OAUTH_TOKEN); LoggedIn = WebAccountState.None; Disconnect(); break; case WebAccountAction.Reconnect: Login(); break; case WebAccountAction.More: case WebAccountAction.ViewDetails: case WebAccountAction.Manage: GoWebsite(); break; default: break; } }
private async void WebAccountInvoked(WebAccountCommand command, WebAccountInvokedArgs args) { if (args.Action == WebAccountAction.Remove) { rootPage.NotifyUser("Removing account", NotifyType.StatusMessage); await LogoffAndRemoveAccount(); } }
private async void LocalWebAccountInvokedHandler(WebAccountCommand command, WebAccountInvokedArgs eventArgs) { await WebAccountInvokedHandlerCoreAsync(command, eventArgs); if (eventArgs.Action == WebAccountAction.Manage) { ChangePasswordFlyout changePasswordFlyout = new ChangePasswordFlyout(this.username); changePasswordFlyout.Show(); } }
private void WebAccountInvoked(WebAccountCommand command, WebAccountInvokedArgs args) { if (args.Action == WebAccountAction.Remove) { App.LogoffAndRemoveAccount(command.WebAccount); } else if (args.Action == WebAccountAction.Reconnect) { // Display user management UI for this account } }
private async void WebAccountInvoked(WebAccountCommand command, WebAccountInvokedArgs args) { if (args.Action == WebAccountAction.Remove) { await LogoffAndRemoveAccount(command.WebAccount); } else if (args.Action == WebAccountAction.Manage) { // Display user management UI for this account DisplayInfoAsync("Manage invoked for user: " + command.WebAccount.UserName); } }
private async void WebAccountInvoked(WebAccountCommand command, WebAccountInvokedArgs args) { if (args.Action == WebAccountAction.Remove) { await LogoffAndRemoveAccount(command.WebAccount); } else if (args.Action == WebAccountAction.Manage) { // Display user management UI for this account rootPage.NotifyUser("Manage invoked for user: " + command.WebAccount.UserName, NotifyType.StatusMessage); } }
private async void WebAccountInvoked(WebAccountCommand command, WebAccountInvokedArgs args) { if (args.Action == WebAccountAction.Remove) { rootPage.NotifyUser("Removing account", NotifyType.StatusMessage); await LogoffAndRemoveAccount(); } else if (args.Action == WebAccountAction.Manage) { // Display user management UI for this account rootPage.NotifyUser("Managing account", NotifyType.StatusMessage); } }
// 用户在账号管理界面中选择了某项功能 private async void WebAccountCommandInvoked(WebAccountCommand command, WebAccountInvokedArgs args) { // 用户选择的是注销 if (args.Action == WebAccountAction.Remove) { await command.WebAccount.SignOutAsync(); _userId = null; lblMsg.Text = "注销成功"; imagePicture.ImageSource = null; } }
private async void WebAccountCommandInvoked(WebAccountCommand command, WebAccountInvokedArgs args) { if (args.Action == WebAccountAction.Remove) { DebugPrint("Removing account"); try { if (command.WebAccount != null) { await command.WebAccount.SignOutAsync(); await WebAccountManager.DeleteWebAccountAsync(command.WebAccount); } } catch (Exception ex) { Trace.LogException(ex); } } }
/// <summary> /// This event is generated when the user clicks on action button on account details pane. This method is /// responsible for handling what to do with selected action. /// </summary> /// <param name="command">Instance that triggered the event.</param> /// <param name="eventArgs">Event data describing the conditions that led to the event.</param> private void WebAccountInvokedHandler(WebAccountCommand command, WebAccountInvokedArgs eventArgs) { OutputText("Account State = " + command.WebAccount.State.ToString() + " and Selected Action = " + eventArgs.Action); if (eventArgs.Action == WebAccountAction.Remove) { //Remove user logon information since user requested to remove account. if (command.WebAccount.WebAccountProvider.Id.Equals(FACEBOOK_ID)) { roamingSettings.Values.Remove(FACEBOOK_USER_NAME); roamingSettings.Values.Remove(FACEBOOK_OAUTH_TOKEN); isFacebookUserLoggedIn = false; } else if (command.WebAccount.WebAccountProvider.Id.Equals(TWITTER_ID)) { roamingSettings.Values.Remove(TWITTER_USER_NAME); roamingSettings.Values.Remove(TWITTER_OAUTH_TOKEN); isTwitterUserLoggedIn = false; } } }
private async void OnWebAccountRequested(WebAccountCommand cmd, WebAccountInvokedArgs args) { try { // Handle the different WebAccount actions... if (args.Action == WebAccountAction.Remove) { // Signs the provider out. Platform.Current.Logger.Log(LogLevels.Information, "Web Account Manager - Remove account called"); await this.SignoutAsync(cmd.WebAccount.WebAccountProvider.Id); } else if (args.Action == WebAccountAction.Manage) { // Display user management UI for this account Platform.Current.Logger.Log(LogLevels.Information, "Web Account Manager - Manage account called"); } } catch (Exception ex) { Platform.Current.Logger.LogError(ex, "Web Token request failed"); } finally { this.Cleanup(); } }
private async void WebAccountInvoked(WebAccountCommand command, WebAccountInvokedArgs args) { if (args.Action == WebAccountAction.Remove) { rootPage.NotifyUser("Removing account", NotifyType.StatusMessage); await LogoffAndRemoveAccount(); } }
private async void LocalWebAccountInvokedHandler(WebAccountCommand command, WebAccountInvokedArgs eventArgs) { await WebAccountInvokedHandlerCoreAsync(command, eventArgs); if (eventArgs.Action == WebAccountAction.Manage) { ChangePasswordFlyout changePasswordFlyout = new ChangePasswordFlyout(this.username); changePasswordFlyout.Show(); } }
private async void WebAccountInvokedHandler(WebAccountCommand command, WebAccountInvokedArgs eventArgs) { await WebAccountInvokedHandlerCoreAsync(command, eventArgs); }
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); } } }
/// <summary> /// This event is generated when the user clicks on action button on account details pane. This method is /// responsible for handling what to do with selected action. /// </summary> /// <param name="command">Instance that triggered the event.</param> /// <param name="eventArgs">Event data describing the conditions that led to the event.</param> private void WebAccountInvokedHandler(WebAccountCommand command, WebAccountInvokedArgs eventArgs) { OutputText("Account State = " + command.WebAccount.State.ToString() + " and Selected Action = " + eventArgs.Action); if (eventArgs.Action == WebAccountAction.Remove) { //Remove user logon information since user requested to remove account. if (command.WebAccount.WebAccountProvider.Id.Equals(FACEBOOK_ID)) { roamingSettings.Values.Remove(FACEBOOK_USER_NAME); roamingSettings.Values.Remove(FACEBOOK_OAUTH_TOKEN); isFacebookUserLoggedIn = false; } else if (command.WebAccount.WebAccountProvider.Id.Equals(TWITTER_ID)) { roamingSettings.Values.Remove(TWITTER_USER_NAME); roamingSettings.Values.Remove(TWITTER_OAUTH_TOKEN); isTwitterUserLoggedIn = false; } } }
private async void WebAccountInvoked(WebAccountCommand command, WebAccountInvokedArgs args) { if (args.Action == WebAccountAction.Remove) { rootPage.NotifyUser("Removing account", NotifyType.StatusMessage); await LogoffAndRemoveAccount(); } else if (args.Action == WebAccountAction.Manage) { // Display user management UI for this account rootPage.NotifyUser("Managing account", NotifyType.StatusMessage); } }
private async void WebAccountInvokedHandler(WebAccountCommand command, WebAccountInvokedArgs eventArgs) { await WebAccountInvokedHandlerCoreAsync(command, eventArgs); }
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); } } }
private async void WebAccountInvoked(WebAccountCommand command, WebAccountInvokedArgs args) { if (args.Action == WebAccountAction.Remove) { await LogoffAndRemoveAccount(command.WebAccount); } else if (args.Action == WebAccountAction.Manage) { // Display user management UI for this account rootPage.NotifyUser("Manage invoked for user: " + command.WebAccount.UserName, NotifyType.StatusMessage); } }