diff --git a/COP_1/Album.cs b/COP_1/Album.cs
new file mode 100644
index 0000000..69af72a
--- /dev/null
+++ b/COP_1/Album.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace COP_1
+{
+ public class Album
+ {
+ public string Title { get; set; }
+ public string Performer { get; set; }
+ public string Genre { get; set; }
+ public string Year { get; set; }
+
+ public Album(string title, string performer, string genre, string year)
+ {
+ Title = title;
+ Performer = performer;
+ Genre = genre;
+ Year = year;
+ }
+
+ public Album() { }
+
+ public override string ToString()
+ {
+ string temp = Title + ", " + Performer + ", " + Genre + ", " + Year;
+ return temp;
+ //return (Title+", "+Performer+", "+Genre+", "+Year);
+ }
+ }
+}
diff --git a/COP_1/COP_1.csproj b/COP_1/COP_1.csproj
new file mode 100644
index 0000000..75cc2b7
--- /dev/null
+++ b/COP_1/COP_1.csproj
@@ -0,0 +1,16 @@
+
+
+
+ net6.0-windows
+ enable
+ true
+ enable
+
+
+
+
+
+
+
+
+
diff --git a/COP_1/COP_1.sln b/COP_1/COP_1.sln
new file mode 100644
index 0000000..80ed057
--- /dev/null
+++ b/COP_1/COP_1.sln
@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.8.34525.116
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "COP_1", "COP_1.csproj", "{41597675-2261-45D0-B8A3-F6C00D687FDC}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "COP_1Test", "..\COP_1Test\COP_1Test.csproj", "{3926A945-603A-4E7F-B674-2240C8B5B794}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {41597675-2261-45D0-B8A3-F6C00D687FDC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {41597675-2261-45D0-B8A3-F6C00D687FDC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {41597675-2261-45D0-B8A3-F6C00D687FDC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {41597675-2261-45D0-B8A3-F6C00D687FDC}.Release|Any CPU.Build.0 = Release|Any CPU
+ {3926A945-603A-4E7F-B674-2240C8B5B794}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {3926A945-603A-4E7F-B674-2240C8B5B794}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3926A945-603A-4E7F-B674-2240C8B5B794}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {3926A945-603A-4E7F-B674-2240C8B5B794}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {44FCB702-AF4F-4B33-B037-E657C1CC86F4}
+ EndGlobalSection
+EndGlobal
diff --git a/COP_1/cop_1/DropDownList.Designer.cs b/COP_1/cop_1/DropDownList.Designer.cs
new file mode 100644
index 0000000..91ee4c3
--- /dev/null
+++ b/COP_1/cop_1/DropDownList.Designer.cs
@@ -0,0 +1,72 @@
+namespace COP_1
+{
+ partial class DropDownList
+ {
+ ///
+ /// Обязательная переменная конструктора.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Освободить все используемые ресурсы.
+ ///
+ /// истинно, если управляемый ресурс должен быть удален; иначе ложно.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Код, автоматически созданный конструктором компонентов
+
+ ///
+ /// Требуемый метод для поддержки конструктора — не изменяйте
+ /// содержимое этого метода с помощью редактора кода.
+ ///
+ private void InitializeComponent()
+ {
+ comboBox = new ComboBox();
+ label1 = new Label();
+ SuspendLayout();
+ //
+ // comboBox
+ //
+ comboBox.Dock = DockStyle.Bottom;
+ comboBox.FormattingEnabled = true;
+ comboBox.Location = new Point(0, 22);
+ comboBox.Name = "comboBox";
+ comboBox.Size = new Size(225, 28);
+ comboBox.TabIndex = 1;
+ comboBox.SelectedValueChanged += comboBox_SelectedValueChanged;
+ //
+ // label1
+ //
+ label1.AutoSize = true;
+ label1.Dock = DockStyle.Bottom;
+ label1.Location = new Point(0, 2);
+ label1.Name = "label1";
+ label1.Size = new Size(156, 20);
+ label1.TabIndex = 2;
+ label1.Text = "Выпадающий список";
+ //
+ // DropDownList
+ //
+ AutoScaleDimensions = new SizeF(8F, 20F);
+ AutoScaleMode = AutoScaleMode.Font;
+ Controls.Add(label1);
+ Controls.Add(comboBox);
+ Name = "DropDownList";
+ Size = new Size(225, 50);
+ ResumeLayout(false);
+ PerformLayout();
+ }
+
+ #endregion
+
+ private ComboBox comboBox;
+ private Label label1;
+ }
+}
diff --git a/COP_1/cop_1/DropDownList.cs b/COP_1/cop_1/DropDownList.cs
new file mode 100644
index 0000000..83eceff
--- /dev/null
+++ b/COP_1/cop_1/DropDownList.cs
@@ -0,0 +1,68 @@
+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;
+using static System.Windows.Forms.VisualStyles.VisualStyleElement;
+
+namespace COP_1
+{
+ public partial class DropDownList : UserControl
+ {
+ public DropDownList()
+ {
+ InitializeComponent();
+ }
+
+ //метод, у которого в передаваемых параметрах идет список строк и через этот список идет заполнение ComboBox;
+ public void AddingToList(List Values)
+ {
+ if (Values.Count == 0)
+ {
+ return;
+ }
+ comboBox.Items.AddRange(Values.ToArray());
+ }
+
+ //Отдельный публичный метод отчистки списка.
+ public void Clear()
+ {
+ comboBox.Items.Clear();
+ }
+
+ //публичное свойство(set, get) для установки и получения выбранного значения (возвращает пустую строку, если нет выбранного значения)
+ public string Selected
+ {
+ get
+ {
+ return comboBox.SelectedItem?.ToString() ?? string.Empty;
+ }
+ set
+ {
+ comboBox.SelectedItem = value;
+ }
+ }
+ //подписка(отписка) на изменения в ComboBox, и при изменении автоматически вызываются все обработчики, подписанные на описание события ExplicitEvent.
+ private EventHandler _explicitEvent;
+ public event EventHandler ExplicitEvent
+ {
+ add
+ {
+ _explicitEvent += value;
+ }
+ remove
+ {
+ _explicitEvent -= value;
+ }
+ }
+ //событие, вызываемое при смене значения в ComboBox.
+ private void comboBox_SelectedValueChanged(object sender, EventArgs e)
+ {
+ _explicitEvent?.Invoke(sender, e);
+ }
+ }
+}
diff --git a/COP_1/cop_1/DropDownList.resx b/COP_1/cop_1/DropDownList.resx
new file mode 100644
index 0000000..af32865
--- /dev/null
+++ b/COP_1/cop_1/DropDownList.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/COP_1/cop_1/EmailBox.cs b/COP_1/cop_1/EmailBox.cs
new file mode 100644
index 0000000..c82972f
--- /dev/null
+++ b/COP_1/cop_1/EmailBox.cs
@@ -0,0 +1,120 @@
+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 COP_1
+{
+ public partial class emailBox : UserControl
+ {
+ private string _pattern;
+ private string example = "example@gmail.com";
+ // Событие для обработки ошибок
+ private event Action? _errorOccurred;
+ // Свойство для хранения сообщения об ошибке
+ public string Error { get; private set; }
+
+ public string Pattern
+ {
+ get => _pattern;
+ set => _pattern = value;
+ }
+
+ // Публичное свойство для получения и установки значения текстового поля
+ public string? TextBoxValue
+ {
+ get
+ {
+ if (string.IsNullOrEmpty(Pattern))
+ {
+ throw new ArgumentException("Invalid pattern format.", nameof(Pattern));
+ }
+
+ if (!IsValidEmail(textBox.Text))
+ {
+ throw new FormatException("Invalid email format.");
+ }
+
+ return textBox.Text == string.Empty ? null : textBox.Text;
+ }
+ set
+ {
+ if (IsValidEmail(value))
+ {
+ textBox.Text = value;
+ Error = string.Empty;
+ }
+ else
+ {
+ TriggerError("Invalid email format.");
+ }
+ }
+ }
+
+ // Tooltip для вывода примера
+ private void textBox_Enter(object sender, EventArgs e)
+ {
+ int visibleTime = 3000; // Время отображения в миллисекундах
+ ToolTip tt = new ToolTip();
+ tt.Show(example, textBox, 0, 20, visibleTime);
+ }
+
+ private EventHandler _explicitEvent;
+ public event EventHandler ExplicitEvent
+ {
+ add => _explicitEvent += value;
+ remove => _explicitEvent -= value;
+ }
+
+ public event Action AnErrorOccurred
+ {
+ add => _errorOccurred += value;
+ remove => _errorOccurred -= value;
+ }
+ public emailBox()
+ {
+ InitializeComponent();
+ Error = string.Empty;
+ }
+ // Событие при изменении текста
+ private void textBox_TextChanged(object sender, EventArgs e)
+ {
+ try
+ {
+ _explicitEvent?.Invoke(sender, e);
+ }
+ catch (Exception ex)
+ {
+ TriggerError(ex.Message);
+ }
+ }
+ private bool IsValidEmail(string email)
+ {
+ return !string.IsNullOrEmpty(Pattern) && Regex.IsMatch(email, Pattern);
+ }
+ // Метод для установки примера
+ public void SetExample(string str)
+ {
+ if (IsValidEmail(str))
+ {
+ example = str;
+ }
+ else
+ {
+ TriggerError("Invalid example format.");
+ }
+ }
+ // Метод для запуска события ошибки
+ private void TriggerError(string errorMessage)
+ {
+ Error = errorMessage;
+ _errorOccurred?.Invoke();
+ }
+ }
+}
diff --git a/COP_1/cop_1/ValuesList.Designer.cs b/COP_1/cop_1/ValuesList.Designer.cs
new file mode 100644
index 0000000..c59f6a4
--- /dev/null
+++ b/COP_1/cop_1/ValuesList.Designer.cs
@@ -0,0 +1,73 @@
+namespace COP_1
+{
+ partial class ValuesList
+ {
+ ///
+ /// Обязательная переменная конструктора.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Освободить все используемые ресурсы.
+ ///
+ /// истинно, если управляемый ресурс должен быть удален; иначе ложно.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Код, автоматически созданный конструктором компонентов
+
+ ///
+ /// Требуемый метод для поддержки конструктора — не изменяйте
+ /// содержимое этого метода с помощью редактора кода.
+ ///
+ private void InitializeComponent()
+ {
+ listBox = new ListBox();
+ label1 = new Label();
+ SuspendLayout();
+ //
+ // listBox
+ //
+ listBox.Dock = DockStyle.Bottom;
+ listBox.FormattingEnabled = true;
+ listBox.HorizontalScrollbar = true;
+ listBox.ItemHeight = 20;
+ listBox.Location = new Point(0, 21);
+ listBox.Name = "listBox";
+ listBox.Size = new Size(238, 104);
+ listBox.TabIndex = 0;
+ //
+ // label1
+ //
+ label1.AutoSize = true;
+ label1.Dock = DockStyle.Bottom;
+ label1.Location = new Point(0, 1);
+ label1.Name = "label1";
+ label1.Size = new Size(130, 20);
+ label1.TabIndex = 1;
+ label1.Text = "Список значений";
+ //
+ // ValuesList
+ //
+ AutoScaleDimensions = new SizeF(8F, 20F);
+ AutoScaleMode = AutoScaleMode.Font;
+ Controls.Add(label1);
+ Controls.Add(listBox);
+ Name = "ValuesList";
+ Size = new Size(238, 125);
+ ResumeLayout(false);
+ PerformLayout();
+ }
+
+ #endregion
+
+ private ListBox listBox;
+ private Label label1;
+ }
+}
diff --git a/COP_1/cop_1/ValuesList.cs b/COP_1/cop_1/ValuesList.cs
new file mode 100644
index 0000000..3eaf9de
--- /dev/null
+++ b/COP_1/cop_1/ValuesList.cs
@@ -0,0 +1,139 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace COP_1
+{
+ public partial class ValuesList : UserControl
+ {
+ private string template;
+ private string start;
+ private string end;
+
+ private event Action? _errorOccured;
+ public string Error { get; private set; }
+ public ValuesList()
+ {
+ InitializeComponent();
+ Error = string.Empty;
+ }
+ //Метод для установки информации о макетной строке и символах (стартового и конечного)
+ public void SetLayoutInfo(string layout, string startS, string endS)
+ {
+ if (layout == null || startS == null || endS == null)
+ {
+ return;
+ }
+ template = layout;
+ start = startS;
+ end = endS;
+ }
+
+ //св-во для получения и заполнения индекса выбранного элемента
+ public int SelectedIndex
+ {
+ get
+ {
+ return listBox.SelectedIndex;
+ }
+ set
+ {
+ listBox.SelectedIndex = value;
+ }
+ }
+
+ //Публичный параметризованный метод для получения объекта из выбранной строки(создать объект и через рефлексию заполнить свойства его).
+ public T GetObjectFromStr() where T : class, new()
+ {
+ if (listBox.SelectedIndex < 0)
+ {
+ return null;
+ }
+ string initString = listBox.SelectedItem.ToString();//изначальная строка, получаемая из листбокса
+ T curObject = new T();
+
+ string[] tempWords = template.Split(new[] { char.Parse(start), char.Parse(end) }, StringSplitOptions.RemoveEmptyEntries);//все слова в шаблонной строке
+
+ StringBuilder valuesString = new StringBuilder(initString);//воспользуемся stringbuilder, т.к. будем проводить операции со строкой
+
+ List replaceablePatterns = new(); //заменяемые слова шаблона(title, performer, genre, year)
+
+ foreach (var word in tempWords)
+ {
+ if (initString.Contains(word))
+ {
+ // Удаляем первое слово, остальные заменяем на символ конца
+ if (valuesString.ToString().StartsWith(word))
+ {
+ valuesString.Replace(word, string.Empty); // Удаляем первое слово
+ }
+ else
+ {
+ valuesString.Replace(word, end.ToString());
+ }
+ }
+ else
+ {
+ replaceablePatterns.Add(word);
+ }
+ }
+
+ string[] values = valuesString.ToString().Split(new[] { end }, StringSplitOptions.RemoveEmptyEntries);
+ StringBuilder result = new StringBuilder(template);
+ for (int j = 0; j < replaceablePatterns.Count; j++)
+ {
+ if (!string.IsNullOrEmpty(replaceablePatterns[j]))
+ {
+ result.Replace(replaceablePatterns[j], values[j]);
+ }
+ }
+
+ foreach (var property in typeof(T).GetProperties())
+ {
+ if (!property.CanWrite)
+ {
+ continue;
+ }
+
+ int startBorder = result.ToString().IndexOf(start);
+ int endBorder = result.ToString().IndexOf(end, startBorder + 1);
+ if (startBorder == -1 || endBorder == -1)
+ {
+ break;
+ }
+
+ string propertyValue = result.ToString(startBorder + 1, endBorder - startBorder - 1); //с какого символа и сколько смволов вперед
+ result.Remove(0, endBorder + 1);
+ property.SetValue(curObject, Convert.ChangeType(propertyValue, property.PropertyType));
+ }
+ return curObject;
+ }
+
+ public void AddInListBox(T dataObject, int rowIndex)
+ {
+ while (listBox.Items.Count <= rowIndex)
+ {
+ listBox.Items.Add(template);
+ }
+
+ string row = listBox.Items[rowIndex].ToString();
+ PropertyInfo[] properties = dataObject.GetType().GetProperties();
+ foreach (PropertyInfo property in properties)
+ {
+ if (property != null)
+ {
+ var propertyValue = property.GetValue(dataObject);
+ row = row.Replace($"{start}{property.Name}{end}", propertyValue.ToString());
+ listBox.Items[rowIndex] = row;
+ }
+ }
+ }
+ }
+}
diff --git a/COP_1/cop_1/ValuesList.resx b/COP_1/cop_1/ValuesList.resx
new file mode 100644
index 0000000..af32865
--- /dev/null
+++ b/COP_1/cop_1/ValuesList.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/COP_1/cop_1/emailBox.Designer.cs b/COP_1/cop_1/emailBox.Designer.cs
new file mode 100644
index 0000000..2a25a30
--- /dev/null
+++ b/COP_1/cop_1/emailBox.Designer.cs
@@ -0,0 +1,72 @@
+namespace COP_1
+{
+ partial class emailBox
+ {
+ ///
+ /// Обязательная переменная конструктора.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Освободить все используемые ресурсы.
+ ///
+ /// истинно, если управляемый ресурс должен быть удален; иначе ложно.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Код, автоматически созданный конструктором компонентов
+
+ ///
+ /// Требуемый метод для поддержки конструктора — не изменяйте
+ /// содержимое этого метода с помощью редактора кода.
+ ///
+ private void InitializeComponent()
+ {
+ textBox = new TextBox();
+ label1 = new Label();
+ SuspendLayout();
+ //
+ // textBox
+ //
+ textBox.Dock = DockStyle.Bottom;
+ textBox.Location = new Point(0, 23);
+ textBox.Name = "textBox";
+ textBox.Size = new Size(225, 27);
+ textBox.TabIndex = 2;
+ textBox.TextChanged += textBox_TextChanged;
+ textBox.Enter += textBox_Enter;
+ //
+ // label1
+ //
+ label1.AutoSize = true;
+ label1.Dock = DockStyle.Bottom;
+ label1.Location = new Point(0, 3);
+ label1.Name = "label1";
+ label1.Size = new Size(168, 20);
+ label1.TabIndex = 3;
+ label1.Text = "Ввод и проверка email";
+ //
+ // emailBox
+ //
+ AutoScaleDimensions = new SizeF(8F, 20F);
+ AutoScaleMode = AutoScaleMode.Font;
+ Controls.Add(label1);
+ Controls.Add(textBox);
+ Name = "emailBox";
+ Size = new Size(225, 50);
+ ResumeLayout(false);
+ PerformLayout();
+ }
+
+ #endregion
+
+ private TextBox textBox;
+ private Label label1;
+ }
+}
diff --git a/COP_1/cop_1/emailBox.resx b/COP_1/cop_1/emailBox.resx
new file mode 100644
index 0000000..af32865
--- /dev/null
+++ b/COP_1/cop_1/emailBox.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/COP_1Test/COP_1Test.csproj b/COP_1Test/COP_1Test.csproj
new file mode 100644
index 0000000..290aacf
--- /dev/null
+++ b/COP_1Test/COP_1Test.csproj
@@ -0,0 +1,15 @@
+
+
+
+ WinExe
+ net6.0-windows
+ enable
+ true
+ enable
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/COP_1Test/Form1.Designer.cs b/COP_1Test/Form1.Designer.cs
new file mode 100644
index 0000000..5440b03
--- /dev/null
+++ b/COP_1Test/Form1.Designer.cs
@@ -0,0 +1,167 @@
+namespace COP_1Test
+{
+ partial class Form1
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ dropDownList = new COP_1.DropDownList();
+ valuesList = new COP_1.ValuesList();
+ emailBox = new COP_1.emailBox();
+ buttonCheck = new Button();
+ label1 = new Label();
+ buttonGet = new Button();
+ textBoxShowItem = new TextBox();
+ buttonGetDown = new Button();
+ textBoxResult = new TextBox();
+ buttonClear = new Button();
+ SuspendLayout();
+ //
+ // dropDownList
+ //
+ dropDownList.Location = new Point(12, 12);
+ dropDownList.Name = "dropDownList";
+ dropDownList.Selected = "";
+ dropDownList.Size = new Size(281, 49);
+ dropDownList.TabIndex = 0;
+ //
+ // valuesList
+ //
+ valuesList.Location = new Point(374, 12);
+ valuesList.Name = "valuesList";
+ valuesList.SelectedIndex = -1;
+ valuesList.Size = new Size(298, 125);
+ valuesList.TabIndex = 1;
+ //
+ // emailBox
+ //
+ emailBox.Location = new Point(12, 178);
+ emailBox.Name = "emailBox";
+ emailBox.Pattern = null;
+ emailBox.Size = new Size(281, 62);
+ emailBox.TabIndex = 2;
+ //
+ // buttonCheck
+ //
+ buttonCheck.Location = new Point(12, 246);
+ buttonCheck.Name = "buttonCheck";
+ buttonCheck.Size = new Size(281, 29);
+ buttonCheck.TabIndex = 3;
+ buttonCheck.Text = "Проверить";
+ buttonCheck.UseVisualStyleBackColor = true;
+ buttonCheck.Click += buttonCheck_Click;
+ //
+ // label1
+ //
+ label1.AutoSize = true;
+ label1.Font = new Font("Segoe UI Black", 12F, FontStyle.Bold, GraphicsUnit.Point);
+ label1.ForeColor = Color.Chartreuse;
+ label1.Location = new Point(295, 210);
+ label1.Name = "label1";
+ label1.Size = new Size(69, 28);
+ label1.TabIndex = 4;
+ label1.Text = "label1";
+ label1.Visible = false;
+ //
+ // buttonGet
+ //
+ buttonGet.Location = new Point(374, 143);
+ buttonGet.Name = "buttonGet";
+ buttonGet.Size = new Size(298, 29);
+ buttonGet.TabIndex = 5;
+ buttonGet.Text = "Получить значение";
+ buttonGet.UseVisualStyleBackColor = true;
+ buttonGet.Click += buttonGet_Click;
+ //
+ // textBoxShowItem
+ //
+ textBoxShowItem.Location = new Point(374, 180);
+ textBoxShowItem.Name = "textBoxShowItem";
+ textBoxShowItem.Size = new Size(297, 27);
+ textBoxShowItem.TabIndex = 6;
+ //
+ // buttonGetDown
+ //
+ buttonGetDown.Location = new Point(12, 64);
+ buttonGetDown.Name = "buttonGetDown";
+ buttonGetDown.Size = new Size(139, 51);
+ buttonGetDown.TabIndex = 7;
+ buttonGetDown.Text = "Получить значение";
+ buttonGetDown.UseVisualStyleBackColor = true;
+ buttonGetDown.Click += buttonGetDown_Click;
+ //
+ // textBoxResult
+ //
+ textBoxResult.Location = new Point(12, 121);
+ textBoxResult.Name = "textBoxResult";
+ textBoxResult.Size = new Size(281, 27);
+ textBoxResult.TabIndex = 8;
+ //
+ // buttonClear
+ //
+ buttonClear.Location = new Point(154, 64);
+ buttonClear.Name = "buttonClear";
+ buttonClear.Size = new Size(139, 51);
+ buttonClear.TabIndex = 9;
+ buttonClear.Text = "Очистить";
+ buttonClear.UseVisualStyleBackColor = true;
+ buttonClear.Click += buttonClear_Click;
+ //
+ // Form1
+ //
+ AutoScaleDimensions = new SizeF(8F, 20F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(684, 286);
+ Controls.Add(buttonClear);
+ Controls.Add(textBoxResult);
+ Controls.Add(buttonGetDown);
+ Controls.Add(textBoxShowItem);
+ Controls.Add(buttonGet);
+ Controls.Add(label1);
+ Controls.Add(buttonCheck);
+ Controls.Add(emailBox);
+ Controls.Add(valuesList);
+ Controls.Add(dropDownList);
+ Name = "Form1";
+ Text = "Form1";
+ ResumeLayout(false);
+ PerformLayout();
+ }
+
+ #endregion
+
+ private COP_1.DropDownList dropDownList;
+ private COP_1.ValuesList valuesList;
+ private COP_1.emailBox emailBox;
+ private Button buttonCheck;
+ private Label label1;
+ private Button buttonGet;
+ private TextBox textBoxShowItem;
+ private Button buttonGetDown;
+ private TextBox textBoxResult;
+ private Button buttonClear;
+ }
+}
diff --git a/COP_1Test/Form1.cs b/COP_1Test/Form1.cs
new file mode 100644
index 0000000..a7e14b9
--- /dev/null
+++ b/COP_1Test/Form1.cs
@@ -0,0 +1,88 @@
+using COP_1;
+using System;
+
+namespace COP_1Test
+{
+ public partial class Form1 : Form
+ {
+ List list = new List();
+ public Form1()
+ {
+ InitializeComponent();
+ this.BackColor = GetRandomPastelColor();
+ list = new List();
+ list.AddRange(new string[] { " 1", " 2", " 3", " 4", " 5", " 6" });
+
+ Album album1 = new Album("Meds", "Placebo", "Alternative", "2006");
+ Album album2 = new Album("Iowa", "Slipknot", "Nu-Metal", "2001");
+ Album album3 = new Album("Showbiz", "Muse", "Alternative", "1999");
+ Album album4 = new Album("Chocolate Starfish and the Hot Dog Flavored Water", "Limp Bizkit", "Nu-metal", "2011");
+
+ valuesList.SetLayoutInfo(": {Title} : {Performer} : {Genre} : {Year}", "{", "}");
+ valuesList.AddInListBox(album1, 0);
+ valuesList.AddInListBox(album2, 1);
+ valuesList.AddInListBox(album3, 2);
+ valuesList.AddInListBox(album4, 3);
+
+ emailBox.Pattern = @"^[^@\s]+@[^@\s]+\.[^@\s]+$";
+
+ dropDownList.AddingToList(new List() { "Placebo", "Slipknot", "Blue October", "The Used", "Muse", "The Cure" });
+ dropDownList.ExplicitEvent += Event_Handler;
+
+ emailBox.ExplicitEvent += Event_Handler;
+ emailBox.SetExample("eeee@mail.ru");
+ }
+ private Color GetRandomPastelColor()
+ {
+ Random random = new Random();
+ int red = random.Next(128, 256);
+ int green = random.Next(128, 256);
+ int blue = random.Next(128, 256);
+
+ return Color.FromArgb(red, green, blue);
+ }
+
+
+ private void Event_Handler(object sender, EventArgs e)
+ {
+ this.BackColor = GetRandomPastelColor();
+ }
+
+
+ private void buttonGet_Click(object sender, EventArgs e)
+ {
+ string str = valuesList.GetObjectFromStr().Title + " " + valuesList.GetObjectFromStr().Performer + " " + valuesList.GetObjectFromStr().Genre + " " + valuesList.GetObjectFromStr().Year;
+ textBoxShowItem.Text = str;
+ }
+ private void buttonCheck_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ if (emailBox.TextBoxValue != null)
+ {
+ label1.Visible = true;
+ label1.Text = "true";
+ label1.ForeColor = Color.Green;
+ }
+ else
+ {
+ label1.Visible = true;
+ label1.Text = "false";
+ label1.ForeColor = Color.Red;
+ }
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
+ }
+ private void buttonClear_Click(object sender, EventArgs e)
+ {
+ dropDownList.Clear();
+ }
+ private void buttonGetDown_Click(object sender, EventArgs e)
+ {
+ textBoxResult.Text = dropDownList.Selected;
+ }
+ }
+}
diff --git a/COP_1Test/Form1.resx b/COP_1Test/Form1.resx
new file mode 100644
index 0000000..af32865
--- /dev/null
+++ b/COP_1Test/Form1.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file