2024-09-23 14:37:08 +04:00
|
|
|
|
using Components.Exceptions;
|
|
|
|
|
|
2024-09-06 12:39:51 +04:00
|
|
|
|
namespace WinFormsApp
|
|
|
|
|
{
|
2024-10-07 00:07:33 +04:00
|
|
|
|
public partial class FormVisual : Form
|
2024-09-06 12:39:51 +04:00
|
|
|
|
{
|
2024-10-07 00:07:33 +04:00
|
|
|
|
public FormVisual()
|
2024-09-06 12:39:51 +04:00
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void buttonFillCheckedList_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
List<string> list = new List<string>();
|
|
|
|
|
list.Add("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
list.Add("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
list.Add("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
list.Add("<22><><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
list.Add("C#");
|
|
|
|
|
userControlCheckedList.SetCheckedListBoxValues(list);
|
|
|
|
|
|
|
|
|
|
userControlCheckedList.CheckedItem = list[3];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void buttonClearList_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
userControlCheckedList.ClearCheckedListBoxValues();
|
|
|
|
|
}
|
2024-09-23 14:37:08 +04:00
|
|
|
|
|
|
|
|
|
private void buttonFillTreeView_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
List<Employee> employees = new List<Employee>();
|
|
|
|
|
employees.Add(new Employee("<22><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD>"));
|
|
|
|
|
employees.Add(new Employee("<22><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
|
|
|
|
employees.Add(new Employee("<22><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
|
|
|
|
employees.Add(new Employee("<22><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD>"));
|
|
|
|
|
|
|
|
|
|
employees.Add(new Employee("<22><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD>"));
|
|
|
|
|
employees.Add(new Employee("<22><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
|
|
|
|
employees.Add(new Employee("<22><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
|
|
|
|
employees.Add(new Employee("<22><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
|
|
|
|
|
|
|
|
|
employees.Add(new Employee("<22><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD>"));
|
|
|
|
|
employees.Add(new Employee("<22><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "PR-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
|
|
|
|
employees.Add(new Employee("<22><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD>"));
|
|
|
|
|
employees.Add(new Employee("<22><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
|
|
|
|
|
2024-09-23 14:43:10 +04:00
|
|
|
|
List<(string PropertyName, bool AlwaysCreateBranch)> hierarchy =
|
|
|
|
|
[
|
|
|
|
|
("Departament", false),
|
|
|
|
|
("Position", false),
|
|
|
|
|
("Surname", false),
|
|
|
|
|
("Name", false),
|
|
|
|
|
];
|
2024-09-23 14:37:08 +04:00
|
|
|
|
|
|
|
|
|
userControlTreeView.SetHierarchy(hierarchy);
|
|
|
|
|
|
|
|
|
|
userControlTreeView.SetTreeObjects(employees);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void buttonClearTreeView_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
userControlTreeView.ClearTreeView();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void buttonShowTreeViewNode_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Employee employee;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
employee = userControlTreeView.GetObjectSelectedNode<Employee>();
|
|
|
|
|
textBoxTreeViewSelectedObject.Text = employee.ToString();
|
|
|
|
|
}
|
|
|
|
|
catch (PropertyNotDeclaratedException ex)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show(ex.Message);
|
|
|
|
|
textBoxTreeViewSelectedObject.Text = string.Empty;
|
|
|
|
|
}
|
|
|
|
|
catch (PropertyNullException ex)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show(ex.Message);
|
|
|
|
|
textBoxTreeViewSelectedObject.Text = string.Empty;
|
|
|
|
|
}
|
|
|
|
|
catch (NotSelectedNodeException ex)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show(ex.Message);
|
|
|
|
|
textBoxTreeViewSelectedObject.Text = string.Empty;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-09-06 12:39:51 +04:00
|
|
|
|
}
|
|
|
|
|
}
|