Skip to content

Commit

Permalink
fixed #7686: Use SetValue
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaex committed Nov 22, 2024
1 parent 434b94c commit bd93e8b
Show file tree
Hide file tree
Showing 12 changed files with 55 additions and 54 deletions.
4 changes: 2 additions & 2 deletions ShareX.HelpersLib/Controls/DoubleLabeledNumericUpDown.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 62,7 @@ public decimal Value
}
set
{
nudValue.Value = value.Clamp(Minimum, Maximum);
nudValue.SetValue(value);
}
}

Expand All @@ -74,7 74,7 @@ public decimal Value2
}
set
{
nudValue2.Value = value.Clamp(Minimum, Maximum);
nudValue2.SetValue(value);
}
}

Expand Down
4 changes: 2 additions & 2 deletions ShareX.HelpersLib/Forms/ColorPickerForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
4 changes: 2 additions & 2 deletions ShareX.ScreenCaptureLib/Forms/ImageSizeForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions ShareX.ScreenCaptureLib/Forms/NewImageForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
15 changes: 8 additions & 7 deletions ShareX.UploadersLib/FileUploaders/Plik.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
24 changes: 12 additions & 12 deletions ShareX.UploadersLib/Forms/UploadersConfigForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions ShareX.UploadersLib/Forms/UploadersConfigForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
20 changes: 10 additions & 10 deletions ShareX.UploadersLib/Forms/UploadersConfigForm.resx
Original file line number Diff line number Diff line change
Expand Up @@ -6881,25 6881,25 @@ For example, if your bucket is called "bucket.example.com" then URL will be "htt
<data name="&gt;&gt;cbOwnCloudAppendFileNameToURL.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="txtOwnCloudExpiryTime.Location" type="System.Drawing.Point, System.Drawing">
<data name="nudOwnCloudExpiryTime.Location" type="System.Drawing.Point, System.Drawing">
<value>16, 224</value>
</data>
<data name="txtOwnCloudExpiryTime.Size" type="System.Drawing.Size, System.Drawing">
<data name="nudOwnCloudExpiryTime.Size" type="System.Drawing.Size, System.Drawing">
<value>248, 20</value>
</data>
<data name="txtOwnCloudExpiryTime.TabIndex" type="System.Int32, mscorlib">
<data name="nudOwnCloudExpiryTime.TabIndex" type="System.Int32, mscorlib">
<value>20</value>
</data>
<data name="&gt;&gt;txtOwnCloudExpiryTime.Name" xml:space="preserve">
<value>txtOwnCloudExpiryTime</value>
<data name="&gt;&gt;nudOwnCloudExpiryTime.Name" xml:space="preserve">
<value>nudOwnCloudExpiryTime</value>
</data>
<data name="&gt;&gt;txtOwnCloudExpiryTime.Type" xml:space="preserve">
<data name="&gt;&gt;nudOwnCloudExpiryTime.Type" xml:space="preserve">
<value>System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;txtOwnCloudExpiryTime.Parent" xml:space="preserve">
<data name="&gt;&gt;nudOwnCloudExpiryTime.Parent" xml:space="preserve">
<value>tpOwnCloud</value>
</data>
<data name="&gt;&gt;txtOwnCloudExpiryTime.ZOrder" xml:space="preserve">
<data name="&gt;&gt;nudOwnCloudExpiryTime.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="cbOwnCloudAutoExpire.AutoSize" type="System.Boolean, mscorlib">
Expand Down Expand Up @@ -7317,13 7317,13 @@ For example, if your bucket is called "bucket.example.com" then URL will be "htt
<value>16</value>
</data>
<data name="tpOwnCloud.Location" type="System.Drawing.Point, System.Drawing">
<value>4, 220</value>
<value>4, 58</value>
</data>
<data name="tpOwnCloud.Padding" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>3, 3, 3, 3</value>
</data>
<data name="tpOwnCloud.Size" type="System.Drawing.Size, System.Drawing">
<value>178, 0</value>
<value>803, 507</value>
</data>
<data name="tpOwnCloud.TabIndex" type="System.Int32, mscorlib">
<value>15</value>
Expand Down
2 changes: 1 addition & 1 deletion ShareX.UploadersLib/Forms/UploadersConfigFormHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion ShareX/Forms/TaskSettingsForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ShareX/Forms/TaskSettingsForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 406,7 @@ public TaskSettingsForm(TaskSettings hotkeySetting, bool isDefault = false)
CodeMenu.Create<CodeMenuEntryFilename>(txtNameFormatPattern, CodeMenuEntryFilename.n, CodeMenuEntryFilename.t, CodeMenuEntryFilename.pn);
CodeMenu.Create<CodeMenuEntryFilename>(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());
Expand Down
20 changes: 10 additions & 10 deletions ShareX/Forms/TaskSettingsForm.resx
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 526,7 @@
<value>btnAfterCapture</value>
</data>
<data name="&gt;&gt;btnAfterCapture.Type" xml:space="preserve">
<value>ShareX.HelpersLib.MenuButton, ShareX.HelpersLib, Version=16.1.2.0, Culture=neutral, PublicKeyToken=null</value>
<value>ShareX.HelpersLib.MenuButton, ShareX.HelpersLib, Version=16.1.3.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;btnAfterCapture.Parent" xml:space="preserve">
<value>tpTask</value>
Expand Down Expand Up @@ -556,7 556,7 @@
<value>btnAfterUpload</value>
</data>
<data name="&gt;&gt;btnAfterUpload.Type" xml:space="preserve">
<value>ShareX.HelpersLib.MenuButton, ShareX.HelpersLib, Version=16.1.2.0, Culture=neutral, PublicKeyToken=null</value>
<value>ShareX.HelpersLib.MenuButton, ShareX.HelpersLib, Version=16.1.3.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;btnAfterUpload.Parent" xml:space="preserve">
<value>tpTask</value>
Expand Down Expand Up @@ -628,7 628,7 @@
<value>btnDestinations</value>
</data>
<data name="&gt;&gt;btnDestinations.Type" xml:space="preserve">
<value>ShareX.HelpersLib.MenuButton, ShareX.HelpersLib, Version=16.1.2.0, Culture=neutral, PublicKeyToken=null</value>
<value>ShareX.HelpersLib.MenuButton, ShareX.HelpersLib, Version=16.1.3.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;btnDestinations.Parent" xml:space="preserve">
<value>tpTask</value>
Expand Down Expand Up @@ -664,7 664,7 @@
<value>btnTask</value>
</data>
<data name="&gt;&gt;btnTask.Type" xml:space="preserve">
<value>ShareX.HelpersLib.MenuButton, ShareX.HelpersLib, Version=16.1.2.0, Culture=neutral, PublicKeyToken=null</value>
<value>ShareX.HelpersLib.MenuButton, ShareX.HelpersLib, Version=16.1.3.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;btnTask.Parent" xml:space="preserve">
<value>tpTask</value>
Expand Down Expand Up @@ -5590,7 5590,7 @@
<value>NoControl</value>
</data>
<data name="btnAutoIncrementNumber.Location" type="System.Drawing.Point, System.Drawing">
<value>104, 176</value>
<value>120, 176</value>
</data>
<data name="btnAutoIncrementNumber.Size" type="System.Drawing.Size, System.Drawing">
<value>96, 23</value>
Expand Down Expand Up @@ -5647,7 5647,7 @@
<value>8, 177</value>
</data>
<data name="nudAutoIncrementNumber.Size" type="System.Drawing.Size, System.Drawing">
<value>88, 20</value>
<value>104, 20</value>
</data>
<data name="nudAutoIncrementNumber.TabIndex" type="System.Int32, mscorlib">
<value>13</value>
Expand Down Expand Up @@ -6142,7 6142,7 @@
<value>lvUploaderFiltersList</value>
</data>
<data name="&gt;&gt;lvUploaderFiltersList.Type" xml:space="preserve">
<value>ShareX.HelpersLib.MyListView, ShareX.HelpersLib, Version=16.1.2.0, Culture=neutral, PublicKeyToken=null</value>
<value>ShareX.HelpersLib.MyListView, ShareX.HelpersLib, Version=16.1.3.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;lvUploaderFiltersList.Parent" xml:space="preserve">
<value>tpUploaderFilters</value>
Expand Down Expand Up @@ -6595,7 6595,7 @@
<value>lvActions</value>
</data>
<data name="&gt;&gt;lvActions.Type" xml:space="preserve">
<value>ShareX.HelpersLib.MyListView, ShareX.HelpersLib, Version=16.1.2.0, Culture=neutral, PublicKeyToken=null</value>
<value>ShareX.HelpersLib.MyListView, ShareX.HelpersLib, Version=16.1.3.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;lvActions.Parent" xml:space="preserve">
<value>pActions</value>
Expand Down Expand Up @@ -6841,7 6841,7 @@
<value>lvWatchFolderList</value>
</data>
<data name="&gt;&gt;lvWatchFolderList.Type" xml:space="preserve">
<value>ShareX.HelpersLib.MyListView, ShareX.HelpersLib, Version=16.1.2.0, Culture=neutral, PublicKeyToken=null</value>
<value>ShareX.HelpersLib.MyListView, ShareX.HelpersLib, Version=16.1.3.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;lvWatchFolderList.Parent" xml:space="preserve">
<value>tpWatchFolders</value>
Expand Down Expand Up @@ -7300,7 7300,7 @@
<value>tttvMain</value>
</data>
<data name="&gt;&gt;tttvMain.Type" xml:space="preserve">
<value>ShareX.HelpersLib.TabToTreeView, ShareX.HelpersLib, Version=16.1.2.0, Culture=neutral, PublicKeyToken=null</value>
<value>ShareX.HelpersLib.TabToTreeView, ShareX.HelpersLib, Version=16.1.3.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;tttvMain.Parent" xml:space="preserve">
<value>$this</value>
Expand Down

0 comments on commit bd93e8b

Please sign in to comment.