using NevaevaLibrary.LogicalComponents; 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}"); } private void buttonWordText_Click(object sender, EventArgs e) { string[] paragraphs = { "test1", "Составлен в соответствии с учебным планом направления 09.03.04. Цель данного практикума – ориентировать студентов на содержание и порядок выполнения лабораторных задач во время прохождения ими курсов «Методы искусственного интеллекта» и «Машинное обучение». Даются задания на лабораторные работы. ", "Работа подготовлена на кафедре «Информационные системы»." }; openFileDialog.Dispose(); string path = AppDomain.CurrentDomain.BaseDirectory + "test.docx"; wordLongTextComponent.createWithLongText(new WordLongTextInfo(path, "Header", paragraphs)); MessageBox.Show("Готово!"); } private void buttonTable_Click(object sender, EventArgs e) { List workers = new List(); workers.Add(new OfficeWorker(1, "Иванов", "Иван", 20, "Отдел продаж", "Бухгалтер", 25, "+7(834)234-03-49")); workers.Add(new OfficeWorker(2, "Петров", "Петр", 25, "Отдел продаж", "Менеджер", 20, "+7(834)123-03-49")); workers.Add(new OfficeWorker(3, "Сидоров", "Сергей", 27, "Отдел кадров", "HR", 2, "+7(834)593-03-49", true)); string path = AppDomain.CurrentDomain.BaseDirectory + "test2.docx"; List<(int, int)> merges = new List<(int, int)>(); merges.Add((1, 3)); merges.Add((4, 6)); List widths = Enumerable.Repeat(70, 8).ToList(); List<(string, string)> headers = new List<(string, string)> { ("id", "id"), ("", "Личные данные"), ("lastName", "Фамилия"), ("firstName", "Имя"), ("age", "Возраст"), ("", "Работа"), ("department", "Отдел"), ("position", "Должность"), ("boxNumber", "Номер бокса"), ("phoneNumber", "Телефон")}; wordTableComponent.createWithTable(path, "header", merges, widths, headers, workers); MessageBox.Show("Готово!"); } private void buttonDiagram_Click(object sender, EventArgs e) { List departments = new List(); departments.Add(new Department("Dep 1", new List { 330, 220, 400, 500 })); departments.Add(new Department("Dep 2", new List { 400, 300, 302 })); departments.Add(new Department("Dep 3", new List { 200, 220, 270 })); string path = AppDomain.CurrentDomain.BaseDirectory + "test3.docx"; wordDiagramComponent.createWithDiagram(path, "test3", "Продажи", DiagramLegendEnum.TopRight, departments, "name", "sells"); MessageBox.Show("Готово!"); } } }