diff --git a/COP/COP.sln b/COP/COP.sln
index 32e2a2b..8efd9c1 100644
--- a/COP/COP.sln
+++ b/COP/COP.sln
@@ -5,6 +5,8 @@ VisualStudioVersion = 17.3.32825.248
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "COP", "COP.csproj", "{B22B20DB-B359-48B7-88CF-35A6EC770FD1}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestComponents", "..\TestComponents\TestComponents.csproj", "{C0F09A72-65A3-49DD-8208-291778E03E81}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -15,6 +17,10 @@ Global
{B22B20DB-B359-48B7-88CF-35A6EC770FD1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B22B20DB-B359-48B7-88CF-35A6EC770FD1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B22B20DB-B359-48B7-88CF-35A6EC770FD1}.Release|Any CPU.Build.0 = Release|Any CPU
+ {C0F09A72-65A3-49DD-8208-291778E03E81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {C0F09A72-65A3-49DD-8208-291778E03E81}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {C0F09A72-65A3-49DD-8208-291778E03E81}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {C0F09A72-65A3-49DD-8208-291778E03E81}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/COP/UserCheckedListBox.Designer.cs b/COP/UserCheckedListBox.Designer.cs
new file mode 100644
index 0000000..e49e94c
--- /dev/null
+++ b/COP/UserCheckedListBox.Designer.cs
@@ -0,0 +1,58 @@
+namespace COP
+{
+ partial class UserCheckedListBox
+ {
+ ///
+ /// Обязательная переменная конструктора.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Освободить все используемые ресурсы.
+ ///
+ /// истинно, если управляемый ресурс должен быть удален; иначе ложно.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Код, автоматически созданный конструктором компонентов
+
+ ///
+ /// Требуемый метод для поддержки конструктора — не изменяйте
+ /// содержимое этого метода с помощью редактора кода.
+ ///
+ private void InitializeComponent()
+ {
+ this.checkedListBox = new System.Windows.Forms.CheckedListBox();
+ this.SuspendLayout();
+ //
+ // checkedListBox
+ //
+ this.checkedListBox.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.checkedListBox.FormattingEnabled = true;
+ this.checkedListBox.Location = new System.Drawing.Point(0, 0);
+ this.checkedListBox.Name = "checkedListBox";
+ this.checkedListBox.Size = new System.Drawing.Size(150, 150);
+ this.checkedListBox.TabIndex = 0;
+ this.checkedListBox.SelectedIndexChanged += new System.EventHandler(this.CheckedListBox_SelectedIndexChanged);
+ //
+ // UserCheckedListBox
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.checkedListBox);
+ this.Name = "UserCheckedListBox";
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private CheckedListBox checkedListBox;
+ }
+}
diff --git a/COP/UserCheckedListBox.cs b/COP/UserCheckedListBox.cs
new file mode 100644
index 0000000..cf46134
--- /dev/null
+++ b/COP/UserCheckedListBox.cs
@@ -0,0 +1,68 @@
+namespace COP
+{
+ public partial class UserCheckedListBox : UserControl
+ {
+ private event EventHandler? _selectedValueChanged;
+
+ public UserCheckedListBox()
+ {
+ InitializeComponent();
+ }
+
+ public void FillList(List items)
+ {
+ if (items.Count == 0 || items is null)
+ {
+ return;
+ }
+ checkedListBox.Items.Clear();
+ checkedListBox.Items.AddRange(items.ToArray());
+ }
+
+ public void ClearList()
+ {
+ checkedListBox.Items.Clear();
+ }
+
+ public string SelectedValue
+ {
+ get
+ {
+ string checkedItems = "";
+ for (int i = 0; i < checkedListBox.Items.Count; i++)
+ {
+ if (checkedListBox.GetItemChecked(i))
+ {
+ checkedItems += checkedListBox.Items[i].ToString() + " ";
+ }
+ }
+ if (checkedListBox.CheckedItems != null)
+ return checkedItems;
+ else
+ return "";
+ }
+ set
+ {
+ for (int i = 0; i < checkedListBox.Items.Count; i++)
+ {
+ if (checkedListBox.Items[i].ToString() == value)
+ {
+ checkedListBox.SetItemChecked(i, true);
+ break;
+ }
+ }
+ }
+ }
+
+ public event EventHandler SelectedValueChanged
+ {
+ add { _selectedValueChanged += value; }
+ remove { _selectedValueChanged += value; }
+ }
+
+ private void CheckedListBox_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ _selectedValueChanged?.Invoke(this, e);
+ }
+ }
+}
diff --git a/COP/UserDateTimePicker.Designer.cs b/COP/UserDateTimePicker.Designer.cs
new file mode 100644
index 0000000..8424a98
--- /dev/null
+++ b/COP/UserDateTimePicker.Designer.cs
@@ -0,0 +1,61 @@
+namespace COP
+{
+ partial class UserDateTimePicker
+ {
+ ///
+ /// Обязательная переменная конструктора.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Освободить все используемые ресурсы.
+ ///
+ /// истинно, если управляемый ресурс должен быть удален; иначе ложно.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Код, автоматически созданный конструктором компонентов
+
+ ///
+ /// Требуемый метод для поддержки конструктора — не изменяйте
+ /// содержимое этого метода с помощью редактора кода.
+ ///
+ private void InitializeComponent()
+ {
+ this.dateTimePicker = new System.Windows.Forms.DateTimePicker();
+ this.SuspendLayout();
+ //
+ // dateTimePicker
+ //
+ this.dateTimePicker.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.dateTimePicker.Location = new System.Drawing.Point(0, 3);
+ this.dateTimePicker.Name = "dateTimePicker";
+ this.dateTimePicker.Size = new System.Drawing.Size(200, 23);
+ this.dateTimePicker.TabIndex = 0;
+ this.dateTimePicker.ValueChanged += new System.EventHandler(this.DateTimePicker_ValueChanged);
+ //
+ // UserDateTimePicker
+ //
+ this.AccessibleDescription = "";
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.dateTimePicker);
+ this.Name = "UserDateTimePicker";
+ this.Size = new System.Drawing.Size(200, 29);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private DateTimePicker dateTimePicker;
+ }
+}
diff --git a/COP/UserDateTimePicker.cs b/COP/UserDateTimePicker.cs
new file mode 100644
index 0000000..7adc58a
--- /dev/null
+++ b/COP/UserDateTimePicker.cs
@@ -0,0 +1,100 @@
+namespace COP
+{
+ public partial class UserDateTimePicker : UserControl
+ {
+ private DateTime? minValue;
+ private DateTime? maxValue;
+
+ public event EventHandler? _valueChanged;
+ private event Action? _errorOccured;
+ public string Error { get; private set; }
+
+ public UserDateTimePicker()
+ {
+ InitializeComponent();
+ Error = string.Empty;
+ }
+
+ public DateTime? MinValue
+ {
+ get { return minValue; }
+ set { minValue = value; }
+ }
+
+ public DateTime? MaxValue
+ {
+ get { return maxValue; }
+ set { maxValue = value; }
+ }
+
+ public DateTime? SelectedValue
+ {
+ get
+ {
+ if (!minValue.HasValue || !maxValue.HasValue)
+ {
+ Error = "Range is not set.";
+ _errorOccured?.Invoke();
+ return null;
+ }
+ else if (dateTimePicker.Value < minValue ||
+ dateTimePicker.Value > maxValue)
+ {
+ Error = "Selected value is out of range.";
+ _errorOccured?.Invoke();
+ return null;
+ }
+
+ return dateTimePicker.Value;
+ }
+ set
+ {
+ if (!value.HasValue)
+ {
+ Error = "Value is null.";
+ _errorOccured?.Invoke();
+ return;
+ }
+ if (!minValue.HasValue || !maxValue.HasValue)
+ {
+ Error = "Range is not set.";
+ _errorOccured?.Invoke();
+ return;
+ }
+ if (value < minValue || value > maxValue)
+ {
+ Error = "Selected value is out of range.";
+ _errorOccured?.Invoke();
+ return;
+ }
+
+ dateTimePicker.Value = value.Value;
+
+ }
+ }
+
+ public event EventHandler ValueChanged
+ {
+ add { _valueChanged += value; }
+ remove { _valueChanged -= value; }
+ }
+ public event Action AnErrorOccurred
+ {
+ add { _errorOccured += value; }
+ remove { _errorOccured -= value; }
+ }
+
+ private void DateTimePicker_ValueChanged(object sender, EventArgs e)
+ {
+ try
+ {
+ _valueChanged?.Invoke(this, e);
+ }
+ catch (Exception ex)
+ {
+ Error = ex.Message;
+ _errorOccured?.Invoke();
+ }
+ }
+ }
+}
diff --git a/COP/UserDateTimePicker.resx b/COP/UserDateTimePicker.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/COP/UserDateTimePicker.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/COP/UserTreeView.Designer.cs b/COP/UserTreeView.Designer.cs
new file mode 100644
index 0000000..9436dab
--- /dev/null
+++ b/COP/UserTreeView.Designer.cs
@@ -0,0 +1,56 @@
+namespace COP
+{
+ partial class UserTreeView
+ {
+ ///
+ /// Обязательная переменная конструктора.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Освободить все используемые ресурсы.
+ ///
+ /// истинно, если управляемый ресурс должен быть удален; иначе ложно.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Код, автоматически созданный конструктором компонентов
+
+ ///
+ /// Требуемый метод для поддержки конструктора — не изменяйте
+ /// содержимое этого метода с помощью редактора кода.
+ ///
+ private void InitializeComponent()
+ {
+ this.treeView = new System.Windows.Forms.TreeView();
+ this.SuspendLayout();
+ //
+ // treeView
+ //
+ this.treeView.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.treeView.Location = new System.Drawing.Point(0, 0);
+ this.treeView.Name = "treeView";
+ this.treeView.Size = new System.Drawing.Size(150, 150);
+ this.treeView.TabIndex = 0;
+ //
+ // UserTreeView
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.treeView);
+ this.Name = "UserTreeView";
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private TreeView treeView;
+ }
+}
diff --git a/COP/UserTreeView.cs b/COP/UserTreeView.cs
new file mode 100644
index 0000000..fa93409
--- /dev/null
+++ b/COP/UserTreeView.cs
@@ -0,0 +1,103 @@
+using System.Xml;
+
+namespace COP
+{
+ public partial class UserTreeView : UserControl
+ {
+ private event Action? _errorOccured;
+ public List Hierarchy;
+ public string Error { get; private set; }
+ public UserTreeView()
+ {
+ InitializeComponent();
+ Error = string.Empty;
+ Hierarchy = new();
+ }
+ // иерархия
+ // метод заполнения иерархии
+
+
+ public event Action AnErrorOccurred
+ {
+ add { _errorOccured += value; }
+ remove { _errorOccured -= value; }
+ }
+
+ public int SelectedItemIndex
+ {
+ get
+ {
+ if (treeView.SelectedNode == null)
+ {
+ return -1;
+ }
+ return treeView.SelectedNode.Index;
+ }
+ }
+
+ public T? GetSelectedObject() where T : class, new()
+ {
+ // параметризованный
+ //проверка есть или нет иерархии
+ TreeNode selectedNode = treeView.SelectedNode;
+ if (Hierarchy == null)
+ {
+ throw new Exception("Hierarchy is not set.");
+ }
+ if (selectedNode?.FirstNode != null)
+ {
+ throw new Exception("Not a last level node.");
+ }
+ T currentBranch = new T();
+ Hierarchy.Reverse();
+ foreach (var property in Hierarchy)
+ {
+ typeof(T).GetProperty(property).SetValue(currentBranch, Convert.ChangeType(selectedNode.Text, typeof(T).GetProperty(property).PropertyType));
+
+ selectedNode = selectedNode.Parent;
+ }
+ Hierarchy.Reverse();
+ return currentBranch;
+
+ }
+ //проверка что выбранный элем последний в ветке
+
+ public void PopulateTree(List items)
+ {
+ treeView.BeginUpdate();
+ treeView.Nodes.Clear();
+ if (items == null)
+ {
+ throw new ArgumentNullException(nameof(items));
+ }
+ if (Hierarchy == null)
+ {
+ throw new Exception("Hierarchy is not set.");
+ }
+
+ foreach (var item in items)
+ {
+ TreeNodeCollection treeViewNodes = treeView.Nodes;
+ foreach (var elem in Hierarchy)
+ {
+ bool flag = false;
+ for (int i = 0; i < treeViewNodes.Count; i++)
+ {
+ if (item.GetType().GetProperty(elem).GetValue(item).ToString() == treeViewNodes[i].Text)
+ {
+ treeViewNodes = treeViewNodes[i].Nodes;
+ flag = true;
+ break;
+ }
+ }
+ if (!flag)
+ {
+ var newNode = treeViewNodes.Add(item.GetType().GetProperty(elem).GetValue(item).ToString());
+ treeViewNodes = newNode.Nodes;
+ }
+ }
+ }
+ treeView.EndUpdate();
+ }
+ }
+}
diff --git a/COP/UserTreeView.resx b/COP/UserTreeView.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/COP/UserTreeView.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/TestComponents/FormTestComponents.Designer.cs b/TestComponents/FormTestComponents.Designer.cs
new file mode 100644
index 0000000..54864d1
--- /dev/null
+++ b/TestComponents/FormTestComponents.Designer.cs
@@ -0,0 +1,145 @@
+namespace TestComponents
+{
+ partial class FormTestComponents
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.userCheckedListBox = new COP.UserCheckedListBox();
+ this.userDateTimePicker = new COP.UserDateTimePicker();
+ this.userTreeView = new COP.UserTreeView();
+ this.buttonClear = new System.Windows.Forms.Button();
+ this.textBoxItems = new System.Windows.Forms.TextBox();
+ this.buttonShowItems = new System.Windows.Forms.Button();
+ this.textBoxShowDate = new System.Windows.Forms.TextBox();
+ this.buttonShowDate = new System.Windows.Forms.Button();
+ this.SuspendLayout();
+ //
+ // userCheckedListBox
+ //
+ this.userCheckedListBox.Location = new System.Drawing.Point(0, -1);
+ this.userCheckedListBox.Name = "userCheckedListBox";
+ this.userCheckedListBox.SelectedValue = "";
+ this.userCheckedListBox.Size = new System.Drawing.Size(150, 150);
+ this.userCheckedListBox.TabIndex = 0;
+ this.userCheckedListBox.SelectedValueChanged += new System.EventHandler(this.UserCheckedListBox_SelectedValueChanged);
+ //
+ // userDateTimePicker
+ //
+ this.userDateTimePicker.AccessibleDescription = "";
+ this.userDateTimePicker.Location = new System.Drawing.Point(254, 26);
+ this.userDateTimePicker.MaxValue = null;
+ this.userDateTimePicker.MinValue = null;
+ this.userDateTimePicker.Name = "userDateTimePicker";
+ this.userDateTimePicker.SelectedValue = null;
+ this.userDateTimePicker.Size = new System.Drawing.Size(200, 29);
+ this.userDateTimePicker.TabIndex = 1;
+ this.userDateTimePicker.ValueChanged += new System.EventHandler(this.UserDateTimePicker_ValueChanged);
+ //
+ // userTreeView
+ //
+ this.userTreeView.Location = new System.Drawing.Point(484, 26);
+ this.userTreeView.Name = "userTreeView";
+ this.userTreeView.Size = new System.Drawing.Size(150, 150);
+ this.userTreeView.TabIndex = 2;
+ this.userTreeView.Load += new System.EventHandler(this.UserTreeView_Load);
+ //
+ // buttonClear
+ //
+ this.buttonClear.Location = new System.Drawing.Point(0, 164);
+ this.buttonClear.Name = "buttonClear";
+ this.buttonClear.Size = new System.Drawing.Size(75, 23);
+ this.buttonClear.TabIndex = 3;
+ this.buttonClear.Text = "Очистить";
+ this.buttonClear.UseVisualStyleBackColor = true;
+ this.buttonClear.Click += new System.EventHandler(this.ButtonClear_Click);
+ //
+ // textBoxItems
+ //
+ this.textBoxItems.Location = new System.Drawing.Point(0, 205);
+ this.textBoxItems.Name = "textBoxItems";
+ this.textBoxItems.Size = new System.Drawing.Size(150, 23);
+ this.textBoxItems.TabIndex = 4;
+ //
+ // buttonShowItems
+ //
+ this.buttonShowItems.Location = new System.Drawing.Point(0, 250);
+ this.buttonShowItems.Name = "buttonShowItems";
+ this.buttonShowItems.Size = new System.Drawing.Size(125, 23);
+ this.buttonShowItems.TabIndex = 5;
+ this.buttonShowItems.Text = "Вывести значения";
+ this.buttonShowItems.UseVisualStyleBackColor = true;
+ this.buttonShowItems.Click += new System.EventHandler(this.ButtonShowItems_Click);
+ //
+ // textBoxShowDate
+ //
+ this.textBoxShowDate.Location = new System.Drawing.Point(269, 79);
+ this.textBoxShowDate.Name = "textBoxShowDate";
+ this.textBoxShowDate.Size = new System.Drawing.Size(150, 23);
+ this.textBoxShowDate.TabIndex = 6;
+ //
+ // buttonShowDate
+ //
+ this.buttonShowDate.Location = new System.Drawing.Point(269, 139);
+ this.buttonShowDate.Name = "buttonShowDate";
+ this.buttonShowDate.Size = new System.Drawing.Size(125, 23);
+ this.buttonShowDate.TabIndex = 7;
+ this.buttonShowDate.Text = "Вывести значения";
+ this.buttonShowDate.UseVisualStyleBackColor = true;
+ this.buttonShowDate.Click += new System.EventHandler(this.ButtonShowDate_Click);
+ //
+ // FormTestComponents
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(657, 321);
+ this.Controls.Add(this.buttonShowDate);
+ this.Controls.Add(this.textBoxShowDate);
+ this.Controls.Add(this.buttonShowItems);
+ this.Controls.Add(this.textBoxItems);
+ this.Controls.Add(this.buttonClear);
+ this.Controls.Add(this.userTreeView);
+ this.Controls.Add(this.userDateTimePicker);
+ this.Controls.Add(this.userCheckedListBox);
+ this.Name = "FormTestComponents";
+ this.Text = "Тестовая форма";
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private COP.UserCheckedListBox userCheckedListBox;
+ private COP.UserDateTimePicker userDateTimePicker;
+ private COP.UserTreeView userTreeView;
+ private Button buttonClear;
+ private TextBox textBoxItems;
+ private Button buttonShowItems;
+ private TextBox textBoxShowDate;
+ private Button buttonShowDate;
+ }
+}
\ No newline at end of file
diff --git a/TestComponents/FormTestComponents.cs b/TestComponents/FormTestComponents.cs
new file mode 100644
index 0000000..665ada3
--- /dev/null
+++ b/TestComponents/FormTestComponents.cs
@@ -0,0 +1,84 @@
+namespace TestComponents
+{
+ public partial class FormTestComponents : Form
+ {
+ public FormTestComponents()
+ {
+ InitializeComponent();
+ Fill();
+ }
+
+ private void Fill()
+ {
+ List items = new() { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
+ userCheckedListBox.FillList(items);
+ }
+
+ private void UserCheckedListBox_SelectedValueChanged(object sender, EventArgs e)
+ {
+ MessageBox.Show("Selected value changed");
+ }
+
+ private void ButtonClear_Click(object sender, EventArgs e)
+ {
+ userCheckedListBox.ClearList();
+ }
+
+ private void ButtonShowItems_Click(object sender, EventArgs e)
+ {
+ textBoxItems.Clear();
+ textBoxItems.Text = userCheckedListBox.SelectedValue;
+ }
+
+ private void ButtonShowDate_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ textBoxShowDate.Clear();
+ textBoxShowDate.Text = userDateTimePicker.SelectedValue.ToString();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
+ }
+
+ private void UserDateTimePicker_ValueChanged(object sender, EventArgs e)
+ {
+ MessageBox.Show("Value changed");
+ DateTime? selectedDate = userDateTimePicker.SelectedValue;
+ }
+
+ private void UserTreeView_Load(object sender, EventArgs e)
+ {
+ List employees = new List
+ {
+ new Employee { Department = "Отдел1", Position = "Должность1", Name = "Сотрудник1" },
+ new Employee { Department = "Отдел2", Position = "Должность2", Name = "Сотрудник2" },
+ new Employee { Department = "Отдел1", Position = "Должность1", Name = "Сотрудник3" },
+ new Employee { Department = "Отдел2", Position = "Должность3", Name = "Сотрудник4" },
+ };
+ var Hierarchy = new List { "Department", "Position", "Name" };
+ foreach (var prop in employees[0].GetType().GetProperties())
+ {
+ userTreeView.Hierarchy.Add(prop.Name);
+ }
+
+ try
+ {
+ userTreeView.PopulateTree(employees);
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
+ }
+
+ public class Employee
+ {
+ public string? Department { get; set; }
+ public string? Position { get; set; }
+ public string? Name { get; set; }
+ }
+ }
+}
\ No newline at end of file
diff --git a/TestComponents/FormTestComponents.resx b/TestComponents/FormTestComponents.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/TestComponents/FormTestComponents.resx
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/TestComponents/Program.cs b/TestComponents/Program.cs
new file mode 100644
index 0000000..97d1985
--- /dev/null
+++ b/TestComponents/Program.cs
@@ -0,0 +1,17 @@
+namespace TestComponents
+{
+ internal static class Program
+ {
+ ///
+ /// The main entry point for the application.
+ ///
+ [STAThread]
+ static void Main()
+ {
+ // To customize application configuration such as set high DPI settings or default font,
+ // see https://aka.ms/applicationconfiguration.
+ ApplicationConfiguration.Initialize();
+ Application.Run(new FormTestComponents());
+ }
+ }
+}
\ No newline at end of file
diff --git a/TestComponents/TestComponents.csproj b/TestComponents/TestComponents.csproj
new file mode 100644
index 0000000..a119c12
--- /dev/null
+++ b/TestComponents/TestComponents.csproj
@@ -0,0 +1,15 @@
+
+
+
+ WinExe
+ net6.0-windows
+ enable
+ true
+ enable
+
+
+
+
+
+
+
\ No newline at end of file