помогите

This commit is contained in:
kamilia 2024-09-17 12:44:30 +04:00
parent c4bb4272c6
commit 229d6fa965
3 changed files with 6 additions and 66 deletions

View File

@ -21,16 +21,9 @@ namespace Components
{
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);
}

View File

@ -13,32 +13,14 @@ namespace Components
{
public partial class ListBoxMany : UserControl
{
/// <summary>
/// Конструктор по умолчанию
/// </summary>
public ListBoxMany()
{
InitializeComponent();
}
/// <summary>
/// Макет
/// </summary>
private string _templateString;
/// <summary>
/// Символ начала
/// </summary>
private string _startSymbol;
/// <summary>
/// Символ конца
/// </summary>
private string _endSymbol;
/// <summary>
/// Шаблон строки
/// </summary>
public void SetTemplateString(string templateString, string startSymbol, string endSymbol)
{
if (templateString != "" && startSymbol != "" && endSymbol != "")
@ -53,9 +35,6 @@ namespace Components
}
}
/// <summary>
/// Выбранная строка
/// </summary>
public int SelectedIndex
{
get { return listBox.SelectedIndex; }
@ -67,10 +46,6 @@ namespace Components
}
}
}
/// <summary>
/// Получение обхекта
/// </summary>
public T GetObjectFromStr<T>() where T : class, new()
{
if (listBox.SelectedIndex == -1)
@ -105,10 +80,6 @@ namespace Components
}
return curObject;
}
/// <summary>
/// Заполнение
/// </summary>
public void FillProperty<T>(T dataObject, int rowIndex, string propertyName)
{

View File

@ -14,31 +14,19 @@ namespace Components
{
public partial class TextBoxPhone : UserControl
{
/// <summary>
/// Конструктор
/// </summary>
public TextBoxPhone()
{
InitializeComponent();
}
/// <summary>
/// Шаблон вводимого значения
/// </summary>
private string? _phonePattern;
/// <summary>
/// Шаблон вводимого значения
/// </summary>
public string? PhonePattern
{
get { return _phonePattern; }
set { _phonePattern = value; }
}
/// <summary>
/// Введенное значение
/// </summary>
public string? PhoneTextBox
{
get
@ -70,14 +58,8 @@ namespace Components
}
}
/// <summary>
/// Событие, вызываемое при смене значения
/// </summary>
private EventHandler _onValueChangedEvent;
/// <summary>
/// Событие, вызываемое при смене значения
/// </summary>
public event EventHandler ValueChanged
{
add
@ -90,17 +72,12 @@ namespace Components
_onValueChangedEvent -= value;
}
}
/// <summary>
/// Смена значения
/// </summary>
private void CustomPhoneBox_PhoneChanged(object sender, EventArgs e)
private void PhoneBox_PhoneChanged(object sender, EventArgs e)
{
_onValueChangedEvent?.Invoke(sender, e);
}
/// <summary>
/// Выведение подсказки на экран
/// </summary>
private void textBox_Enter(object sender, EventArgs e)
{
int visibleTime = 2000;