diff --git a/COP_7/DropDownList.cs b/COP_7/DropDownList.cs index 402d7d5..0761371 100644 --- a/COP_7/DropDownList.cs +++ b/COP_7/DropDownList.cs @@ -19,18 +19,11 @@ namespace Components public string SelectedItem { - get + get { - if (ComboBox.Items.Count == 0) - { - return " "; - } - if (ComboBox.SelectedItem == null) - { - return " "; - } - return ComboBox.SelectedItem.ToString()!; + return ComboBox.SelectedItem?.ToString() ?? string.Empty; } + set { if (ComboBox.Items.Contains(value)) @@ -41,7 +34,6 @@ namespace Components } } - public ComboBox.ObjectCollection ComboBoxItems { get { return ComboBox.Items; } @@ -63,7 +55,7 @@ namespace Components } } - private void CustomComboBox_SelectedValueChanged(object sender, EventArgs e) + private void ComboBox_SelectedValueChanged(object sender, EventArgs e) { _onValueChangedEvent?.Invoke(sender, e); } diff --git a/COP_7/ListBoxMany.cs b/COP_7/ListBoxMany.cs index 0d8c116..b1f8062 100644 --- a/COP_7/ListBoxMany.cs +++ b/COP_7/ListBoxMany.cs @@ -13,32 +13,14 @@ namespace Components { public partial class ListBoxMany : UserControl { - /// - /// Конструктор по умолчанию - /// public ListBoxMany() { InitializeComponent(); } - - /// - /// Макет - /// private string _templateString; - - /// - /// Символ начала - /// private string _startSymbol; - - /// - /// Символ конца - /// private string _endSymbol; - /// - /// Шаблон строки - /// public void SetTemplateString(string templateString, string startSymbol, string endSymbol) { if (templateString != "" && startSymbol != "" && endSymbol != "") @@ -53,9 +35,6 @@ namespace Components } } - /// - /// Выбранная строка - /// public int SelectedIndex { get { return listBox.SelectedIndex; } @@ -67,10 +46,6 @@ namespace Components } } } - - /// - /// Получение обхекта - /// public T GetObjectFromStr() where T : class, new() { if (listBox.SelectedIndex == -1) @@ -105,10 +80,6 @@ namespace Components } return curObject; } - - /// - /// Заполнение - /// public void FillProperty(T dataObject, int rowIndex, string propertyName) { diff --git a/COP_7/TextBoxPhone.cs b/COP_7/TextBoxPhone.cs index 371e90c..d708442 100644 --- a/COP_7/TextBoxPhone.cs +++ b/COP_7/TextBoxPhone.cs @@ -14,31 +14,19 @@ namespace Components { public partial class TextBoxPhone : UserControl { - /// - /// Конструктор - /// public TextBoxPhone() { InitializeComponent(); } - /// - /// Шаблон вводимого значения - /// private string? _phonePattern; - /// - /// Шаблон вводимого значения - /// public string? PhonePattern { get { return _phonePattern; } set { _phonePattern = value; } } - /// - /// Введенное значение - /// public string? PhoneTextBox { get @@ -70,14 +58,8 @@ namespace Components } } - /// - /// Событие, вызываемое при смене значения - /// private EventHandler _onValueChangedEvent; - /// - /// Событие, вызываемое при смене значения - /// public event EventHandler ValueChanged { add @@ -90,17 +72,12 @@ namespace Components _onValueChangedEvent -= value; } } - /// - /// Смена значения - /// - private void CustomPhoneBox_PhoneChanged(object sender, EventArgs e) + + private void PhoneBox_PhoneChanged(object sender, EventArgs e) { _onValueChangedEvent?.Invoke(sender, e); } - /// - /// Выведение подсказки на экран - /// private void textBox_Enter(object sender, EventArgs e) { int visibleTime = 2000;