KOP_Library_v5/TestView/Form1.cs

106 lines
2.5 KiB
C#
Raw Normal View History

2023-10-06 02:36:27 +04:00
using ViewComponents.Exeption;
namespace TestView
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void buttonAdd_Click(object sender, EventArgs e)
{
string str = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
list_with_choice.Fill_List(str);
list_with_choice.Element = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
}
private void buttonClear_Click(object sender, EventArgs e)
{
list_with_choice.Clean_List();
}
private void buttonSelect_Click(object sender, EventArgs e)
{
MessageBox.Show(list_with_choice.Element ?? "null", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
}
private void list_with_choice_SelectedItemChange(string obj)
{
MessageBox.Show(obj, "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
}
private void buttonDip_Click(object sender, EventArgs e)
{
input_text.MinLen = 5;
input_text.MaxLen = 25;
MessageBox.Show($"Min: {input_text.minlen}; Max: {input_text.maxlen}");
}
private void buttonVal_Click(object sender, EventArgs e)
{
input_text.Element = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
}
private void input_text_ItemChange(string obj)
{
MessageBox.Show(obj, "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
}
private void buttonCheck_Click(object sender, EventArgs e)
{
try
{
string val = input_text.Element;
MessageBox.Show(val, "<22><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
}
catch (TextBoundsNotSetExeption ex)
{
MessageBox.Show(ex.Message);
}
catch (TextOutOfBoundsExeption ex)
{
MessageBox.Show(ex.Message);
}
}
private void buttonIerarhy_Click(object sender, EventArgs e)
{
myTreeView.setHierarchy(new List<(string, bool)> { ("Genre", false), ("Author", false), ("Title", true) });
MessageBox.Show("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
}
private void buttonAddBook_Click(object sender, EventArgs e)
{
myTreeView.addItem(new Book("<22><><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>.<2E>.", <><CCB8><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>"));
myTreeView.addItem(new Book("<22><><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>.<2E>.", "<22><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD>"));
myTreeView.addItem(new Book("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "1984"));
}
private void buttonGetValue_Click(object sender, EventArgs e)
{
Book? book = myTreeView.getSelecetedNodeValue<Book>();
if (book == null) return;
MessageBox.Show("<22><><EFBFBD><EFBFBD>: " + book.Genre + ", <20><><EFBFBD><EFBFBD><EFBFBD>: " + book.Author + ", <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: " + book.Title);
}
private void buttonGetIndex_Click(object sender, EventArgs e)
{
MessageBox.Show(myTreeView.SelectedNodeIndex.ToString());
}
private void buttonSetIndex_Click(object sender, EventArgs e)
{
myTreeView.SelectedNodeIndex = 0;
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}