OneDrive UI

interim commit
This commit is contained in:
mcored 2014-08-09 08:28:09 +08:00
parent 6036e95758
commit 266089d781
7 changed files with 215 additions and 71 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

View file

@ -180,6 +180,8 @@ private void InitializeComponent()
this.lblAmazonS3SecretKey = new System.Windows.Forms.Label();
this.lblAmazonS3AccessKey = new System.Windows.Forms.Label();
this.txtAmazonS3AccessKey = new System.Windows.Forms.TextBox();
this.tpOneDrive = new System.Windows.Forms.TabPage();
this.oAuth2OneDrive = new UploadersLib.OAuthControl();
this.tpGoogleDrive = new System.Windows.Forms.TabPage();
this.cbGoogleDriveUseFolder = new System.Windows.Forms.CheckBox();
this.txtGoogleDriveFolderID = new System.Windows.Forms.TextBox();
@ -210,6 +212,7 @@ private void InitializeComponent()
this.lblOwnCloudUsername = new System.Windows.Forms.Label();
this.lblOwnCloudHost = new System.Windows.Forms.Label();
this.tpMediaFire = new System.Windows.Forms.TabPage();
this.cbMediaFireUseLongLink = new System.Windows.Forms.CheckBox();
this.txtMediaFirePath = new System.Windows.Forms.TextBox();
this.lblMediaFirePath = new System.Windows.Forms.Label();
this.txtMediaFirePassword = new System.Windows.Forms.TextBox();
@ -387,7 +390,6 @@ private void InitializeComponent()
this.ttlvMain = new HelpersLib.TabToListView();
this.lblWidthHint = new System.Windows.Forms.Label();
this.actRapidShareAccountType = new UploadersLib.AccountTypeControl();
this.cbMediaFireUseLongLink = new System.Windows.Forms.CheckBox();
this.tpOtherUploaders.SuspendLayout();
this.tcOtherUploaders.SuspendLayout();
this.tpCustomUploaders.SuspendLayout();
@ -410,6 +412,7 @@ private void InitializeComponent()
this.tpFTP.SuspendLayout();
this.tpMega.SuspendLayout();
this.tpAmazonS3.SuspendLayout();
this.tpOneDrive.SuspendLayout();
this.tpGoogleDrive.SuspendLayout();
this.tpBox.SuspendLayout();
this.tpOwnCloud.SuspendLayout();
@ -1385,6 +1388,7 @@ private void InitializeComponent()
this.tcFileUploaders.Controls.Add(this.tpFTP);
this.tcFileUploaders.Controls.Add(this.tpMega);
this.tcFileUploaders.Controls.Add(this.tpAmazonS3);
this.tcFileUploaders.Controls.Add(this.tpOneDrive);
this.tcFileUploaders.Controls.Add(this.tpGoogleDrive);
this.tcFileUploaders.Controls.Add(this.tpBox);
this.tcFileUploaders.Controls.Add(this.tpOwnCloud);
@ -2022,6 +2026,28 @@ private void InitializeComponent()
this.txtAmazonS3AccessKey.TabIndex = 1;
this.txtAmazonS3AccessKey.TextChanged += new System.EventHandler(this.txtAmazonS3AccessKey_TextChanged);
//
// tpOneDrive
//
this.tpOneDrive.Controls.Add(this.oAuth2OneDrive);
this.tpOneDrive.Location = new System.Drawing.Point(4, 40);
this.tpOneDrive.Name = "tpOneDrive";
this.tpOneDrive.Padding = new System.Windows.Forms.Padding(3);
this.tpOneDrive.Size = new System.Drawing.Size(972, 475);
this.tpOneDrive.TabIndex = 17;
this.tpOneDrive.Text = "OneDrive";
this.tpOneDrive.UseVisualStyleBackColor = true;
//
// oAuth2OneDrive
//
this.oAuth2OneDrive.IsRefreshable = false;
this.oAuth2OneDrive.Location = new System.Drawing.Point(16, 16);
this.oAuth2OneDrive.Name = "oAuth2OneDrive";
this.oAuth2OneDrive.Size = new System.Drawing.Size(328, 200);
this.oAuth2OneDrive.TabIndex = 2;
this.oAuth2OneDrive.OpenButtonClicked += new UploadersLib.OAuthControl.OpenButtonClickedEventHandler(this.oAuth2OneDrive_OpenButtonClicked);
this.oAuth2OneDrive.CompleteButtonClicked += new UploadersLib.OAuthControl.CompleteButtonClickedEventHandler(this.oAuth2OneDrive_CompleteButtonClicked);
this.oAuth2OneDrive.ClearButtonClicked += new UploadersLib.OAuthControl.ClearButtonclickedEventHandler(this.oAuth2OneDrive_ClearButtonClicked);
//
// tpGoogleDrive
//
this.tpGoogleDrive.Controls.Add(this.cbGoogleDriveUseFolder);
@ -2077,7 +2103,7 @@ private void InitializeComponent()
this.lvGoogleDriveFoldersList.Location = new System.Drawing.Point(352, 72);
this.lvGoogleDriveFoldersList.MultiSelect = false;
this.lvGoogleDriveFoldersList.Name = "lvGoogleDriveFoldersList";
this.lvGoogleDriveFoldersList.Size = new System.Drawing.Size(432, 408);
this.lvGoogleDriveFoldersList.Size = new System.Drawing.Size(432, 392);
this.lvGoogleDriveFoldersList.TabIndex = 11;
this.lvGoogleDriveFoldersList.UseCompatibleStateImageBehavior = false;
this.lvGoogleDriveFoldersList.View = System.Windows.Forms.View.Details;
@ -2341,6 +2367,17 @@ private void InitializeComponent()
this.tpMediaFire.Text = "MediaFire";
this.tpMediaFire.UseVisualStyleBackColor = true;
//
// cbMediaFireUseLongLink
//
this.cbMediaFireUseLongLink.AutoSize = true;
this.cbMediaFireUseLongLink.Location = new System.Drawing.Point(16, 120);
this.cbMediaFireUseLongLink.Name = "cbMediaFireUseLongLink";
this.cbMediaFireUseLongLink.Size = new System.Drawing.Size(205, 17);
this.cbMediaFireUseLongLink.TabIndex = 6;
this.cbMediaFireUseLongLink.Text = "Use long link which includes file name";
this.cbMediaFireUseLongLink.UseVisualStyleBackColor = true;
this.cbMediaFireUseLongLink.CheckedChanged += new System.EventHandler(this.cbMediaFireUseLongLink_CheckedChanged);
//
// txtMediaFirePath
//
this.txtMediaFirePath.Location = new System.Drawing.Point(88, 85);
@ -4154,17 +4191,6 @@ private void InitializeComponent()
this.actRapidShareAccountType.Size = new System.Drawing.Size(214, 29);
this.actRapidShareAccountType.TabIndex = 16;
//
// cbMediaFireUseLongLink
//
this.cbMediaFireUseLongLink.AutoSize = true;
this.cbMediaFireUseLongLink.Location = new System.Drawing.Point(16, 120);
this.cbMediaFireUseLongLink.Name = "cbMediaFireUseLongLink";
this.cbMediaFireUseLongLink.Size = new System.Drawing.Size(205, 17);
this.cbMediaFireUseLongLink.TabIndex = 6;
this.cbMediaFireUseLongLink.Text = "Use long link which includes file name";
this.cbMediaFireUseLongLink.UseVisualStyleBackColor = true;
this.cbMediaFireUseLongLink.CheckedChanged += new System.EventHandler(this.cbMediaFireUseLongLink_CheckedChanged);
//
// UploadersConfigForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -4216,6 +4242,7 @@ private void InitializeComponent()
this.tpMega.PerformLayout();
this.tpAmazonS3.ResumeLayout(false);
this.tpAmazonS3.PerformLayout();
this.tpOneDrive.ResumeLayout(false);
this.tpGoogleDrive.ResumeLayout(false);
this.tpGoogleDrive.PerformLayout();
this.tpBox.ResumeLayout(false);
@ -4642,6 +4669,8 @@ private void InitializeComponent()
private System.Windows.Forms.Label lblMediaFireEmail;
private System.Windows.Forms.TextBox txtMediaFirePath;
private System.Windows.Forms.Label lblMediaFirePath;
private System.Windows.Forms.CheckBox cbMediaFireUseLongLink;
private System.Windows.Forms.CheckBox cbMediaFireUseLongLink;
private System.Windows.Forms.TabPage tpOneDrive;
private OAuthControl oAuth2OneDrive;
}
}

