From 1f4ee6b285850eefbcf45e86e5f41e45e2e4a7a6 Mon Sep 17 00:00:00 2001 From: kotcheshir73 Date: Thu, 8 Apr 2021 10:43:44 +0400 Subject: [PATCH] =?UTF-8?q?=D0=B3=D0=B0=D0=BB=D0=BA=D0=B0=20=D0=BF=D1=83?= =?UTF-8?q?=D1=81=D1=82=D0=BE=D0=B3=D0=BE=20=D0=B7=D0=BD=D0=B0=D1=87=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20=D0=BD=D0=B0=D0=BA=D0=BB=D0=B0=D0=B4=D1=8B?= =?UTF-8?q?=D0=B2=D0=B0=D0=BB=D0=B0=D1=81=D1=8C=20=D0=BD=D0=B0=20=D1=8D?= =?UTF-8?q?=D0=BB=D0=B5=D0=BC=D0=B5=D0=BD=D1=82=20=D0=B2=D1=8B=D0=B2=D0=BE?= =?UTF-8?q?=D0=B4=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BaseControls/BaseControlBool.cs | 6 +++--- .../BaseControls/BaseControlDateTime.cs | 20 +++++++++---------- .../BaseControls/BaseControlDecimal.cs | 20 +++++++++---------- .../BaseControls/BaseControlEnum.cs | 19 +++++++++--------- .../BaseControls/BaseControlInt.cs | 20 +++++++++---------- 5 files changed, 43 insertions(+), 42 deletions(-) diff --git a/DepartmentPortal/Common/DesktopTools/BaseControls/BaseControlBool.cs b/DepartmentPortal/Common/DesktopTools/BaseControls/BaseControlBool.cs index ed3bee8..1bfe248 100644 --- a/DepartmentPortal/Common/DesktopTools/BaseControls/BaseControlBool.cs +++ b/DepartmentPortal/Common/DesktopTools/BaseControls/BaseControlBool.cs @@ -20,6 +20,9 @@ namespace DesktopTools.BaseControls InitializeComponent(); _baseControl = this; + checkBox.CheckedChanged += (object sender, EventArgs e) => { CallOnValueChangeEvent(); }; + panelControl.Controls.Add(checkBox); + if (!_mustFilling) { checkBoxNullable.CheckedChanged += (object sender, EventArgs e) => @@ -29,9 +32,6 @@ namespace DesktopTools.BaseControls }; panelControl.Controls.Add(checkBoxNullable); } - - checkBox.CheckedChanged += (object sender, EventArgs e) => { CallOnValueChangeEvent(); }; - panelControl.Controls.Add(checkBox); } public void SetDefaultValue() => _originalValue = _mustFilling ? false : null; diff --git a/DepartmentPortal/Common/DesktopTools/BaseControls/BaseControlDateTime.cs b/DepartmentPortal/Common/DesktopTools/BaseControls/BaseControlDateTime.cs index 7c22b9f..c895d91 100644 --- a/DepartmentPortal/Common/DesktopTools/BaseControls/BaseControlDateTime.cs +++ b/DepartmentPortal/Common/DesktopTools/BaseControls/BaseControlDateTime.cs @@ -24,16 +24,6 @@ namespace DesktopTools.BaseControls InitializeComponent(); _baseControl = this; - if (!_mustFilling) - { - checkBoxNullable.CheckedChanged += (object sender, EventArgs e) => - { - dateTimePicker.Enabled = !(sender as CheckBox).Checked; - CallOnValueChangeEvent(); - }; - panelControl.Controls.Add(checkBoxNullable); - } - dateTimePicker.ValueChanged += (object sender, EventArgs e) => { CallOnValueChangeEvent(); }; if (minDate > DateTime.MinValue) { @@ -48,6 +38,16 @@ namespace DesktopTools.BaseControls dateTimePicker.CustomFormat = customDateFormat; } panelControl.Controls.Add(dateTimePicker); + + if (!_mustFilling) + { + checkBoxNullable.CheckedChanged += (object sender, EventArgs e) => + { + dateTimePicker.Enabled = !(sender as CheckBox).Checked; + CallOnValueChangeEvent(); + }; + panelControl.Controls.Add(checkBoxNullable); + } } public void SetDefaultValue() => _originalValue = _mustFilling ? DateTime.Now : null; diff --git a/DepartmentPortal/Common/DesktopTools/BaseControls/BaseControlDecimal.cs b/DepartmentPortal/Common/DesktopTools/BaseControls/BaseControlDecimal.cs index 103e96b..13a48ef 100644 --- a/DepartmentPortal/Common/DesktopTools/BaseControls/BaseControlDecimal.cs +++ b/DepartmentPortal/Common/DesktopTools/BaseControls/BaseControlDecimal.cs @@ -23,16 +23,6 @@ namespace DesktopTools.BaseControls InitializeComponent(); _baseControl = this; - if (!_mustFilling) - { - checkBoxNullable.CheckedChanged += (object sender, EventArgs e) => - { - numericUpDown.Enabled = !(sender as CheckBox).Checked; - CallOnValueChangeEvent(); - }; - panelControl.Controls.Add(checkBoxNullable); - } - numericUpDown.ValueChanged += (object sender, EventArgs e) => { CallOnValueChangeEvent(); }; if (minValue != 0) { @@ -47,6 +37,16 @@ namespace DesktopTools.BaseControls numericUpDown.DecimalPlaces = decimalPlaces; } panelControl.Controls.Add(numericUpDown); + + if (!_mustFilling) + { + checkBoxNullable.CheckedChanged += (object sender, EventArgs e) => + { + numericUpDown.Enabled = !(sender as CheckBox).Checked; + CallOnValueChangeEvent(); + }; + panelControl.Controls.Add(checkBoxNullable); + } } public void SetDefaultValue() => _originalValue = _mustFilling ? 0 : null; diff --git a/DepartmentPortal/Common/DesktopTools/BaseControls/BaseControlEnum.cs b/DepartmentPortal/Common/DesktopTools/BaseControls/BaseControlEnum.cs index 50deb7c..4e93e46 100644 --- a/DepartmentPortal/Common/DesktopTools/BaseControls/BaseControlEnum.cs +++ b/DepartmentPortal/Common/DesktopTools/BaseControls/BaseControlEnum.cs @@ -22,15 +22,6 @@ namespace DesktopTools.BaseControls InitializeComponent(); _baseControl = this; - if (!_mustFilling) - { - checkBoxNullable.CheckedChanged += (object sender, EventArgs e) => - { - comboBox.Enabled = !(sender as CheckBox).Checked; - CallOnValueChangeEvent(); - }; - panelControl.Controls.Add(checkBoxNullable); - } if (enumType.Name.StartsWith("Nullable")) { enumType = Nullable.GetUnderlyingType(enumType); @@ -43,6 +34,16 @@ namespace DesktopTools.BaseControls } comboBox.SelectedIndexChanged += (object sender, EventArgs e) => { CallOnValueChangeEvent(); }; panelControl.Controls.Add(comboBox); + + if (!_mustFilling) + { + checkBoxNullable.CheckedChanged += (object sender, EventArgs e) => + { + comboBox.Enabled = !(sender as CheckBox).Checked; + CallOnValueChangeEvent(); + }; + panelControl.Controls.Add(checkBoxNullable); + } } public void SetDefaultValue() => _originalValue = null; diff --git a/DepartmentPortal/Common/DesktopTools/BaseControls/BaseControlInt.cs b/DepartmentPortal/Common/DesktopTools/BaseControls/BaseControlInt.cs index 4bc53c3..f9fd357 100644 --- a/DepartmentPortal/Common/DesktopTools/BaseControls/BaseControlInt.cs +++ b/DepartmentPortal/Common/DesktopTools/BaseControls/BaseControlInt.cs @@ -22,16 +22,6 @@ namespace DesktopTools.BaseControls InitializeComponent(); _baseControl = this; - if (!_mustFilling) - { - checkBoxNullable.CheckedChanged += (object sender, EventArgs e) => - { - numericUpDown.Enabled = !(sender as CheckBox).Checked; - CallOnValueChangeEvent(); - }; - panelControl.Controls.Add(checkBoxNullable); - } - numericUpDown.ValueChanged += (object sender, EventArgs e) => { CallOnValueChangeEvent(); }; if (minValue != 0) { @@ -42,6 +32,16 @@ namespace DesktopTools.BaseControls numericUpDown.Maximum = maxValue; } panelControl.Controls.Add(numericUpDown); + + if (!_mustFilling) + { + checkBoxNullable.CheckedChanged += (object sender, EventArgs e) => + { + numericUpDown.Enabled = !(sender as CheckBox).Checked; + CallOnValueChangeEvent(); + }; + panelControl.Controls.Add(checkBoxNullable); + } } public void SetDefaultValue() => _originalValue = _mustFilling ? 0 : null;