Сделал две таски

This commit is contained in:
Artyom_Yashin 2024-09-05 18:26:06 +04:00
parent a03ccc7d78
commit c3b6b08a4e
15 changed files with 975 additions and 0 deletions

31
KOP_Labs/KOP_Labs.sln Normal file
View File

@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.7.34031.279
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Library_var_4_lab_1", "Library_var_4_lab_1\Library_var_4_lab_1.csproj", "{54FEDC65-63CA-474A-9D78-FCACE673AA3F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestProj", "TestProj\TestProj.csproj", "{0FF632B3-8D31-403E-AC25-61283C15D2C9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{54FEDC65-63CA-474A-9D78-FCACE673AA3F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{54FEDC65-63CA-474A-9D78-FCACE673AA3F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{54FEDC65-63CA-474A-9D78-FCACE673AA3F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{54FEDC65-63CA-474A-9D78-FCACE673AA3F}.Release|Any CPU.Build.0 = Release|Any CPU
{0FF632B3-8D31-403E-AC25-61283C15D2C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0FF632B3-8D31-403E-AC25-61283C15D2C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0FF632B3-8D31-403E-AC25-61283C15D2C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0FF632B3-8D31-403E-AC25-61283C15D2C9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0115D661-19A6-4D29-9906-E1EA34CC92B2}
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,61 @@
namespace Library_var_4_lab_1
{
partial class DateInputBox
{
/// <summary>
/// Обязательная переменная конструктора.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Освободить все используемые ресурсы.
/// </summary>
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Код, автоматически созданный конструктором компонентов
/// <summary>
/// Требуемый метод для поддержки конструктора — не изменяйте
/// содержимое этого метода с помощью редактора кода.
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
textBoxDateInput = new TextBox();
toolTip1 = new ToolTip(components);
SuspendLayout();
//
// textBoxDateInput
//
textBoxDateInput.Location = new Point(3, 3);
textBoxDateInput.Name = "textBoxDateInput";
textBoxDateInput.Size = new Size(238, 27);
textBoxDateInput.TabIndex = 0;
textBoxDateInput.TextChanged += textBox_ValueChanged;
textBoxDateInput.MouseMove += textBox_MouseMove;
//
// DateInputBox
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
Controls.Add(textBoxDateInput);
Name = "DateInputBox";
Size = new Size(246, 39);
ResumeLayout(false);
PerformLayout();
}
#endregion
private TextBox textBoxDateInput;
private ToolTip toolTip1;
}
}

View File

@ -0,0 +1,66 @@
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;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
namespace Library_var_4_lab_1
{
public partial class DateInputBox : UserControl
{
public string Template = string.Empty;
private string Example = string.Empty;
public string Date
{
get
{
if (string.IsNullOrEmpty(Template))
throw new TemplateNotSetException();
Regex regex = new Regex(Template);
if (regex.IsMatch(textBoxDateInput.Text))
return textBoxDateInput.Text;
else throw new InvalidArgumentException();
}
set
{
Regex regex = new Regex(Template);
if (!string.IsNullOrEmpty(Template) && regex.IsMatch(value))
textBoxDateInput.Text = value;
}
}
private event EventHandler? _changeValue;
public event EventHandler ChangeValue
{
add => _changeValue += value;
remove => _changeValue -= value;
}
public DateInputBox()
{
InitializeComponent();
}
public void setExample(string example)
{
Example = example;
}
private void textBox_MouseMove(object sender, MouseEventArgs e)
{
toolTip1.SetToolTip(textBoxDateInput, Example);
}
private void textBox_ValueChanged(object sender, EventArgs e)
{
_changeValue?.Invoke(this, e);
}
}
}

View File

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -0,0 +1,59 @@
namespace Library_var_4_lab_1
{
partial class DropDownList
{
/// <summary>
/// Обязательная переменная конструктора.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Освободить все используемые ресурсы.
/// </summary>
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Код, автоматически созданный конструктором компонентов
/// <summary>
/// Требуемый метод для поддержки конструктора — не изменяйте
/// содержимое этого метода с помощью редактора кода.
/// </summary>
private void InitializeComponent()
{
comboBox = new ComboBox();
SuspendLayout();
//
// comboBox
//
comboBox.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
comboBox.DropDownStyle = ComboBoxStyle.DropDownList;
comboBox.FormattingEnabled = true;
comboBox.Location = new Point(3, 3);
comboBox.Name = "comboBox";
comboBox.Size = new Size(305, 28);
comboBox.TabIndex = 0;
comboBox.SelectedIndexChanged += comboBox_SelectedIndexChanged;
//
// DropDownList
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
Controls.Add(comboBox);
Name = "DropDownList";
Size = new Size(311, 230);
ResumeLayout(false);
}
#endregion
private ComboBox comboBox;
}
}

View File

@ -0,0 +1,62 @@
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 Library_var_4_lab_1
{
public partial class DropDownList : UserControl
{
private event EventHandler? _changeIndex;
public event EventHandler ChangeIndex
{
add => _changeIndex += value;
remove => _changeIndex -= value;
}
public DropDownList()
{
InitializeComponent();
}
public string SelectedItem
{
get => comboBox.SelectedIndex != -1 ? comboBox.SelectedItem.ToString() ?? string.Empty : string.Empty;
set
{
if (comboBox.Items.Contains(value))
{
comboBox.SelectedItem = value;
}
else
{
comboBox.SelectedIndex = -1;
}
}
}
public void Input(string value)
{
if (string.IsNullOrEmpty(value))
throw new ArgumentNullException("value");
comboBox.Items.Add(value);
}
public void ClearList()
{
comboBox.Items.Clear();
}
private void comboBox_SelectedIndexChanged(object sender, EventArgs e)
{
_changeIndex?.Invoke(this, e);
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace Library_var_4_lab_1
{
[Serializable]
internal class InvalidArgumentException : ApplicationException
{
public InvalidArgumentException() : base("Значение не соответсвует шаблону") { }
public InvalidArgumentException(string message) : base(message) { }
public InvalidArgumentException(string message, Exception exception) : base(message, exception) { }
public InvalidArgumentException(SerializationInfo info, StreamingContext context) : base(info, context) { }
}
}

View File

@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,14 @@
using Microsoft.VisualBasic;
using System.Runtime.Serialization;
namespace Library_var_4_lab_1
{
[Serializable]
internal class TemplateNotSetException : ApplicationException
{
public TemplateNotSetException() : base("Шаблон не задан") { }
public TemplateNotSetException(string message) : base(message) { }
public TemplateNotSetException(string message, Exception exception) : base(message, exception) { }
public TemplateNotSetException(SerializationInfo info, StreamingContext context) : base(info, context) { }
}
}

195
KOP_Labs/TestProj/Form1.Designer.cs generated Normal file
View File

@ -0,0 +1,195 @@
namespace TestProj
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
dropDownList1 = new Library_var_4_lab_1.DropDownList();
textBox1 = new TextBox();
buttonAdd = new Button();
buttonGet = new Button();
buttonSet = new Button();
buttonClear = new Button();
checkBox = new CheckBox();
dateInputBox1 = new Library_var_4_lab_1.DateInputBox();
buttonSetDate = new Button();
buttonGetDate = new Button();
buttonSetExample = new Button();
buttonSetTemplate = new Button();
SuspendLayout();
//
// dropDownList1
//
dropDownList1.Location = new Point(12, 12);
dropDownList1.Name = "dropDownList1";
dropDownList1.SelectedItem = "";
dropDownList1.Size = new Size(329, 44);
dropDownList1.TabIndex = 0;
//
// textBox1
//
textBox1.Location = new Point(12, 62);
textBox1.Name = "textBox1";
textBox1.Size = new Size(314, 27);
textBox1.TabIndex = 1;
//
// buttonAdd
//
buttonAdd.Location = new Point(12, 108);
buttonAdd.Name = "buttonAdd";
buttonAdd.Size = new Size(94, 29);
buttonAdd.TabIndex = 2;
buttonAdd.Text = "Добавить";
buttonAdd.UseVisualStyleBackColor = true;
buttonAdd.Click += buttonAdd_OnClick;
//
// buttonGet
//
buttonGet.Location = new Point(121, 108);
buttonGet.Name = "buttonGet";
buttonGet.Size = new Size(94, 29);
buttonGet.TabIndex = 3;
buttonGet.Text = "Get";
buttonGet.UseVisualStyleBackColor = true;
buttonGet.Click += buttonGet_OnClick;
//
// buttonSet
//
buttonSet.Location = new Point(232, 108);
buttonSet.Name = "buttonSet";
buttonSet.Size = new Size(94, 29);
buttonSet.TabIndex = 4;
buttonSet.Text = "Set";
buttonSet.UseVisualStyleBackColor = true;
buttonSet.Click += buttonSet_OnClick;
//
// buttonClear
//
buttonClear.Location = new Point(12, 143);
buttonClear.Name = "buttonClear";
buttonClear.Size = new Size(94, 29);
buttonClear.TabIndex = 5;
buttonClear.Text = "Очистка";
buttonClear.UseVisualStyleBackColor = true;
buttonClear.Click += buttonClear_OnClick;
//
// checkBox
//
checkBox.AutoSize = true;
checkBox.Location = new Point(371, 56);
checkBox.Name = "checkBox";
checkBox.Size = new Size(93, 24);
checkBox.TabIndex = 6;
checkBox.Text = "checkBox";
checkBox.UseVisualStyleBackColor = true;
//
// dateInputBox1
//
dateInputBox1.Location = new Point(529, 12);
dateInputBox1.Name = "dateInputBox1";
dateInputBox1.Size = new Size(245, 49);
dateInputBox1.TabIndex = 7;
//
// buttonSetDate
//
buttonSetDate.Location = new Point(12, 230);
buttonSetDate.Name = "buttonSetDate";
buttonSetDate.Size = new Size(94, 29);
buttonSetDate.TabIndex = 8;
buttonSetDate.Text = "Ввод даты";
buttonSetDate.UseVisualStyleBackColor = true;
buttonSetDate.Click += buttonSetDate_OnClick;
//
// buttonGetDate
//
buttonGetDate.Location = new Point(142, 230);
buttonGetDate.Name = "buttonGetDate";
buttonGetDate.Size = new Size(109, 29);
buttonGetDate.TabIndex = 9;
buttonGetDate.Text = "Вывод даты";
buttonGetDate.UseVisualStyleBackColor = true;
buttonGetDate.Click += buttonGetDate_OnClick;
//
// buttonSetExample
//
buttonSetExample.Location = new Point(142, 195);
buttonSetExample.Name = "buttonSetExample";
buttonSetExample.Size = new Size(134, 29);
buttonSetExample.TabIndex = 10;
buttonSetExample.Text = "Ввод примера";
buttonSetExample.UseVisualStyleBackColor = true;
buttonSetExample.Click += buttonSetExample_OnClick;
//
// buttonSetTemplate
//
buttonSetTemplate.Location = new Point(12, 195);
buttonSetTemplate.Name = "buttonSetTemplate";
buttonSetTemplate.Size = new Size(124, 29);
buttonSetTemplate.TabIndex = 11;
buttonSetTemplate.Text = "Ввод шаблона";
buttonSetTemplate.UseVisualStyleBackColor = true;
buttonSetTemplate.Click += buttonSetTemplate_OnClick;
//
// Form1
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(922, 549);
Controls.Add(buttonSetTemplate);
Controls.Add(buttonSetExample);
Controls.Add(buttonGetDate);
Controls.Add(buttonSetDate);
Controls.Add(dateInputBox1);
Controls.Add(checkBox);
Controls.Add(buttonClear);
Controls.Add(buttonSet);
Controls.Add(buttonGet);
Controls.Add(buttonAdd);
Controls.Add(textBox1);
Controls.Add(dropDownList1);
Name = "Form1";
Text = "Form1";
ResumeLayout(false);
PerformLayout();
}
#endregion
private Library_var_4_lab_1.DropDownList dropDownList1;
private TextBox textBox1;
private Button buttonAdd;
private Button buttonGet;
private Button buttonSet;
private Button buttonClear;
private CheckBox checkBox;
private Library_var_4_lab_1.DateInputBox dateInputBox1;
private Button buttonSetDate;
private Button buttonGetDate;
private Button buttonSetExample;
private Button buttonSetTemplate;
}
}

View File

@ -0,0 +1,64 @@
using Library_var_4_lab_1;
namespace TestProj
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
dropDownList1.ChangeIndex += IsChanged;
dateInputBox1.ChangeValue += IsChanged;
}
private void buttonAdd_OnClick(object sender, EventArgs e)
{
try
{
dropDownList1.Input(textBox1.Text);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void buttonClear_OnClick(object sender, EventArgs e)
{
dropDownList1.ClearList();
}
private void buttonSet_OnClick(object sender, EventArgs e)
{
dropDownList1.SelectedItem = textBox1.Text;
}
private void buttonGet_OnClick(object sender, EventArgs e)
{
textBox1.Text = dropDownList1.SelectedItem;
}
private void IsChanged(object? sender, EventArgs e)
{
checkBox.Checked = true;
}
private void buttonSetTemplate_OnClick(object sender, EventArgs e)
{
dateInputBox1.Template = textBox1.Text;
}
private void buttonSetExample_OnClick(object sender, EventArgs e)
{
dateInputBox1.setExample(textBox1.Text);
}
private void buttonSetDate_OnClick(object sender, EventArgs e)
{
dateInputBox1.Date = textBox1.Text;
}
private void buttonGetDate_OnClick(object sender, EventArgs e)
{
textBox1.Text = dateInputBox1.Date;
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,17 @@
namespace TestProj
{
internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
Application.Run(new Form1());
}
}
}

View File

@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Library_var_4_lab_1\Library_var_4_lab_1.csproj" />
</ItemGroup>
</Project>