using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using System.Windows.Forms; namespace TestApp { public partial class FormTest : Form { public FormTest() { InitializeComponent(); } private void buttonInsert_Click(object sender, EventArgs e) { List testStrings = new List() { "str1", "str2", "str3" }; comboBoxControl.addItems(testStrings); } private void buttonClear_Click(object sender, EventArgs e) { comboBoxControl.clear(); } private void buttonGetSelected_Click(object sender, EventArgs e) { MessageBox.Show(comboBoxControl.SelectedValue, "Полученное значение"); } private void buttonSetSelected_Click(object sender, EventArgs e) { comboBoxControl.SelectedValue = "str2"; } private void comboBoxControl_SelectedValueChange(string obj) { MessageBox.Show(obj, "event"); } private void buttonAddTemplate_Click(object sender, EventArgs e) { mailControl.validateEmailRegex = new Regex("^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$"); mailControl.setTooltipText("qwerty@gmail.com"); } private void buttonInsertList_Click(object sender, EventArgs e) { listBoxControl.setParams("{name} works in {department} for {workYears} year(s)", '{', '}'); Worker w1 = new Worker("Vasya", "Management", 5); Worker w2 = new Worker("Vasya Utkin", "Tech department cool stuff", 1); Worker w3 = new Worker("Ivan", "Management", 2); List workers = new List { w1, w2, w3 }; listBoxControl.setItems(workers); } private void buttonGetSelectedList_Click(object sender, EventArgs e) { Worker? worker = listBoxControl.getSelectedItem(); if (worker is not null) MessageBox.Show(worker.ToString() + $"\n{worker.name}, {worker.department}, {worker.workYears}"); } } }