2024-09-09 22:02:46 +04:00
|
|
|
|
using CreateVisualComponent;
|
|
|
|
|
using Microsoft.VisualBasic.Devices;
|
|
|
|
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Header;
|
|
|
|
|
|
|
|
|
|
namespace WinFormsTest
|
|
|
|
|
{
|
|
|
|
|
public partial class Form1 : Form
|
|
|
|
|
{
|
|
|
|
|
private bool EmptyFill = false;
|
|
|
|
|
int count = 1;
|
|
|
|
|
public Form1()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
CreateList();
|
|
|
|
|
}
|
|
|
|
|
private void CreateList()
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < 10; i++)
|
|
|
|
|
{
|
|
|
|
|
SelectionComponent.Items.Add($"Food <20>{i}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ButtonListClear_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
SelectionComponent.Clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ButtonListLoad_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
SelectionComponent.Clear();
|
|
|
|
|
CreateList();
|
|
|
|
|
}
|
|
|
|
|
private void SelectionComponent_ChangeEvent(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
object? selectedItem = SelectionComponent.SelectedElement;
|
|
|
|
|
MessageBox.Show($"Change selected {selectedItem?.ToString()}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void InputComponent_CheckBoxEvent(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
count++;
|
|
|
|
|
if (count % 2 == 0)
|
|
|
|
|
{
|
|
|
|
|
textBoxEvent.Text = "null";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
textBoxEvent.Text = "not null";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private void ButtonGet_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (InputComponent.Value == null)
|
|
|
|
|
{
|
2024-09-14 18:15:23 +04:00
|
|
|
|
MessageBox.Show($"Pressed Checkbox");
|
2024-09-09 22:02:46 +04:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show($"Date: {InputComponent.Value}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show($"Error: {ex.Message}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ButtonSet_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (EmptyFill)
|
|
|
|
|
{
|
|
|
|
|
InputComponent.Value = DateTime.Now;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
InputComponent.Value = null;
|
|
|
|
|
}
|
|
|
|
|
EmptyFill = !EmptyFill;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
readonly List<Delivery> delivers = new()
|
|
|
|
|
{
|
|
|
|
|
new Delivery { Id = 0, Name = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", DeliveryStatus = "<22><><EFBFBD><EFBFBD><EFBFBD>", CountProduct = 5 },
|
|
|
|
|
new Delivery { Id = 1, Name = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", DeliveryStatus = "<22><><EFBFBD><EFBFBD><EFBFBD>", CountProduct = 3 },
|
|
|
|
|
new Delivery { Id = 2, Name = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", DeliveryStatus = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", CountProduct = 7 },
|
|
|
|
|
new Delivery { Id = 3, Name = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", DeliveryStatus = "<22> <20><><EFBFBD><EFBFBD>", CountProduct = 4 },
|
|
|
|
|
new Delivery { Id = 4, Name = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", DeliveryStatus = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", CountProduct = 5 }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
private void CreateTable()
|
|
|
|
|
{
|
|
|
|
|
ListOutputComponent.ConfigColumn(new()
|
|
|
|
|
{
|
|
|
|
|
ColumnsCount = 4,
|
|
|
|
|
ColumnName = new string[] { "Id", "Name", "DeliveryStatus", "CountProduct" },
|
|
|
|
|
Width = new int[] { 10, 150, 250, 200 },
|
|
|
|
|
Visible = new bool[] { false, true, true, true, true },
|
|
|
|
|
PropertiesObject = new string[] { "Id", "Name", "DeliveryStatus", "CountProduct" }
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
foreach (Delivery delivery in delivers)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < 4; i++)
|
|
|
|
|
{
|
|
|
|
|
ListOutputComponent.AddItem(delivery, delivery.Id, i);
|
|
|
|
|
ListOutputComponent.Update();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ButtonShowTable_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
CreateTable();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ButtonClearTable_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
ListOutputComponent.ClearDataGrid();
|
|
|
|
|
}
|
|
|
|
|
private void ButtonGetString_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Delivery? delivery = ListOutputComponent.GetSelectedObjectInRow<Delivery>();
|
|
|
|
|
if (delivery is null) return;
|
|
|
|
|
MessageBox.Show($"{delivery.Id}-{delivery.Name}-{delivery.DeliveryStatus}-{delivery.CountProduct}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|