OAuth2 control refresh button hideable

This commit is contained in:
Jaex 2013-12-20 18:58:07 +02:00
parent 3954af74e3
commit 83b56cf088
3 changed files with 63 additions and 39 deletions

View file

@ -24,6 +24,8 @@
#endregion License Information (GPL v3) #endregion License Information (GPL v3)
using System; using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
namespace UploadersLib.GUI namespace UploadersLib.GUI
@ -69,9 +71,36 @@ public bool LoginStatus
} }
} }
private bool isRefreshable;
[DefaultValue(true)]
public bool IsRefreshable
{
get
{
return isRefreshable;
}
set
{
isRefreshable = value;
if (isRefreshable)
{
gbUserAccount.Size = new Size(320, 200);
}
else
{
gbUserAccount.Size = new Size(320, 165);
}
btnRefreshAuthorization.Visible = isRefreshable;
}
}
public OAuth2Control() public OAuth2Control()
{ {
InitializeComponent(); InitializeComponent();
IsRefreshable = true;
} }
private void btnOpenAuthorizePage_Click(object sender, EventArgs e) private void btnOpenAuthorizePage_Click(object sender, EventArgs e)

View file

@ -260,6 +260,8 @@ private void InitializeComponent()
this.tpGoogleURLShortener = new System.Windows.Forms.TabPage(); this.tpGoogleURLShortener = new System.Windows.Forms.TabPage();
this.oauth2GoogleURLShortener = new UploadersLib.GUI.OAuth2Control(); this.oauth2GoogleURLShortener = new UploadersLib.GUI.OAuth2Control();
this.atcGoogleURLShortenerAccountType = new UploadersLib.GUI.AccountTypeControl(); this.atcGoogleURLShortenerAccountType = new UploadersLib.GUI.AccountTypeControl();
this.tpBitly = new System.Windows.Forms.TabPage();
this.oauth2Bitly = new UploadersLib.GUI.OAuth2Control();
this.tpSocialNetworkingServices = new System.Windows.Forms.TabPage(); this.tpSocialNetworkingServices = new System.Windows.Forms.TabPage();
this.tcSocialNetworkingServices = new System.Windows.Forms.TabControl(); this.tcSocialNetworkingServices = new System.Windows.Forms.TabControl();
this.tpTwitter = new System.Windows.Forms.TabPage(); this.tpTwitter = new System.Windows.Forms.TabPage();
@ -324,8 +326,6 @@ private void InitializeComponent()
this.txtRapidSharePremiumUserName = new System.Windows.Forms.TextBox(); this.txtRapidSharePremiumUserName = new System.Windows.Forms.TextBox();
this.ttHelpTip = new System.Windows.Forms.ToolTip(this.components); this.ttHelpTip = new System.Windows.Forms.ToolTip(this.components);
this.actRapidShareAccountType = new UploadersLib.GUI.AccountTypeControl(); this.actRapidShareAccountType = new UploadersLib.GUI.AccountTypeControl();
this.tpBitly = new System.Windows.Forms.TabPage();
this.oauth2Bitly = new UploadersLib.GUI.OAuth2Control();
this.tcUploaders.SuspendLayout(); this.tcUploaders.SuspendLayout();
this.tpImageUploaders.SuspendLayout(); this.tpImageUploaders.SuspendLayout();
this.tcImageUploaders.SuspendLayout(); this.tcImageUploaders.SuspendLayout();
@ -375,6 +375,7 @@ private void InitializeComponent()
this.tpURLShorteners.SuspendLayout(); this.tpURLShorteners.SuspendLayout();
this.tcURLShorteners.SuspendLayout(); this.tcURLShorteners.SuspendLayout();
this.tpGoogleURLShortener.SuspendLayout(); this.tpGoogleURLShortener.SuspendLayout();
this.tpBitly.SuspendLayout();
this.tpSocialNetworkingServices.SuspendLayout(); this.tpSocialNetworkingServices.SuspendLayout();
this.tcSocialNetworkingServices.SuspendLayout(); this.tcSocialNetworkingServices.SuspendLayout();
this.tpTwitter.SuspendLayout(); this.tpTwitter.SuspendLayout();
@ -382,7 +383,6 @@ private void InitializeComponent()
this.gbCustomUploaders.SuspendLayout(); this.gbCustomUploaders.SuspendLayout();
this.gbCustomUploaderRegexp.SuspendLayout(); this.gbCustomUploaderRegexp.SuspendLayout();
this.gbCustomUploaderArguments.SuspendLayout(); this.gbCustomUploaderArguments.SuspendLayout();
this.tpBitly.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// tcUploaders // tcUploaders
@ -666,6 +666,7 @@ private void InitializeComponent()
// //
// oauth2Imgur // oauth2Imgur
// //
this.oauth2Imgur.IsRefreshable = true;
this.oauth2Imgur.Location = new System.Drawing.Point(464, 16); this.oauth2Imgur.Location = new System.Drawing.Point(464, 16);
this.oauth2Imgur.LoginStatus = false; this.oauth2Imgur.LoginStatus = false;
this.oauth2Imgur.Name = "oauth2Imgur"; this.oauth2Imgur.Name = "oauth2Imgur";
@ -1241,6 +1242,7 @@ private void InitializeComponent()
// //
// oauth2Picasa // oauth2Picasa
// //
this.oauth2Picasa.IsRefreshable = true;
this.oauth2Picasa.Location = new System.Drawing.Point(16, 16); this.oauth2Picasa.Location = new System.Drawing.Point(16, 16);
this.oauth2Picasa.LoginStatus = false; this.oauth2Picasa.LoginStatus = false;
this.oauth2Picasa.Name = "oauth2Picasa"; this.oauth2Picasa.Name = "oauth2Picasa";
@ -1360,15 +1362,15 @@ private void InitializeComponent()
// oAuth2Gist // oAuth2Gist
// //
this.oAuth2Gist.Enabled = false; this.oAuth2Gist.Enabled = false;
this.oAuth2Gist.IsRefreshable = false;
this.oAuth2Gist.Location = new System.Drawing.Point(16, 51); this.oAuth2Gist.Location = new System.Drawing.Point(16, 51);
this.oAuth2Gist.LoginStatus = false; this.oAuth2Gist.LoginStatus = false;
this.oAuth2Gist.Name = "oAuth2Gist"; this.oAuth2Gist.Name = "oAuth2Gist";
this.oAuth2Gist.Size = new System.Drawing.Size(328, 207); this.oAuth2Gist.Size = new System.Drawing.Size(328, 173);
this.oAuth2Gist.Status = "Status: Login required."; this.oAuth2Gist.Status = "Status: Login required.";
this.oAuth2Gist.TabIndex = 16; this.oAuth2Gist.TabIndex = 16;
this.oAuth2Gist.OpenButtonClicked += new UploadersLib.GUI.OAuth2Control.OpenButtonClickedEventHandler(this.oAuth2Gist_OpenButtonClicked); this.oAuth2Gist.OpenButtonClicked += new UploadersLib.GUI.OAuth2Control.OpenButtonClickedEventHandler(this.oAuth2Gist_OpenButtonClicked);
this.oAuth2Gist.CompleteButtonClicked += new UploadersLib.GUI.OAuth2Control.CompleteButtonClickedEventHandler(this.oAuth2Gist_CompleteButtonClicked); this.oAuth2Gist.CompleteButtonClicked += new UploadersLib.GUI.OAuth2Control.CompleteButtonClickedEventHandler(this.oAuth2Gist_CompleteButtonClicked);
this.oAuth2Gist.RefreshButtonClicked += new UploadersLib.GUI.OAuth2Control.RefreshButtonClickedEventHandler(this.oAuth2Gist_RefreshButtonClicked);
// //
// atcGistAccountType // atcGistAccountType
// //
@ -2275,6 +2277,7 @@ private void InitializeComponent()
// //
// oAuthJira // oAuthJira
// //
this.oAuthJira.IsRefreshable = true;
this.oAuthJira.Location = new System.Drawing.Point(473, 13); this.oAuthJira.Location = new System.Drawing.Point(473, 13);
this.oAuthJira.LoginStatus = false; this.oAuthJira.LoginStatus = false;
this.oAuthJira.Name = "oAuthJira"; this.oAuthJira.Name = "oAuthJira";
@ -2298,6 +2301,7 @@ private void InitializeComponent()
// //
// oauth2GoogleDrive // oauth2GoogleDrive
// //
this.oauth2GoogleDrive.IsRefreshable = true;
this.oauth2GoogleDrive.Location = new System.Drawing.Point(16, 16); this.oauth2GoogleDrive.Location = new System.Drawing.Point(16, 16);
this.oauth2GoogleDrive.LoginStatus = false; this.oauth2GoogleDrive.LoginStatus = false;
this.oauth2GoogleDrive.Name = "oauth2GoogleDrive"; this.oauth2GoogleDrive.Name = "oauth2GoogleDrive";
@ -2797,6 +2801,7 @@ private void InitializeComponent()
// //
// oauth2GoogleURLShortener // oauth2GoogleURLShortener
// //
this.oauth2GoogleURLShortener.IsRefreshable = true;
this.oauth2GoogleURLShortener.Location = new System.Drawing.Point(16, 56); this.oauth2GoogleURLShortener.Location = new System.Drawing.Point(16, 56);
this.oauth2GoogleURLShortener.LoginStatus = false; this.oauth2GoogleURLShortener.LoginStatus = false;
this.oauth2GoogleURLShortener.Name = "oauth2GoogleURLShortener"; this.oauth2GoogleURLShortener.Name = "oauth2GoogleURLShortener";
@ -2816,6 +2821,29 @@ private void InitializeComponent()
this.atcGoogleURLShortenerAccountType.TabIndex = 0; this.atcGoogleURLShortenerAccountType.TabIndex = 0;
this.atcGoogleURLShortenerAccountType.AccountTypeChanged += new UploadersLib.GUI.AccountTypeControl.AccountTypeChangedEventHandler(this.atcGoogleURLShortenerAccountType_AccountTypeChanged); this.atcGoogleURLShortenerAccountType.AccountTypeChanged += new UploadersLib.GUI.AccountTypeControl.AccountTypeChangedEventHandler(this.atcGoogleURLShortenerAccountType_AccountTypeChanged);
// //
// tpBitly
//
this.tpBitly.Controls.Add(this.oauth2Bitly);
this.tpBitly.Location = new System.Drawing.Point(4, 22);
this.tpBitly.Name = "tpBitly";
this.tpBitly.Padding = new System.Windows.Forms.Padding(3);
this.tpBitly.Size = new System.Drawing.Size(804, 475);
this.tpBitly.TabIndex = 1;
this.tpBitly.Text = "bit.ly";
this.tpBitly.UseVisualStyleBackColor = true;
//
// oauth2Bitly
//
this.oauth2Bitly.IsRefreshable = false;
this.oauth2Bitly.Location = new System.Drawing.Point(16, 16);
this.oauth2Bitly.LoginStatus = false;
this.oauth2Bitly.Name = "oauth2Bitly";
this.oauth2Bitly.Size = new System.Drawing.Size(328, 168);
this.oauth2Bitly.Status = "Login required.";
this.oauth2Bitly.TabIndex = 0;
this.oauth2Bitly.OpenButtonClicked += new UploadersLib.GUI.OAuth2Control.OpenButtonClickedEventHandler(this.oauth2Bitly_OpenButtonClicked);
this.oauth2Bitly.CompleteButtonClicked += new UploadersLib.GUI.OAuth2Control.CompleteButtonClickedEventHandler(this.oauth2Bitly_CompleteButtonClicked);
//
// tpSocialNetworkingServices // tpSocialNetworkingServices
// //
this.tpSocialNetworkingServices.Controls.Add(this.tcSocialNetworkingServices); this.tpSocialNetworkingServices.Controls.Add(this.tcSocialNetworkingServices);
@ -3466,29 +3494,6 @@ private void InitializeComponent()
this.actRapidShareAccountType.Size = new System.Drawing.Size(214, 29); this.actRapidShareAccountType.Size = new System.Drawing.Size(214, 29);
this.actRapidShareAccountType.TabIndex = 16; this.actRapidShareAccountType.TabIndex = 16;
// //
// tpBitly
//
this.tpBitly.Controls.Add(this.oauth2Bitly);
this.tpBitly.Location = new System.Drawing.Point(4, 22);
this.tpBitly.Name = "tpBitly";
this.tpBitly.Padding = new System.Windows.Forms.Padding(3);
this.tpBitly.Size = new System.Drawing.Size(804, 475);
this.tpBitly.TabIndex = 1;
this.tpBitly.Text = "bit.ly";
this.tpBitly.UseVisualStyleBackColor = true;
//
// oauth2Bitly
//
this.oauth2Bitly.Location = new System.Drawing.Point(16, 16);
this.oauth2Bitly.LoginStatus = false;
this.oauth2Bitly.Name = "oauth2Bitly";
this.oauth2Bitly.Size = new System.Drawing.Size(328, 207);
this.oauth2Bitly.Status = "Login required.";
this.oauth2Bitly.TabIndex = 0;
this.oauth2Bitly.OpenButtonClicked += new UploadersLib.GUI.OAuth2Control.OpenButtonClickedEventHandler(this.oauth2Bitly_OpenButtonClicked);
this.oauth2Bitly.CompleteButtonClicked += new UploadersLib.GUI.OAuth2Control.CompleteButtonClickedEventHandler(this.oauth2Bitly_CompleteButtonClicked);
this.oauth2Bitly.RefreshButtonClicked += new UploadersLib.GUI.OAuth2Control.RefreshButtonClickedEventHandler(this.oauth2Bitly_RefreshButtonClicked);
//
// UploadersConfigForm // UploadersConfigForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -3581,6 +3586,7 @@ private void InitializeComponent()
this.tpURLShorteners.ResumeLayout(false); this.tpURLShorteners.ResumeLayout(false);
this.tcURLShorteners.ResumeLayout(false); this.tcURLShorteners.ResumeLayout(false);
this.tpGoogleURLShortener.ResumeLayout(false); this.tpGoogleURLShortener.ResumeLayout(false);
this.tpBitly.ResumeLayout(false);
this.tpSocialNetworkingServices.ResumeLayout(false); this.tpSocialNetworkingServices.ResumeLayout(false);
this.tcSocialNetworkingServices.ResumeLayout(false); this.tcSocialNetworkingServices.ResumeLayout(false);
this.tpTwitter.ResumeLayout(false); this.tpTwitter.ResumeLayout(false);
@ -3592,7 +3598,6 @@ private void InitializeComponent()
this.gbCustomUploaderRegexp.PerformLayout(); this.gbCustomUploaderRegexp.PerformLayout();
this.gbCustomUploaderArguments.ResumeLayout(false); this.gbCustomUploaderArguments.ResumeLayout(false);
this.gbCustomUploaderArguments.PerformLayout(); this.gbCustomUploaderArguments.PerformLayout();
this.tpBitly.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
} }

View file

@ -930,11 +930,6 @@ private void oAuth2Gist_CompleteButtonClicked(string code)
this.GistAuthComplete(code); this.GistAuthComplete(code);
} }
private void oAuth2Gist_RefreshButtonClicked()
{
MessageBox.Show("Refresh authorization is not supported.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void chkGistPublishPublic_CheckedChanged(object sender, EventArgs e) private void chkGistPublishPublic_CheckedChanged(object sender, EventArgs e)
{ {
this.Config.GistPublishPublic = ((CheckBox)sender).Checked; this.Config.GistPublishPublic = ((CheckBox)sender).Checked;
@ -982,11 +977,6 @@ private void oauth2Bitly_CompleteButtonClicked(string code)
BitlyAuthComplete(code); BitlyAuthComplete(code);
} }
private void oauth2Bitly_RefreshButtonClicked()
{
MessageBox.Show("Refresh authorization is not supported.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
#endregion bit.ly #endregion bit.ly
#endregion URL Shorteners #endregion URL Shorteners