private void ConfigureOAuthStatus(OAuthControl oauth2, bool result) { if (result) { oauth2.Status = OAuthLoginStatus.LoginSuccessful; MessageBox.Show(Resources.UploadersConfigForm_Login_successful, "ShareX", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { oauth2.Status = OAuthLoginStatus.LoginFailed; MessageBox.Show(Resources.UploadersConfigForm_Login_failed, "ShareX", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private bool OAuth2Refresh(IOAuth2 uploader, OAuthControl oauth2) { try { if (OAuth2Info.CheckOAuth(uploader.AuthInfo)) { bool result = uploader.RefreshAccessToken(); ConfigureOAuthStatus(oauth2, result); return(result); } } catch (Exception ex) { ex.ShowError(); } return(false); }
private bool OAuth2Complete(IOAuth2Basic uploader, string code, OAuthControl control) { try { if (!string.IsNullOrEmpty(code) && uploader.AuthInfo != null) { bool result = uploader.GetAccessToken(code); ConfigureOAuthStatus(control, result); return(result); } } catch (Exception ex) { ex.ShowError(); } return(false); }