2023-10-18 19:08:16 +04:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
namespace KOP_Labs
|
|
|
|
|
{
|
|
|
|
|
public partial class BooksForm : UserControl
|
|
|
|
|
{
|
|
|
|
|
public BooksForm()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string? SelectedValue
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (listBoxComponent.SelectedItem == null)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
return listBoxComponent.SelectedItem.ToString()!;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (value != null && !listBoxComponent.Items.Contains(value))
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
listBoxComponent.SelectedItem = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private event EventHandler? _selectChanged;
|
|
|
|
|
|
|
|
|
|
public event EventHandler SelectChanged
|
|
|
|
|
{
|
|
|
|
|
add { _selectChanged += value; }
|
|
|
|
|
remove { _selectChanged -= value; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void FillValues(string values)
|
|
|
|
|
{
|
|
|
|
|
if (values == null || values.Length == 0)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
listBoxComponent.Items.Add(values);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void ClearList()
|
|
|
|
|
{
|
|
|
|
|
listBoxComponent.Items.Clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void listBoxComponent_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
2023-11-30 23:20:29 +04:00
|
|
|
|
_selectChanged?.Invoke(this, e);
|
2023-10-18 19:08:16 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|