PIbd-32_Turner_I.A._COP_10/COP/WinForms/Form1.cs

75 lines
2.0 KiB
C#
Raw Normal View History

2023-09-15 22:21:56 +04:00
using System.Security.Cryptography;
using VisualComponentsLib.Object;
2023-09-13 18:53:06 +04:00
namespace WinForms
{
public partial class Form1 : Form
{
2023-09-15 19:31:01 +04:00
List<string> list = new List<string>();
2023-09-15 22:21:56 +04:00
List<Student> students = new List<Student>();
2023-09-13 18:53:06 +04:00
public Form1()
{
2023-09-15 19:31:01 +04:00
list = new List<string>();
list.AddRange(new string[] { "<22><><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" });
2023-09-15 22:21:56 +04:00
Student student1 = new Student("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD>-32", "<22><><EFBFBD><EFBFBD>", 3);
Student student2 = new Student("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD>-11", "<22><><EFBFBD>", 1);
Student student3 = new Student("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-41", "<22><>", 4);
students.Add(student1);
students.Add(student2);
students.Add(student3);
2023-09-13 18:53:06 +04:00
InitializeComponent();
2023-09-15 19:31:01 +04:00
dropDownList.LoadValues(new List<string>() { "<22><><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD>" });
emailTextBox.Pattern = @"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$";
2023-09-15 22:21:56 +04:00
listBoxObj.SetLayoutInfo("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *Name* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *Group* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *Faculty* <20><><EFBFBD><EFBFBD> *Course*", "*", "*");
2023-09-15 19:31:01 +04:00
}
private void buttonAdd_Click(object sender, EventArgs e)
{
dropDownList.LoadValues(list);
}
private void buttonInfo_Click(object sender, EventArgs e)
{
labelInfo.Text = dropDownList.SelectedValue;
}
private void buttonClear_Click(object sender, EventArgs e)
{
dropDownList.Clear();
2023-09-13 18:53:06 +04:00
}
private void buttonSetExample_Click(object sender, EventArgs e)
{
if (textBoxExample.Text == String.Empty)
{
return;
}
emailTextBox.setExample(textBoxExample.Text);
}
private void buttonShow_Click(object sender, EventArgs e)
{
try
{
if (emailTextBox.TextBoxValue != null)
{
labelShow.Text = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
2023-09-15 22:21:56 +04:00
private void buttonAddObjects_Click(object sender, EventArgs e)
{
listBoxObj.AddInListBox<Student>(students);
}
private void buttonShowItem_Click(object sender, EventArgs e)
{
string str = listBoxObj.GetObjectFromStr<Student>().Name + " " + listBoxObj.GetObjectFromStr<Student>().Group + " " + listBoxObj.GetObjectFromStr<Student>().Faculty + " " + listBoxObj.GetObjectFromStr<Student>().Course;
labelShowInput.Text = str;
}
2023-09-13 18:53:06 +04:00
}
}