From bd93e8b4b0963f644e139946d478ceff93ca9f8c Mon Sep 17 00:00:00 2001 From: Jaex Date: Fri, 22 Nov 2024 16:12:31 +0300 Subject: [PATCH] fixed #7686: Use SetValue --- .../Controls/DoubleLabeledNumericUpDown.cs | 4 ++-- ShareX.HelpersLib/Forms/ColorPickerForm.cs | 4 ++-- .../Forms/ImageSizeForm.cs | 4 ++-- ShareX.ScreenCaptureLib/Forms/NewImageForm.cs | 4 ++-- ShareX.UploadersLib/FileUploaders/Plik.cs | 15 ++++++------ .../Forms/UploadersConfigForm.Designer.cs | 24 +++++++++---------- .../Forms/UploadersConfigForm.cs | 8 +++---- .../Forms/UploadersConfigForm.resx | 20 ++++++++-------- .../Forms/UploadersConfigFormHelper.cs | 2 +- ShareX/Forms/TaskSettingsForm.Designer.cs | 2 +- ShareX/Forms/TaskSettingsForm.cs | 2 +- ShareX/Forms/TaskSettingsForm.resx | 20 ++++++++-------- 12 files changed, 55 insertions(+), 54 deletions(-) diff --git a/ShareX.HelpersLib/Controls/DoubleLabeledNumericUpDown.cs b/ShareX.HelpersLib/Controls/DoubleLabeledNumericUpDown.cs index 84597839ddf..a0994298ad0 100644 --- a/ShareX.HelpersLib/Controls/DoubleLabeledNumericUpDown.cs +++ b/ShareX.HelpersLib/Controls/DoubleLabeledNumericUpDown.cs @@ -62,7 +62,7 @@ public decimal Value } set { - nudValue.Value = value.Clamp(Minimum, Maximum); + nudValue.SetValue(value); } } @@ -74,7 +74,7 @@ public decimal Value2 } set { - nudValue2.Value = value.Clamp(Minimum, Maximum); + nudValue2.SetValue(value); } } diff --git a/ShareX.HelpersLib/Forms/ColorPickerForm.cs b/ShareX.HelpersLib/Forms/ColorPickerForm.cs index 50a3c1eb7d7..6394aa0e9f2 100644 --- a/ShareX.HelpersLib/Forms/ColorPickerForm.cs +++ b/ShareX.HelpersLib/Forms/ColorPickerForm.cs @@ -375,11 +375,11 @@ private void cbTransparent_Click(object sender, EventArgs e) { if (nudAlpha.Value == 0) { - nudAlpha.Value = 255; + nudAlpha.SetValue(255); } else { - nudAlpha.Value = 0; + nudAlpha.SetValue(0); } } diff --git a/ShareX.ScreenCaptureLib/Forms/ImageSizeForm.cs b/ShareX.ScreenCaptureLib/Forms/ImageSizeForm.cs index 7cc38f27ac0..233b48fae0d 100644 --- a/ShareX.ScreenCaptureLib/Forms/ImageSizeForm.cs +++ b/ShareX.ScreenCaptureLib/Forms/ImageSizeForm.cs @@ -74,7 +74,7 @@ private void ApplyWidthAspectRatio() if (cbAspectRatio.Checked) { ignoreValueChanged = true; - nudHeight.Value = (int)Math.Round((double)nudWidth.Value * heightRatio); + nudHeight.SetValue((int)Math.Round((double)nudWidth.Value * heightRatio)); ignoreValueChanged = false; } @@ -89,7 +89,7 @@ private void ApplyHeightAspectRatio() if (cbAspectRatio.Checked) { ignoreValueChanged = true; - nudWidth.Value = (int)Math.Round((double)nudHeight.Value * widthRatio); + nudWidth.SetValue((int)Math.Round((double)nudHeight.Value * widthRatio)); ignoreValueChanged = false; } diff --git a/ShareX.ScreenCaptureLib/Forms/NewImageForm.cs b/ShareX.ScreenCaptureLib/Forms/NewImageForm.cs index d51d891470a..f52a3800413 100644 --- a/ShareX.ScreenCaptureLib/Forms/NewImageForm.cs +++ b/ShareX.ScreenCaptureLib/Forms/NewImageForm.cs @@ -44,8 +44,8 @@ public NewImageForm(RegionCaptureOptions options) nudWidth.TextChanged += NudWidth_TextChanged; nudHeight.TextChanged += NudHeight_TextChanged; - nudWidth.Value = Options.EditorNewImageSize.Width; - nudHeight.Value = Options.EditorNewImageSize.Height; + nudWidth.SetValue(Options.EditorNewImageSize.Width); + nudHeight.SetValue(Options.EditorNewImageSize.Height); cbTransparent.Checked = Options.EditorNewImageTransparent; btnChangeColor.ColorPickerOptions = options.ColorPickerOptions; btnChangeColor.Color = options.EditorNewImageBackgroundColor; diff --git a/ShareX.UploadersLib/FileUploaders/Plik.cs b/ShareX.UploadersLib/FileUploaders/Plik.cs index e8956bf5262..763975b88ec 100644 --- a/ShareX.UploadersLib/FileUploaders/Plik.cs +++ b/ShareX.UploadersLib/FileUploaders/Plik.cs @@ -115,21 +115,22 @@ private UploadResult ConvertResult(UploadMetadataResponse metaData, UploadResult return result; } - internal static void CalculateTTLValue(NumericUpDown ttlElement, int newUnit, int oldUnit) + internal static void CalculateTTLValue(NumericUpDown nudTTL, int newUnit, int oldUnit) { if (newUnit != 3) { - if (ttlElement.Value == -1) + if (nudTTL.Value == -1) { - ttlElement.Value = 1; + nudTTL.SetValue(1); } - ttlElement.Value *= GetMultiplyIndex(newUnit, oldUnit); - ttlElement.ReadOnly = false; + + nudTTL.SetValue(nudTTL.Value * GetMultiplyIndex(newUnit, oldUnit)); + nudTTL.ReadOnly = false; } else { - ttlElement.Value = -1; - ttlElement.ReadOnly = true; + nudTTL.SetValue(-1); + nudTTL.ReadOnly = true; } } diff --git a/ShareX.UploadersLib/Forms/UploadersConfigForm.Designer.cs b/ShareX.UploadersLib/Forms/UploadersConfigForm.Designer.cs index 6dd8f7cea15..2c2ed9d6482 100644 --- a/ShareX.UploadersLib/Forms/UploadersConfigForm.Designer.cs +++ b/ShareX.UploadersLib/Forms/UploadersConfigForm.Designer.cs @@ -315,7 +315,7 @@ private void InitializeComponent() this.lblMegaPassword = new System.Windows.Forms.Label(); this.tpOwnCloud = new System.Windows.Forms.TabPage(); this.cbOwnCloudAppendFileNameToURL = new System.Windows.Forms.CheckBox(); - this.txtOwnCloudExpiryTime = new System.Windows.Forms.NumericUpDown(); + this.nudOwnCloudExpiryTime = new System.Windows.Forms.NumericUpDown(); this.cbOwnCloudAutoExpire = new System.Windows.Forms.CheckBox(); this.lblOwnCloudExpiryTime = new System.Windows.Forms.Label(); this.cbOwnCloudUsePreviewLinks = new System.Windows.Forms.CheckBox(); @@ -634,7 +634,7 @@ private void InitializeComponent() this.tpBackblazeB2.SuspendLayout(); this.tpMega.SuspendLayout(); this.tpOwnCloud.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.txtOwnCloudExpiryTime)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.nudOwnCloudExpiryTime)).BeginInit(); this.tpMediaFire.SuspendLayout(); this.tpPushbullet.SuspendLayout(); this.tpSendSpace.SuspendLayout(); @@ -2579,7 +2579,7 @@ private void InitializeComponent() // this.tpOwnCloud.BackColor = System.Drawing.SystemColors.Window; this.tpOwnCloud.Controls.Add(this.cbOwnCloudAppendFileNameToURL); - this.tpOwnCloud.Controls.Add(this.txtOwnCloudExpiryTime); + this.tpOwnCloud.Controls.Add(this.nudOwnCloudExpiryTime); this.tpOwnCloud.Controls.Add(this.cbOwnCloudAutoExpire); this.tpOwnCloud.Controls.Add(this.lblOwnCloudExpiryTime); this.tpOwnCloud.Controls.Add(this.cbOwnCloudUsePreviewLinks); @@ -2606,26 +2606,26 @@ private void InitializeComponent() this.cbOwnCloudAppendFileNameToURL.UseVisualStyleBackColor = true; this.cbOwnCloudAppendFileNameToURL.CheckedChanged += new System.EventHandler(this.cbOwnCloudAppendFileNameToURL_CheckedChanged); // - // txtOwnCloudExpiryTime + // nudOwnCloudExpiryTime // - resources.ApplyResources(this.txtOwnCloudExpiryTime, "txtOwnCloudExpiryTime"); - this.txtOwnCloudExpiryTime.Maximum = new decimal(new int[] { + resources.ApplyResources(this.nudOwnCloudExpiryTime, "nudOwnCloudExpiryTime"); + this.nudOwnCloudExpiryTime.Maximum = new decimal(new int[] { 1410065407, 2, 0, 0}); - this.txtOwnCloudExpiryTime.Minimum = new decimal(new int[] { + this.nudOwnCloudExpiryTime.Minimum = new decimal(new int[] { 1, 0, 0, 0}); - this.txtOwnCloudExpiryTime.Name = "txtOwnCloudExpiryTime"; - this.txtOwnCloudExpiryTime.Value = new decimal(new int[] { + this.nudOwnCloudExpiryTime.Name = "nudOwnCloudExpiryTime"; + this.nudOwnCloudExpiryTime.Value = new decimal(new int[] { 1, 0, 0, 0}); - this.txtOwnCloudExpiryTime.ValueChanged += new System.EventHandler(this.txtOwnExpiryTime_TextChanged); + this.nudOwnCloudExpiryTime.ValueChanged += new System.EventHandler(this.nudOwnExpiryTime_TextChanged); // // cbOwnCloudAutoExpire // @@ -4752,7 +4752,7 @@ private void InitializeComponent() this.tpMega.PerformLayout(); this.tpOwnCloud.ResumeLayout(false); this.tpOwnCloud.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.txtOwnCloudExpiryTime)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.nudOwnCloudExpiryTime)).EndInit(); this.tpMediaFire.ResumeLayout(false); this.tpMediaFire.PerformLayout(); this.tpPushbullet.ResumeLayout(false); @@ -5335,7 +5335,7 @@ private void InitializeComponent() private System.Windows.Forms.Label lblFirebaseDomainExample; private System.Windows.Forms.Label lblOwnCloudExpiryTime; private System.Windows.Forms.CheckBox cbOwnCloudAutoExpire; - private System.Windows.Forms.NumericUpDown txtOwnCloudExpiryTime; + private System.Windows.Forms.NumericUpDown nudOwnCloudExpiryTime; internal System.Windows.Forms.TabPage tpBackblazeB2; private System.Windows.Forms.TextBox txtB2CustomUrl; private System.Windows.Forms.Label lblB2UrlPreviewLabel; diff --git a/ShareX.UploadersLib/Forms/UploadersConfigForm.cs b/ShareX.UploadersLib/Forms/UploadersConfigForm.cs index b5f3c259343..7702cd601f7 100644 --- a/ShareX.UploadersLib/Forms/UploadersConfigForm.cs +++ b/ShareX.UploadersLib/Forms/UploadersConfigForm.cs @@ -563,7 +563,7 @@ private void LoadFileUploaderSettings() txtOwnCloudUsername.Text = Config.OwnCloudUsername; txtOwnCloudPassword.Text = Config.OwnCloudPassword; txtOwnCloudPath.Text = Config.OwnCloudPath; - txtOwnCloudExpiryTime.Value = Config.OwnCloudExpiryTime; + nudOwnCloudExpiryTime.SetValue(Config.OwnCloudExpiryTime); cbOwnCloudCreateShare.Checked = Config.OwnCloudCreateShare; cbOwnCloudDirectLink.Checked = Config.OwnCloudDirectLink; cbOwnCloudAppendFileNameToURL.Checked = Config.OwnCloudAppendFileNameToURL; @@ -675,7 +675,7 @@ private void LoadFileUploaderSettings() cbPlikIsSecured.Checked = Config.PlikSettings.IsSecured; cbPlikRemovable.Checked = Config.PlikSettings.Removable; cbPlikOneShot.Checked = Config.PlikSettings.OneShot; - nudPlikTTL.Value = Config.PlikSettings.TTL; + nudPlikTTL.SetValue(Config.PlikSettings.TTL); cbPlikTTLUnit.SelectedIndex = Config.PlikSettings.TTLUnit; txtPlikComment.ReadOnly = !cbPlikComment.Checked; txtPlikLogin.ReadOnly = !cbPlikIsSecured.Checked; @@ -2168,9 +2168,9 @@ private void txtOwnCloudPath_TextChanged(object sender, EventArgs e) Config.OwnCloudPath = txtOwnCloudPath.Text; } - private void txtOwnExpiryTime_TextChanged(object sender, EventArgs e) + private void nudOwnExpiryTime_TextChanged(object sender, EventArgs e) { - Config.OwnCloudExpiryTime = Convert.ToInt32(txtOwnCloudExpiryTime.Value); + Config.OwnCloudExpiryTime = Convert.ToInt32(nudOwnCloudExpiryTime.Value); } private void cbOwnCloudCreateShare_CheckedChanged(object sender, EventArgs e) diff --git a/ShareX.UploadersLib/Forms/UploadersConfigForm.resx b/ShareX.UploadersLib/Forms/UploadersConfigForm.resx index 3fc8c9292ee..53efe819d78 100644 --- a/ShareX.UploadersLib/Forms/UploadersConfigForm.resx +++ b/ShareX.UploadersLib/Forms/UploadersConfigForm.resx @@ -6881,25 +6881,25 @@ For example, if your bucket is called "bucket.example.com" then URL will be "htt 0 - + 16, 224 - + 248, 20 - + 20 - - txtOwnCloudExpiryTime + + nudOwnCloudExpiryTime - + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + tpOwnCloud - + 1 @@ -7317,13 +7317,13 @@ For example, if your bucket is called "bucket.example.com" then URL will be "htt 16 - 4, 220 + 4, 58 3, 3, 3, 3 - 178, 0 + 803, 507 15 diff --git a/ShareX.UploadersLib/Forms/UploadersConfigFormHelper.cs b/ShareX.UploadersLib/Forms/UploadersConfigFormHelper.cs index 332f27d6a22..acd19e2e103 100644 --- a/ShareX.UploadersLib/Forms/UploadersConfigFormHelper.cs +++ b/ShareX.UploadersLib/Forms/UploadersConfigFormHelper.cs @@ -522,7 +522,7 @@ private void FTPLoadAccount(FTPAccount account) } txtFTPHost.Text = account.Host; - nudFTPPort.Value = account.Port; + nudFTPPort.SetValue(account.Port); txtFTPUsername.Text = account.Username; txtFTPPassword.Text = account.Password; diff --git a/ShareX/Forms/TaskSettingsForm.Designer.cs b/ShareX/Forms/TaskSettingsForm.Designer.cs index 45c42f7490e..c7de1b140bb 100644 --- a/ShareX/Forms/TaskSettingsForm.Designer.cs +++ b/ShareX/Forms/TaskSettingsForm.Designer.cs @@ -2210,7 +2210,7 @@ private void InitializeComponent() // resources.ApplyResources(this.nudAutoIncrementNumber, "nudAutoIncrementNumber"); this.nudAutoIncrementNumber.Maximum = new decimal(new int[] { - 100000000, + 1000000000, 0, 0, 0}); diff --git a/ShareX/Forms/TaskSettingsForm.cs b/ShareX/Forms/TaskSettingsForm.cs index 616e5bb4fb5..d0465973144 100644 --- a/ShareX/Forms/TaskSettingsForm.cs +++ b/ShareX/Forms/TaskSettingsForm.cs @@ -406,7 +406,7 @@ public TaskSettingsForm(TaskSettings hotkeySetting, bool isDefault = false) CodeMenu.Create(txtNameFormatPattern, CodeMenuEntryFilename.n, CodeMenuEntryFilename.t, CodeMenuEntryFilename.pn); CodeMenu.Create(txtNameFormatPatternActiveWindow, CodeMenuEntryFilename.n); cbFileUploadUseNamePattern.Checked = TaskSettings.UploadSettings.FileUploadUseNamePattern; - nudAutoIncrementNumber.Value = Program.Settings.NameParserAutoIncrementNumber; + nudAutoIncrementNumber.SetValue(Program.Settings.NameParserAutoIncrementNumber); UpdateNameFormatPreviews(); cbNameFormatCustomTimeZone.Checked = cbNameFormatTimeZone.Enabled = TaskSettings.UploadSettings.UseCustomTimeZone; cbNameFormatTimeZone.Items.AddRange(TimeZoneInfo.GetSystemTimeZones().ToArray()); diff --git a/ShareX/Forms/TaskSettingsForm.resx b/ShareX/Forms/TaskSettingsForm.resx index dafd203f7eb..86ffc97d54f 100644 --- a/ShareX/Forms/TaskSettingsForm.resx +++ b/ShareX/Forms/TaskSettingsForm.resx @@ -526,7 +526,7 @@ btnAfterCapture - ShareX.HelpersLib.MenuButton, ShareX.HelpersLib, Version=16.1.2.0, Culture=neutral, PublicKeyToken=null + ShareX.HelpersLib.MenuButton, ShareX.HelpersLib, Version=16.1.3.0, Culture=neutral, PublicKeyToken=null tpTask @@ -556,7 +556,7 @@ btnAfterUpload - ShareX.HelpersLib.MenuButton, ShareX.HelpersLib, Version=16.1.2.0, Culture=neutral, PublicKeyToken=null + ShareX.HelpersLib.MenuButton, ShareX.HelpersLib, Version=16.1.3.0, Culture=neutral, PublicKeyToken=null tpTask @@ -628,7 +628,7 @@ btnDestinations - ShareX.HelpersLib.MenuButton, ShareX.HelpersLib, Version=16.1.2.0, Culture=neutral, PublicKeyToken=null + ShareX.HelpersLib.MenuButton, ShareX.HelpersLib, Version=16.1.3.0, Culture=neutral, PublicKeyToken=null tpTask @@ -664,7 +664,7 @@ btnTask - ShareX.HelpersLib.MenuButton, ShareX.HelpersLib, Version=16.1.2.0, Culture=neutral, PublicKeyToken=null + ShareX.HelpersLib.MenuButton, ShareX.HelpersLib, Version=16.1.3.0, Culture=neutral, PublicKeyToken=null tpTask @@ -5590,7 +5590,7 @@ NoControl - 104, 176 + 120, 176 96, 23 @@ -5647,7 +5647,7 @@ 8, 177 - 88, 20 + 104, 20 13 @@ -6142,7 +6142,7 @@ lvUploaderFiltersList - ShareX.HelpersLib.MyListView, ShareX.HelpersLib, Version=16.1.2.0, Culture=neutral, PublicKeyToken=null + ShareX.HelpersLib.MyListView, ShareX.HelpersLib, Version=16.1.3.0, Culture=neutral, PublicKeyToken=null tpUploaderFilters @@ -6595,7 +6595,7 @@ lvActions - ShareX.HelpersLib.MyListView, ShareX.HelpersLib, Version=16.1.2.0, Culture=neutral, PublicKeyToken=null + ShareX.HelpersLib.MyListView, ShareX.HelpersLib, Version=16.1.3.0, Culture=neutral, PublicKeyToken=null pActions @@ -6841,7 +6841,7 @@ lvWatchFolderList - ShareX.HelpersLib.MyListView, ShareX.HelpersLib, Version=16.1.2.0, Culture=neutral, PublicKeyToken=null + ShareX.HelpersLib.MyListView, ShareX.HelpersLib, Version=16.1.3.0, Culture=neutral, PublicKeyToken=null tpWatchFolders @@ -7300,7 +7300,7 @@ tttvMain - ShareX.HelpersLib.TabToTreeView, ShareX.HelpersLib, Version=16.1.2.0, Culture=neutral, PublicKeyToken=null + ShareX.HelpersLib.TabToTreeView, ShareX.HelpersLib, Version=16.1.3.0, Culture=neutral, PublicKeyToken=null $this