View file

@ -67,75 +67,77 @@ private void FormSettings()
{
ImageList uploadersImageList = new ImageList();
uploadersImageList.ColorDepth = ColorDepth.Depth32Bit;
uploadersImageList.Images.Add("ImageShack", Resources.ImageShack);
uploadersImageList.Images.Add("TinyPic", Resources.TinyPic);
uploadersImageList.Images.Add("Imgur", Resources.Imgur);
uploadersImageList.Images.Add("Flickr", Resources.Flickr);
uploadersImageList.Images.Add("Photobucket", Resources.Photobucket);
uploadersImageList.Images.Add("Picasa", Resources.Picasa);
uploadersImageList.Images.Add("Dropbox", Resources.Dropbox);
uploadersImageList.Images.Add("Copy", Resources.Copy);
uploadersImageList.Images.Add("GoogleDrive", Resources.GoogleDrive);
uploadersImageList.Images.Add("Box", Resources.Box);
uploadersImageList.Images.Add("Minus", Resources.Minus);
uploadersImageList.Images.Add("FTP", Resources.folder_network);
uploadersImageList.Images.Add("RapidShare", Resources.RapidShare);
uploadersImageList.Images.Add("SendSpace", Resources.SendSpace);
uploadersImageList.Images.Add("Gett", Resources.Gett);
uploadersImageList.Images.Add("Hostr", Resources.Hostr);
uploadersImageList.Images.Add("CustomUploader", Resources.globe_network);
uploadersImageList.Images.Add("SharedFolders", Resources.server_network);
uploadersImageList.Images.Add("Email", Resources.mail);
uploadersImageList.Images.Add("Jira", Resources.jira);
uploadersImageList.Images.Add("Mega", Resources.Mega);
uploadersImageList.Images.Add("AdFly", Resources.AdFly);
uploadersImageList.Images.Add("AmazonS3", Resources.AmazonS3);
uploadersImageList.Images.Add("Pushbullet", Resources.Pushbullet);
uploadersImageList.Images.Add("Bitly", Resources.Bitly);
uploadersImageList.Images.Add("Box", Resources.Box);
uploadersImageList.Images.Add("Copy", Resources.Copy);
uploadersImageList.Images.Add("CustomUploader", Resources.globe_network);
uploadersImageList.Images.Add("Dropbox", Resources.Dropbox);
uploadersImageList.Images.Add("Email", Resources.mail);
uploadersImageList.Images.Add("Flickr", Resources.Flickr);
uploadersImageList.Images.Add("FTP", Resources.folder_network);
uploadersImageList.Images.Add("Gett", Resources.Gett);
uploadersImageList.Images.Add("Gist", Resources.GitHub);
uploadersImageList.Images.Add("Google", Resources.Google);
uploadersImageList.Images.Add("GoogleDrive", Resources.GoogleDrive);
uploadersImageList.Images.Add("Hostr", Resources.Hostr);
uploadersImageList.Images.Add("ImageShack", Resources.ImageShack);
uploadersImageList.Images.Add("Imgur", Resources.Imgur);
uploadersImageList.Images.Add("Jira", Resources.jira);
uploadersImageList.Images.Add("MediaFire", Resources.MediaFire);
uploadersImageList.Images.Add("Mega", Resources.Mega);
uploadersImageList.Images.Add("Minus", Resources.Minus);
uploadersImageList.Images.Add("OneDrive", Resources.OneDrive);
uploadersImageList.Images.Add("ownCloud", Resources.OwnCloud);
uploadersImageList.Images.Add("Pastebin", Resources.Pastebin);
uploadersImageList.Images.Add("Pasteee", Resources.page_white_text);
uploadersImageList.Images.Add("Gist", Resources.GitHub);
uploadersImageList.Images.Add("Upaste", Resources.Upaste);
uploadersImageList.Images.Add("Google", Resources.Google);
uploadersImageList.Images.Add("Bitly", Resources.Bitly);
uploadersImageList.Images.Add("Yourls", Resources.Yourls);
uploadersImageList.Images.Add("Photobucket", Resources.Photobucket);
uploadersImageList.Images.Add("Picasa", Resources.Picasa);
uploadersImageList.Images.Add("Pushbullet", Resources.Pushbullet);
uploadersImageList.Images.Add("RapidShare", Resources.RapidShare);
uploadersImageList.Images.Add("SendSpace", Resources.SendSpace);
uploadersImageList.Images.Add("SharedFolders", Resources.server_network);
uploadersImageList.Images.Add("TinyPic", Resources.TinyPic);
uploadersImageList.Images.Add("Twitter", Resources.Twitter);
uploadersImageList.Images.Add("ownCloud", Resources.OwnCloud);
uploadersImageList.Images.Add("AdFly", Resources.AdFly);
uploadersImageList.Images.Add("MediaFire", Resources.MediaFire);
uploadersImageList.Images.Add("Upaste", Resources.Upaste);
uploadersImageList.Images.Add("Yourls", Resources.Yourls);
tpImageShack.ImageKey = "ImageShack";
tpTinyPic.ImageKey = "TinyPic";
tpImgur.ImageKey = "Imgur";
tpAdFly.ImageKey = "AdFly";
tpAmazonS3.ImageKey = "AmazonS3";
tpBitly.ImageKey = "Bitly";
tpBox.ImageKey = "Box";
tpCopy.ImageKey = "Copy";
tpCustomUploaders.ImageKey = "CustomUploader";
tpDropbox.ImageKey = "Dropbox";
tpEmail.ImageKey = "Email";
tpFlickr.ImageKey = "Flickr";
tpFTP.ImageKey = "FTP";
tpGe_tt.ImageKey = "Gett";
tpGist.ImageKey = "Gist";
tpGoogleDrive.ImageKey = "GoogleDrive";
tpGoogleURLShortener.ImageKey = "Google";
tpHostr.ImageKey = "Hostr";
tpImageShack.ImageKey = "ImageShack";
tpImgur.ImageKey = "Imgur";
tpJira.ImageKey = "Jira";
tpMediaFire.ImageKey = "MediaFire";
tpMega.ImageKey = "Mega";
tpMinus.ImageKey = "Minus";
tpOneDrive.ImageKey = "OneDrive";
tpOwnCloud.ImageKey = "ownCloud";
tpPaste_ee.ImageKey = "Pasteee";
tpPastebin.ImageKey = "Pastebin";
tpPhotobucket.ImageKey = "Photobucket";
tpPicasa.ImageKey = "Picasa";
tpDropbox.ImageKey = "Dropbox";
tpCopy.ImageKey = "Copy";
tpGoogleDrive.ImageKey = "GoogleDrive";
tpBox.ImageKey = "Box";
tpMinus.ImageKey = "Minus";
tpFTP.ImageKey = "FTP";
tpPushbullet.ImageKey = "Pushbullet";
tpRapidShare.ImageKey = "RapidShare";
tpSendSpace.ImageKey = "SendSpace";
tpSharedFolder.ImageKey = "SharedFolders";
tpEmail.ImageKey = "Email";
tpJira.ImageKey = "Jira";
tpGe_tt.ImageKey = "Gett";
tpHostr.ImageKey = "Hostr";
tpCustomUploaders.ImageKey = "CustomUploader";
tpPastebin.ImageKey = "Pastebin";
tpPaste_ee.ImageKey = "Pasteee";
tpPushbullet.ImageKey = "Pushbullet";
tpGoogleURLShortener.ImageKey = "Google";
tpBitly.ImageKey = "Bitly";
tpYourls.ImageKey = "Yourls";
tpTinyPic.ImageKey = "TinyPic";
tpTwitter.ImageKey = "Twitter";
tpMega.ImageKey = "Mega";
tpGist.ImageKey = "Gist";
tpUpaste.ImageKey = "Upaste";
tpAmazonS3.ImageKey = "AmazonS3";
tpOwnCloud.ImageKey = "ownCloud";
tpAdFly.ImageKey = "AdFly";
tpMediaFire.ImageKey = "MediaFire";
tpYourls.ImageKey = "Yourls";
ttlvMain.ImageList = uploadersImageList;
ttlvMain.MainTabControl = tcUploaders;
@ -1665,6 +1667,25 @@ private void cbAmazonS3UseRRS_CheckedChanged(object sender, EventArgs e)
#endregion Amazon S3
#region OneDrive
private void oAuth2OneDrive_OpenButtonClicked()
{
OneDriveAuthOpen();
}
private void oAuth2OneDrive_CompleteButtonClicked(string code)
{
OneDriveAuthComplete(code);
}
private void oAuth2OneDrive_ClearButtonClicked()
{
Config.OneDriveOAuth2Info = null;
}
#endregion OneDrive
#region ownCloud
private void txtOwnCloudHost_TextChanged(object sender, EventArgs e)

View file

@ -882,6 +882,84 @@ private void BoxAddFolder(BoxFileEntry folder)
#endregion Box
#region OneDrive
public void OneDriveAuthOpen()
{
try
{
OAuth2Info oauth = new OAuth2Info(APIKeys.OneDriveClientID, APIKeys.OneDriveClientSecret);
string url = new OneDrive(oauth).GetAuthorizationURL();
if (!string.IsNullOrEmpty(url))
{
Config.OneDriveOAuth2Info = oauth;
URLHelpers.OpenURL(url);
DebugHelper.WriteLine("OneDriveAuthOpen - Authorization URL is opened: " + url);
}
else
{
DebugHelper.WriteLine("OneDriveAuthOpen - Authorization URL is empty.");
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
public void OneDriveAuthComplete(string code)
{
try
{
if (!string.IsNullOrEmpty(code) && Config.OneDriveOAuth2Info != null)
{
OneDrive onedrive = new OneDrive(Config.OneDriveOAuth2Info);
bool result = onedrive.GetAccessToken(code);
if (result)
{
Config.OneDriveOAuth2Info = onedrive.AuthInfo;
UpdateOneDriveStatus();
oAuth2OneDrive.Status = OAuthLoginStatus.LoginSuccessful;
MessageBox.Show("Login successful.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
else
{
oAuth2OneDrive.Status = OAuthLoginStatus.LoginFailed;
MessageBox.Show("Login failed.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
catch (Exception ex)
{
DebugHelper.WriteException(ex);
MessageBox.Show(ex.ToString(), Application.ProductName + " - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void UpdateOneDriveStatus()
{
if (OAuth2Info.CheckOAuth(Config.OneDriveOAuth2Info) && Config.OneDriveOAuth2Info != null)
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("Client ID: " + Config.OneDriveOAuth2Info.Client_ID);
lblDropboxStatus.Text = sb.ToString();
btnDropboxShowFiles.Enabled = true;
}
else
{
lblDropboxStatus.Text = string.Empty;
}
}
#endregion OneDrive
#region Minus
public void MinusAuth()

View file

@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18444
// Runtime Version:4.0.30319.34014
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@ -330,6 +330,16 @@ internal class Resources {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon OneDrive {
get {
object obj = ResourceManager.GetObject("OneDrive", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>

View file

@ -313,4 +313,7 @@
<data name="MediaFire" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Favicons\MediaFire.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="OneDrive" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Favicons\OneDrive.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View file

@ -429,6 +429,9 @@
<Name>HelpersLib</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="Favicons\OneDrive.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<PropertyGroup>