mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-30 01:07:21 +13:00
Handling image/text file destination in task settings form
This commit is contained in:
parent
5e7e3c2da4
commit
9ad69d33bf
3 changed files with 175 additions and 174 deletions
201
ShareX/Forms/TaskSettingsForm.Designer.cs
generated
201
ShareX/Forms/TaskSettingsForm.Designer.cs
generated
|
@ -31,11 +31,6 @@ private void InitializeComponent()
|
|||
this.components = new System.ComponentModel.Container();
|
||||
this.cmsAfterCapture = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.cmsAfterUpload = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.cmsImageUploaders = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.cmsTextUploaders = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.cmsFileUploaders = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.cmsURLShorteners = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.cmsSocialNetworkingServices = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.cbUseDefaultAfterCaptureSettings = new System.Windows.Forms.CheckBox();
|
||||
this.cbUseDefaultAfterUploadSettings = new System.Windows.Forms.CheckBox();
|
||||
this.cbUseDefaultDestinationSettings = new System.Windows.Forms.CheckBox();
|
||||
|
@ -48,14 +43,11 @@ private void InitializeComponent()
|
|||
this.cboFTPaccounts = new System.Windows.Forms.ComboBox();
|
||||
this.btnAfterCapture = new HelpersLib.MenuButton();
|
||||
this.btnAfterUpload = new HelpersLib.MenuButton();
|
||||
this.btnImageUploaders = new HelpersLib.MenuButton();
|
||||
this.btnTextUploaders = new HelpersLib.MenuButton();
|
||||
this.btnFileUploaders = new HelpersLib.MenuButton();
|
||||
this.btnURLShorteners = new HelpersLib.MenuButton();
|
||||
this.btnSocialNetworkingServices = new HelpersLib.MenuButton();
|
||||
this.btnDestinations = new HelpersLib.MenuButton();
|
||||
this.btnTask = new HelpersLib.MenuButton();
|
||||
this.tpGeneral = new System.Windows.Forms.TabPage();
|
||||
this.panelGeneral = new System.Windows.Forms.Panel();
|
||||
this.lblAfterTaskNotification = new System.Windows.Forms.Label();
|
||||
this.cboPopUpNotification = new System.Windows.Forms.ComboBox();
|
||||
this.chkShowAfterUploadForm = new System.Windows.Forms.CheckBox();
|
||||
this.cbShowAfterCaptureTasksForm = new System.Windows.Forms.CheckBox();
|
||||
|
@ -155,7 +147,12 @@ private void InitializeComponent()
|
|||
this.tpAdvanced = new System.Windows.Forms.TabPage();
|
||||
this.pgTaskSettings = new System.Windows.Forms.PropertyGrid();
|
||||
this.chkUseDefaultAdvancedSettings = new System.Windows.Forms.CheckBox();
|
||||
this.lblAfterTaskNotification = new System.Windows.Forms.Label();
|
||||
this.cmsDestinations = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.tsmiImageUploaders = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tsmiTextUploaders = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tsmiFileUploaders = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tsmiURLShorteners = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tsmiSocialServices = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tcHotkeySettings.SuspendLayout();
|
||||
this.tpTask.SuspendLayout();
|
||||
this.tpGeneral.SuspendLayout();
|
||||
|
@ -187,6 +184,7 @@ private void InitializeComponent()
|
|||
this.tpUploadClipboard.SuspendLayout();
|
||||
this.tpIndexer.SuspendLayout();
|
||||
this.tpAdvanced.SuspendLayout();
|
||||
this.cmsDestinations.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// cmsAfterCapture
|
||||
|
@ -199,31 +197,6 @@ private void InitializeComponent()
|
|||
this.cmsAfterUpload.Name = "cmsAfterCapture";
|
||||
this.cmsAfterUpload.Size = new System.Drawing.Size(61, 4);
|
||||
//
|
||||
// cmsImageUploaders
|
||||
//
|
||||
this.cmsImageUploaders.Name = "cmsAfterCapture";
|
||||
this.cmsImageUploaders.Size = new System.Drawing.Size(61, 4);
|
||||
//
|
||||
// cmsTextUploaders
|
||||
//
|
||||
this.cmsTextUploaders.Name = "cmsAfterCapture";
|
||||
this.cmsTextUploaders.Size = new System.Drawing.Size(61, 4);
|
||||
//
|
||||
// cmsFileUploaders
|
||||
//
|
||||
this.cmsFileUploaders.Name = "cmsAfterCapture";
|
||||
this.cmsFileUploaders.Size = new System.Drawing.Size(61, 4);
|
||||
//
|
||||
// cmsURLShorteners
|
||||
//
|
||||
this.cmsURLShorteners.Name = "cmsAfterCapture";
|
||||
this.cmsURLShorteners.Size = new System.Drawing.Size(61, 4);
|
||||
//
|
||||
// cmsSocialNetworkingServices
|
||||
//
|
||||
this.cmsSocialNetworkingServices.Name = "cmsAfterCapture";
|
||||
this.cmsSocialNetworkingServices.Size = new System.Drawing.Size(61, 4);
|
||||
//
|
||||
// cbUseDefaultAfterCaptureSettings
|
||||
//
|
||||
this.cbUseDefaultAfterCaptureSettings.AutoSize = true;
|
||||
|
@ -304,11 +277,7 @@ private void InitializeComponent()
|
|||
this.tpTask.Controls.Add(this.tbDescription);
|
||||
this.tpTask.Controls.Add(this.btnAfterCapture);
|
||||
this.tpTask.Controls.Add(this.btnAfterUpload);
|
||||
this.tpTask.Controls.Add(this.btnImageUploaders);
|
||||
this.tpTask.Controls.Add(this.btnTextUploaders);
|
||||
this.tpTask.Controls.Add(this.btnFileUploaders);
|
||||
this.tpTask.Controls.Add(this.btnURLShorteners);
|
||||
this.tpTask.Controls.Add(this.btnSocialNetworkingServices);
|
||||
this.tpTask.Controls.Add(this.btnDestinations);
|
||||
this.tpTask.Controls.Add(this.cbUseDefaultAfterCaptureSettings);
|
||||
this.tpTask.Controls.Add(this.btnTask);
|
||||
this.tpTask.Controls.Add(this.cbUseDefaultAfterUploadSettings);
|
||||
|
@ -325,7 +294,7 @@ private void InitializeComponent()
|
|||
// chkOverrideFTP
|
||||
//
|
||||
this.chkOverrideFTP.AutoSize = true;
|
||||
this.chkOverrideFTP.Location = new System.Drawing.Point(6, 332);
|
||||
this.chkOverrideFTP.Location = new System.Drawing.Point(6, 240);
|
||||
this.chkOverrideFTP.Name = "chkOverrideFTP";
|
||||
this.chkOverrideFTP.Size = new System.Drawing.Size(169, 17);
|
||||
this.chkOverrideFTP.TabIndex = 14;
|
||||
|
@ -338,7 +307,7 @@ private void InitializeComponent()
|
|||
this.cboFTPaccounts.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cboFTPaccounts.Enabled = false;
|
||||
this.cboFTPaccounts.FormattingEnabled = true;
|
||||
this.cboFTPaccounts.Location = new System.Drawing.Point(181, 330);
|
||||
this.cboFTPaccounts.Location = new System.Drawing.Point(181, 238);
|
||||
this.cboFTPaccounts.Name = "cboFTPaccounts";
|
||||
this.cboFTPaccounts.Size = new System.Drawing.Size(330, 21);
|
||||
this.cboFTPaccounts.TabIndex = 13;
|
||||
|
@ -368,65 +337,17 @@ private void InitializeComponent()
|
|||
this.btnAfterUpload.UseMnemonic = false;
|
||||
this.btnAfterUpload.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btnImageUploaders
|
||||
// btnDestinations
|
||||
//
|
||||
this.btnImageUploaders.Location = new System.Drawing.Point(6, 205);
|
||||
this.btnImageUploaders.Menu = this.cmsImageUploaders;
|
||||
this.btnImageUploaders.Name = "btnImageUploaders";
|
||||
this.btnImageUploaders.Size = new System.Drawing.Size(506, 23);
|
||||
this.btnImageUploaders.TabIndex = 8;
|
||||
this.btnImageUploaders.Text = "Image uploaders";
|
||||
this.btnImageUploaders.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
this.btnImageUploaders.UseMnemonic = false;
|
||||
this.btnImageUploaders.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btnTextUploaders
|
||||
//
|
||||
this.btnTextUploaders.Location = new System.Drawing.Point(6, 229);
|
||||
this.btnTextUploaders.Menu = this.cmsTextUploaders;
|
||||
this.btnTextUploaders.Name = "btnTextUploaders";
|
||||
this.btnTextUploaders.Size = new System.Drawing.Size(506, 23);
|
||||
this.btnTextUploaders.TabIndex = 9;
|
||||
this.btnTextUploaders.Text = "Text uploaders";
|
||||
this.btnTextUploaders.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
this.btnTextUploaders.UseMnemonic = false;
|
||||
this.btnTextUploaders.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btnFileUploaders
|
||||
//
|
||||
this.btnFileUploaders.Location = new System.Drawing.Point(6, 253);
|
||||
this.btnFileUploaders.Menu = this.cmsFileUploaders;
|
||||
this.btnFileUploaders.Name = "btnFileUploaders";
|
||||
this.btnFileUploaders.Size = new System.Drawing.Size(506, 23);
|
||||
this.btnFileUploaders.TabIndex = 10;
|
||||
this.btnFileUploaders.Text = "File uploaders";
|
||||
this.btnFileUploaders.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
this.btnFileUploaders.UseMnemonic = false;
|
||||
this.btnFileUploaders.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btnURLShorteners
|
||||
//
|
||||
this.btnURLShorteners.Location = new System.Drawing.Point(6, 277);
|
||||
this.btnURLShorteners.Menu = this.cmsURLShorteners;
|
||||
this.btnURLShorteners.Name = "btnURLShorteners";
|
||||
this.btnURLShorteners.Size = new System.Drawing.Size(506, 23);
|
||||
this.btnURLShorteners.TabIndex = 11;
|
||||
this.btnURLShorteners.Text = "URL shorteners";
|
||||
this.btnURLShorteners.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
this.btnURLShorteners.UseMnemonic = false;
|
||||
this.btnURLShorteners.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btnSocialNetworkingServices
|
||||
//
|
||||
this.btnSocialNetworkingServices.Location = new System.Drawing.Point(6, 301);
|
||||
this.btnSocialNetworkingServices.Menu = this.cmsSocialNetworkingServices;
|
||||
this.btnSocialNetworkingServices.Name = "btnSocialNetworkingServices";
|
||||
this.btnSocialNetworkingServices.Size = new System.Drawing.Size(506, 23);
|
||||
this.btnSocialNetworkingServices.TabIndex = 12;
|
||||
this.btnSocialNetworkingServices.Text = "Social networking services";
|
||||
this.btnSocialNetworkingServices.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
this.btnSocialNetworkingServices.UseMnemonic = false;
|
||||
this.btnSocialNetworkingServices.UseVisualStyleBackColor = true;
|
||||
this.btnDestinations.Location = new System.Drawing.Point(6, 205);
|
||||
this.btnDestinations.Menu = this.cmsDestinations;
|
||||
this.btnDestinations.Name = "btnDestinations";
|
||||
this.btnDestinations.Size = new System.Drawing.Size(506, 23);
|
||||
this.btnDestinations.TabIndex = 8;
|
||||
this.btnDestinations.Text = "Destinations...";
|
||||
this.btnDestinations.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
this.btnDestinations.UseMnemonic = false;
|
||||
this.btnDestinations.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btnTask
|
||||
//
|
||||
|
@ -468,6 +389,15 @@ private void InitializeComponent()
|
|||
this.panelGeneral.Size = new System.Drawing.Size(514, 327);
|
||||
this.panelGeneral.TabIndex = 19;
|
||||
//
|
||||
// lblAfterTaskNotification
|
||||
//
|
||||
this.lblAfterTaskNotification.AutoSize = true;
|
||||
this.lblAfterTaskNotification.Location = new System.Drawing.Point(8, 84);
|
||||
this.lblAfterTaskNotification.Name = "lblAfterTaskNotification";
|
||||
this.lblAfterTaskNotification.Size = new System.Drawing.Size(117, 13);
|
||||
this.lblAfterTaskNotification.TabIndex = 21;
|
||||
this.lblAfterTaskNotification.Text = "After task is completed:";
|
||||
//
|
||||
// cboPopUpNotification
|
||||
//
|
||||
this.cboPopUpNotification.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
|
@ -1634,14 +1564,51 @@ private void InitializeComponent()
|
|||
this.chkUseDefaultAdvancedSettings.UseVisualStyleBackColor = true;
|
||||
this.chkUseDefaultAdvancedSettings.CheckedChanged += new System.EventHandler(this.chkUseDefaultAdvancedSettings_CheckedChanged);
|
||||
//
|
||||
// lblAfterTaskNotification
|
||||
// cmsDestinations
|
||||
//
|
||||
this.lblAfterTaskNotification.AutoSize = true;
|
||||
this.lblAfterTaskNotification.Location = new System.Drawing.Point(8, 84);
|
||||
this.lblAfterTaskNotification.Name = "lblAfterTaskNotification";
|
||||
this.lblAfterTaskNotification.Size = new System.Drawing.Size(117, 13);
|
||||
this.lblAfterTaskNotification.TabIndex = 21;
|
||||
this.lblAfterTaskNotification.Text = "After task is completed:";
|
||||
this.cmsDestinations.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.tsmiImageUploaders,
|
||||
this.tsmiTextUploaders,
|
||||
this.tsmiFileUploaders,
|
||||
this.tsmiURLShorteners,
|
||||
this.tsmiSocialServices});
|
||||
this.cmsDestinations.Name = "cmsDestinations";
|
||||
this.cmsDestinations.Size = new System.Drawing.Size(213, 114);
|
||||
//
|
||||
// tsmiImageUploaders
|
||||
//
|
||||
this.tsmiImageUploaders.Image = global::ShareX.Properties.Resources.image;
|
||||
this.tsmiImageUploaders.Name = "tsmiImageUploaders";
|
||||
this.tsmiImageUploaders.Size = new System.Drawing.Size(212, 22);
|
||||
this.tsmiImageUploaders.Text = "Image uploaders";
|
||||
//
|
||||
// tsmiTextUploaders
|
||||
//
|
||||
this.tsmiTextUploaders.Image = global::ShareX.Properties.Resources.notebook;
|
||||
this.tsmiTextUploaders.Name = "tsmiTextUploaders";
|
||||
this.tsmiTextUploaders.Size = new System.Drawing.Size(212, 22);
|
||||
this.tsmiTextUploaders.Text = "Text uploaders";
|
||||
//
|
||||
// tsmiFileUploaders
|
||||
//
|
||||
this.tsmiFileUploaders.Image = global::ShareX.Properties.Resources.application_block;
|
||||
this.tsmiFileUploaders.Name = "tsmiFileUploaders";
|
||||
this.tsmiFileUploaders.Size = new System.Drawing.Size(212, 22);
|
||||
this.tsmiFileUploaders.Text = "File uploaders";
|
||||
//
|
||||
// tsmiURLShorteners
|
||||
//
|
||||
this.tsmiURLShorteners.Image = global::ShareX.Properties.Resources.edit_scale;
|
||||
this.tsmiURLShorteners.Name = "tsmiURLShorteners";
|
||||
this.tsmiURLShorteners.Size = new System.Drawing.Size(212, 22);
|
||||
this.tsmiURLShorteners.Text = "URL shorteners";
|
||||
//
|
||||
// tsmiSocialServices
|
||||
//
|
||||
this.tsmiSocialServices.Image = global::ShareX.Properties.Resources.globe_share;
|
||||
this.tsmiSocialServices.Name = "tsmiSocialServices";
|
||||
this.tsmiSocialServices.Size = new System.Drawing.Size(212, 22);
|
||||
this.tsmiSocialServices.Text = "Social networking services";
|
||||
//
|
||||
// TaskSettingsForm
|
||||
//
|
||||
|
@ -1706,6 +1673,7 @@ private void InitializeComponent()
|
|||
this.tpIndexer.PerformLayout();
|
||||
this.tpAdvanced.ResumeLayout(false);
|
||||
this.tpAdvanced.PerformLayout();
|
||||
this.cmsDestinations.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
@ -1715,17 +1683,8 @@ private void InitializeComponent()
|
|||
private HelpersLib.MenuButton btnAfterCapture;
|
||||
private System.Windows.Forms.ContextMenuStrip cmsAfterCapture;
|
||||
private HelpersLib.MenuButton btnAfterUpload;
|
||||
private HelpersLib.MenuButton btnImageUploaders;
|
||||
private HelpersLib.MenuButton btnTextUploaders;
|
||||
private HelpersLib.MenuButton btnFileUploaders;
|
||||
private HelpersLib.MenuButton btnURLShorteners;
|
||||
private HelpersLib.MenuButton btnSocialNetworkingServices;
|
||||
private HelpersLib.MenuButton btnDestinations;
|
||||
private System.Windows.Forms.ContextMenuStrip cmsAfterUpload;
|
||||
private System.Windows.Forms.ContextMenuStrip cmsImageUploaders;
|
||||
private System.Windows.Forms.ContextMenuStrip cmsTextUploaders;
|
||||
private System.Windows.Forms.ContextMenuStrip cmsFileUploaders;
|
||||
private System.Windows.Forms.ContextMenuStrip cmsURLShorteners;
|
||||
private System.Windows.Forms.ContextMenuStrip cmsSocialNetworkingServices;
|
||||
private System.Windows.Forms.CheckBox cbUseDefaultAfterCaptureSettings;
|
||||
private System.Windows.Forms.CheckBox cbUseDefaultAfterUploadSettings;
|
||||
private System.Windows.Forms.CheckBox cbUseDefaultDestinationSettings;
|
||||
|
@ -1839,6 +1798,12 @@ private void InitializeComponent()
|
|||
private System.Windows.Forms.ComboBox cboFTPaccounts;
|
||||
private System.Windows.Forms.ComboBox cboPopUpNotification;
|
||||
private System.Windows.Forms.Label lblAfterTaskNotification;
|
||||
private System.Windows.Forms.ContextMenuStrip cmsDestinations;
|
||||
private System.Windows.Forms.ToolStripMenuItem tsmiImageUploaders;
|
||||
private System.Windows.Forms.ToolStripMenuItem tsmiTextUploaders;
|
||||
private System.Windows.Forms.ToolStripMenuItem tsmiFileUploaders;
|
||||
private System.Windows.Forms.ToolStripMenuItem tsmiURLShorteners;
|
||||
private System.Windows.Forms.ToolStripMenuItem tsmiSocialServices;
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@ public partial class TaskSettingsForm : Form
|
|||
public bool IsDefault { get; private set; }
|
||||
|
||||
private ContextMenuStrip cmsNameFormatPattern, cmsNameFormatPatternActiveWindow;
|
||||
private ToolStripDropDownItem tsmiImageFileUploaders, tsmiTextFileUploaders;
|
||||
private bool loaded;
|
||||
|
||||
public TaskSettingsForm(TaskSettings hotkeySetting, bool isDefault = false)
|
||||
|
@ -74,23 +75,29 @@ public TaskSettingsForm(TaskSettings hotkeySetting, bool isDefault = false)
|
|||
chkUseDefaultAdvancedSettings.Checked = TaskSettings.UseDefaultAdvancedSettings;
|
||||
}
|
||||
|
||||
AddEnumItems<HotkeyType>(x => TaskSettings.Job = x, cmsTask);
|
||||
AddMultiEnumItems<AfterCaptureTasks>(x => TaskSettings.AfterCaptureJob = TaskSettings.AfterCaptureJob.Swap(x), cmsAfterCapture);
|
||||
AddMultiEnumItems<AfterUploadTasks>(x => TaskSettings.AfterUploadJob = TaskSettings.AfterUploadJob.Swap(x), cmsAfterUpload);
|
||||
AddEnumItems<ImageDestination>(x => TaskSettings.ImageDestination = x, cmsImageUploaders);
|
||||
AddEnumItems<TextDestination>(x => TaskSettings.TextDestination = x, cmsTextUploaders);
|
||||
AddEnumItems<FileDestination>(x => TaskSettings.FileDestination = x, cmsFileUploaders);
|
||||
AddEnumItems<UrlShortenerType>(x => TaskSettings.URLShortenerDestination = x, cmsURLShorteners);
|
||||
AddEnumItems<SocialNetworkingService>(x => TaskSettings.SocialNetworkingServiceDestination = x, cmsSocialNetworkingServices);
|
||||
AddEnumItemsContextMenu<HotkeyType>(x => TaskSettings.Job = x, cmsTask);
|
||||
AddMultiEnumItemsContextMenu<AfterCaptureTasks>(x => TaskSettings.AfterCaptureJob = TaskSettings.AfterCaptureJob.Swap(x), cmsAfterCapture);
|
||||
AddMultiEnumItemsContextMenu<AfterUploadTasks>(x => TaskSettings.AfterUploadJob = TaskSettings.AfterUploadJob.Swap(x), cmsAfterUpload);
|
||||
AddEnumItems<ImageDestination>(x => TaskSettings.ImageDestination = x, tsmiImageUploaders);
|
||||
tsmiImageFileUploaders = (ToolStripDropDownItem)tsmiImageUploaders.DropDownItems[tsmiImageUploaders.DropDownItems.Count - 1];
|
||||
AddEnumItems<FileDestination>(x => TaskSettings.ImageFileDestination = x, tsmiImageFileUploaders);
|
||||
AddEnumItems<TextDestination>(x => TaskSettings.TextDestination = x, tsmiTextUploaders);
|
||||
tsmiTextFileUploaders = (ToolStripDropDownItem)tsmiTextUploaders.DropDownItems[tsmiTextUploaders.DropDownItems.Count - 1];
|
||||
AddEnumItems<FileDestination>(x => TaskSettings.TextFileDestination = x, tsmiTextFileUploaders);
|
||||
AddEnumItems<FileDestination>(x => TaskSettings.FileDestination = x, tsmiFileUploaders);
|
||||
AddEnumItems<UrlShortenerType>(x => TaskSettings.URLShortenerDestination = x, tsmiURLShorteners);
|
||||
AddEnumItems<SocialNetworkingService>(x => TaskSettings.SocialNetworkingServiceDestination = x, tsmiSocialServices);
|
||||
|
||||
SetEnumChecked(TaskSettings.Job, cmsTask);
|
||||
SetMultiEnumChecked(TaskSettings.AfterCaptureJob, cmsAfterCapture);
|
||||
SetMultiEnumChecked(TaskSettings.AfterUploadJob, cmsAfterUpload);
|
||||
SetEnumChecked(TaskSettings.ImageDestination, cmsImageUploaders);
|
||||
SetEnumChecked(TaskSettings.TextDestination, cmsTextUploaders);
|
||||
SetEnumChecked(TaskSettings.FileDestination, cmsFileUploaders);
|
||||
SetEnumChecked(TaskSettings.URLShortenerDestination, cmsURLShorteners);
|
||||
SetEnumChecked(TaskSettings.SocialNetworkingServiceDestination, cmsSocialNetworkingServices);
|
||||
SetEnumCheckedContextMenu(TaskSettings.Job, cmsTask);
|
||||
SetMultiEnumCheckedContextMenu(TaskSettings.AfterCaptureJob, cmsAfterCapture);
|
||||
SetMultiEnumCheckedContextMenu(TaskSettings.AfterUploadJob, cmsAfterUpload);
|
||||
SetEnumChecked(TaskSettings.ImageDestination, tsmiImageUploaders);
|
||||
SetEnumChecked(TaskSettings.ImageFileDestination, tsmiImageFileUploaders);
|
||||
SetEnumChecked(TaskSettings.TextDestination, tsmiTextUploaders);
|
||||
SetEnumChecked(TaskSettings.TextFileDestination, tsmiTextFileUploaders);
|
||||
SetEnumChecked(TaskSettings.FileDestination, tsmiFileUploaders);
|
||||
SetEnumChecked(TaskSettings.URLShortenerDestination, tsmiURLShorteners);
|
||||
SetEnumChecked(TaskSettings.SocialNetworkingServiceDestination, tsmiSocialServices);
|
||||
|
||||
// FTP
|
||||
if (Program.UploadersConfig != null && Program.UploadersConfig.FTPAccountList.Count > 1)
|
||||
|
@ -221,16 +228,18 @@ private void UpdateDestinationStates()
|
|||
{
|
||||
if (Program.UploadersConfig != null)
|
||||
{
|
||||
EnableDisableToolStripMenuItems<ImageDestination>(cmsImageUploaders);
|
||||
EnableDisableToolStripMenuItems<TextDestination>(cmsTextUploaders);
|
||||
EnableDisableToolStripMenuItems<FileDestination>(cmsFileUploaders);
|
||||
EnableDisableToolStripMenuItems<UrlShortenerType>(cmsURLShorteners);
|
||||
EnableDisableToolStripMenuItems<SocialNetworkingService>(cmsSocialNetworkingServices);
|
||||
EnableDisableToolStripMenuItems<ImageDestination>(tsmiImageUploaders);
|
||||
EnableDisableToolStripMenuItems<FileDestination>(tsmiImageFileUploaders);
|
||||
EnableDisableToolStripMenuItems<TextDestination>(tsmiTextUploaders);
|
||||
EnableDisableToolStripMenuItems<FileDestination>(tsmiTextFileUploaders);
|
||||
EnableDisableToolStripMenuItems<FileDestination>(tsmiFileUploaders);
|
||||
EnableDisableToolStripMenuItems<UrlShortenerType>(tsmiURLShorteners);
|
||||
EnableDisableToolStripMenuItems<SocialNetworkingService>(tsmiSocialServices);
|
||||
chkOverrideFTP.Visible = cboFTPaccounts.Visible = Program.UploadersConfig.FTPAccountList.Count > 1;
|
||||
}
|
||||
}
|
||||
|
||||
private void AddEnumItems<T>(Action<T> selectedEnum, params ToolStripDropDown[] parents)
|
||||
private void AddEnumItemsContextMenu<T>(Action<T> selectedEnum, params ToolStripDropDown[] parents)
|
||||
{
|
||||
string[] enums = Helpers.GetEnumDescriptions<T>().Select(x => x.Replace("&", "&&")).ToArray();
|
||||
|
||||
|
@ -263,7 +272,7 @@ private void AddEnumItems<T>(Action<T> selectedEnum, params ToolStripDropDown[]
|
|||
}
|
||||
}
|
||||
|
||||
private void SetEnumChecked(Enum value, params ToolStripDropDown[] parents)
|
||||
private void SetEnumCheckedContextMenu(Enum value, params ToolStripDropDown[] parents)
|
||||
{
|
||||
int index = value.GetIndex();
|
||||
|
||||
|
@ -273,7 +282,7 @@ private void SetEnumChecked(Enum value, params ToolStripDropDown[] parents)
|
|||
}
|
||||
}
|
||||
|
||||
private void AddMultiEnumItems<T>(Action<T> selectedEnum, params ToolStripDropDown[] parents)
|
||||
private void AddMultiEnumItemsContextMenu<T>(Action<T> selectedEnum, params ToolStripDropDown[] parents)
|
||||
{
|
||||
string[] enums = Enum.GetValues(typeof(T)).Cast<Enum>().Skip(1).Select(x => x.GetDescription().Replace("&", "&&")).ToArray();
|
||||
|
||||
|
@ -303,7 +312,7 @@ private void AddMultiEnumItems<T>(Action<T> selectedEnum, params ToolStripDropDo
|
|||
}
|
||||
}
|
||||
|
||||
private void SetMultiEnumChecked(Enum value, params ToolStripDropDown[] parents)
|
||||
private void SetMultiEnumCheckedContextMenu(Enum value, params ToolStripDropDown[] parents)
|
||||
{
|
||||
for (int i = 0; i < parents[0].Items.Count; i++)
|
||||
{
|
||||
|
@ -315,13 +324,56 @@ private void SetMultiEnumChecked(Enum value, params ToolStripDropDown[] parents)
|
|||
}
|
||||
}
|
||||
|
||||
private void EnableDisableToolStripMenuItems<T>(params ToolStripDropDown[] parents)
|
||||
private void AddEnumItems<T>(Action<T> selectedEnum, params ToolStripDropDownItem[] parents)
|
||||
{
|
||||
foreach (ToolStripDropDown parent in parents)
|
||||
string[] enums = Helpers.GetEnumDescriptions<T>();
|
||||
|
||||
foreach (ToolStripDropDownItem parent in parents)
|
||||
{
|
||||
for (int i = 0; i < parent.Items.Count; i++)
|
||||
for (int i = 0; i < enums.Length; i++)
|
||||
{
|
||||
parent.Items[i].Enabled = Program.UploadersConfig.IsActive<T>(i);
|
||||
ToolStripMenuItem tsmi = new ToolStripMenuItem(enums[i]);
|
||||
|
||||
int index = i;
|
||||
|
||||
tsmi.Click += (sender, e) =>
|
||||
{
|
||||
foreach (ToolStripDropDownItem parent2 in parents)
|
||||
{
|
||||
for (int i2 = 0; i2 < enums.Length; i2++)
|
||||
{
|
||||
ToolStripMenuItem tsmi2 = (ToolStripMenuItem)parent2.DropDownItems[i2];
|
||||
tsmi2.Checked = index == i2;
|
||||
}
|
||||
}
|
||||
|
||||
selectedEnum((T)Enum.ToObject(typeof(T), index));
|
||||
|
||||
UpdateUploaderMenuNames();
|
||||
};
|
||||
|
||||
parent.DropDownItems.Add(tsmi);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SetEnumChecked(Enum value, params ToolStripDropDownItem[] parents)
|
||||
{
|
||||
int index = value.GetIndex();
|
||||
|
||||
foreach (ToolStripDropDownItem parent in parents)
|
||||
{
|
||||
((ToolStripMenuItem)parent.DropDownItems[index]).Checked = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void EnableDisableToolStripMenuItems<T>(params ToolStripDropDownItem[] parents)
|
||||
{
|
||||
foreach (ToolStripDropDownItem parent in parents)
|
||||
{
|
||||
for (int i = 0; i < parent.DropDownItems.Count; i++)
|
||||
{
|
||||
parent.DropDownItems[i].Enabled = Program.UploadersConfig.IsActive<T>(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -337,18 +389,18 @@ private void UpdateUploaderMenuNames()
|
|||
Select(x => x.GetDescription()).ToArray());
|
||||
|
||||
string imageUploader = TaskSettings.ImageDestination == ImageDestination.FileUploader ?
|
||||
TaskSettings.FileDestination.GetDescription() : TaskSettings.ImageDestination.GetDescription();
|
||||
btnImageUploaders.Text = "Image uploader: " + imageUploader;
|
||||
TaskSettings.ImageFileDestination.GetDescription() : TaskSettings.ImageDestination.GetDescription();
|
||||
tsmiImageUploaders.Text = "Image uploader: " + imageUploader;
|
||||
|
||||
string textUploader = TaskSettings.TextDestination == TextDestination.FileUploader ?
|
||||
TaskSettings.FileDestination.GetDescription() : TaskSettings.TextDestination.GetDescription();
|
||||
btnTextUploaders.Text = "Text uploader: " + textUploader;
|
||||
TaskSettings.TextFileDestination.GetDescription() : TaskSettings.TextDestination.GetDescription();
|
||||
tsmiTextUploaders.Text = "Text uploader: " + textUploader;
|
||||
|
||||
btnFileUploaders.Text = "File uploader: " + TaskSettings.FileDestination.GetDescription();
|
||||
tsmiFileUploaders.Text = "File uploader: " + TaskSettings.FileDestination.GetDescription();
|
||||
|
||||
btnURLShorteners.Text = "URL shortener: " + TaskSettings.URLShortenerDestination.GetDescription();
|
||||
tsmiURLShorteners.Text = "URL shortener: " + TaskSettings.URLShortenerDestination.GetDescription();
|
||||
|
||||
btnSocialNetworkingServices.Text = "Social networking service: " + TaskSettings.SocialNetworkingServiceDestination.GetDescription();
|
||||
tsmiSocialServices.Text = "Social networking service: " + TaskSettings.SocialNetworkingServiceDestination.GetDescription();
|
||||
}
|
||||
|
||||
private void tbDescription_TextChanged(object sender, EventArgs e)
|
||||
|
@ -371,11 +423,7 @@ private void cbUseDefaultAfterUploadSettings_CheckedChanged(object sender, Event
|
|||
private void cbUseDefaultDestinationSettings_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
TaskSettings.UseDefaultDestinations = cbUseDefaultDestinationSettings.Checked;
|
||||
btnImageUploaders.Enabled = !TaskSettings.UseDefaultDestinations;
|
||||
btnTextUploaders.Enabled = !TaskSettings.UseDefaultDestinations;
|
||||
btnFileUploaders.Enabled = !TaskSettings.UseDefaultDestinations;
|
||||
btnURLShorteners.Enabled = !TaskSettings.UseDefaultDestinations;
|
||||
btnSocialNetworkingServices.Enabled = !TaskSettings.UseDefaultDestinations;
|
||||
btnDestinations.Enabled = !TaskSettings.UseDefaultDestinations;
|
||||
}
|
||||
|
||||
private void chkOverrideFTP_CheckedChanged(object sender, EventArgs e)
|
||||
|
|
|
@ -123,22 +123,10 @@
|
|||
<metadata name="cmsAfterUpload.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>160, 17</value>
|
||||
</metadata>
|
||||
<metadata name="cmsImageUploaders.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<metadata name="cmsTask.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>299, 17</value>
|
||||
</metadata>
|
||||
<metadata name="cmsTextUploaders.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>462, 17</value>
|
||||
</metadata>
|
||||
<metadata name="cmsFileUploaders.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>613, 17</value>
|
||||
</metadata>
|
||||
<metadata name="cmsURLShorteners.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>760, 17</value>
|
||||
</metadata>
|
||||
<metadata name="cmsSocialNetworkingServices.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>914, 17</value>
|
||||
</metadata>
|
||||
<metadata name="cmsTask.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 56</value>
|
||||
<metadata name="cmsDestinations.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>396, 17</value>
|
||||
</metadata>
|
||||
</root>
|
Loading…
Reference in a new issue