using CustomComponents.Objects; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace TestForms { public partial class TestForm : Form { public TestForm() { InitializeComponent(); dropDownList.AddToList("фыв"); dateTextBox.Pattern = "^\\s*(3[01]|[12][0-9]|0?[1-9])\\.(1[012]|0?[1-9])\\.((?:0|1|2)\\d{3})\\s*$"; listBoxObjects.SetLayout("Число: {Date}, День {Day}, Температура {Temperature}", "{", "}"); listBoxObjects.AddItemInList(new DaysOfWeek(DateTime.Today.AddDays(-3), "Среда", 15)); } private void ButtonAdd_Click(object sender, EventArgs e) { if (!String.IsNullOrEmpty(TextBoxList.Text)) { dropDownList.AddToList(TextBoxList.Text); } else { ToolTip tt = new ToolTip(); tt.Show("Заполните поле", TextBoxList, 3000); } } private void ButtonClear_Click(object sender, EventArgs e) { dropDownList.ClearList(); } private void buttonInList_Click(object sender, EventArgs e) { if (dateTimePicker.Text == null) { return; } listBoxObjects.AddItemInList(new(dateTimePicker.Value, dateTimePicker.Value.ToString("dddd"), Convert.ToInt32(numericUpDown.Value))); } private void buttonGet_Click(object sender, EventArgs e) { DaysOfWeek dow = listBoxObjects.GetItemFromList(); if (dow == null || dow.Date == default(DateTime)) { return; } dateTimePicker.Value = dow.Date; numericUpDown.Value = dow.Temperature; } private void ButtonCheckDrop_Click(object sender, EventArgs e) { labelShowDrop.Text = dropDownList.Selected; } private void ButtonCheckText_Click(object sender, EventArgs e) { labelShowText.Text = dateTextBox.TextBoxValue; } private void ButtonExample_Click(object sender, EventArgs e) { if(textBoxExample.Text == String.Empty) { return; } dateTextBox.SetExample(textBoxExample.Text); } } }