Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
193a9f1ab8 |
222
YunusovComponentsLibrary/Form1/Form1.Designer.cs
generated
Normal file
222
YunusovComponentsLibrary/Form1/Form1.Designer.cs
generated
Normal file
@ -0,0 +1,222 @@
|
|||||||
|
namespace Form1
|
||||||
|
{
|
||||||
|
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()
|
||||||
|
{
|
||||||
|
selectComponent = new YunusovComponentsLibrary.SelectedComponent();
|
||||||
|
groupBoxSelect = new GroupBox();
|
||||||
|
buttonGetSelected = new Button();
|
||||||
|
buttonClear = new Button();
|
||||||
|
textBox = new TextBox();
|
||||||
|
buttonAdd = new Button();
|
||||||
|
inputComponent = new YunusovComponentsLibrary.InputComponent();
|
||||||
|
groupBoxInput = new GroupBox();
|
||||||
|
buttonShowFloat = new Button();
|
||||||
|
groupBoxListOutput = new GroupBox();
|
||||||
|
buttonGetListOutput = new Button();
|
||||||
|
buttonAddListOutput = new Button();
|
||||||
|
buttonClearListOutput = new Button();
|
||||||
|
listOutputComponent = new YunusovComponentsLibrary.ListOutputComponent();
|
||||||
|
groupBoxSelect.SuspendLayout();
|
||||||
|
groupBoxInput.SuspendLayout();
|
||||||
|
groupBoxListOutput.SuspendLayout();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// selectComponent
|
||||||
|
//
|
||||||
|
selectComponent.Location = new Point(6, 32);
|
||||||
|
selectComponent.Name = "selectComponent";
|
||||||
|
selectComponent.SelectedItem = "";
|
||||||
|
selectComponent.Size = new Size(164, 226);
|
||||||
|
selectComponent.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// groupBoxSelect
|
||||||
|
//
|
||||||
|
groupBoxSelect.Controls.Add(buttonGetSelected);
|
||||||
|
groupBoxSelect.Controls.Add(buttonClear);
|
||||||
|
groupBoxSelect.Controls.Add(textBox);
|
||||||
|
groupBoxSelect.Controls.Add(buttonAdd);
|
||||||
|
groupBoxSelect.Controls.Add(selectComponent);
|
||||||
|
groupBoxSelect.Location = new Point(12, 1);
|
||||||
|
groupBoxSelect.Name = "groupBoxSelect";
|
||||||
|
groupBoxSelect.Size = new Size(302, 241);
|
||||||
|
groupBoxSelect.TabIndex = 1;
|
||||||
|
groupBoxSelect.TabStop = false;
|
||||||
|
groupBoxSelect.Text = "Selected";
|
||||||
|
//
|
||||||
|
// buttonGetSelected
|
||||||
|
//
|
||||||
|
buttonGetSelected.Location = new Point(171, 192);
|
||||||
|
buttonGetSelected.Name = "buttonGetSelected";
|
||||||
|
buttonGetSelected.Size = new Size(125, 29);
|
||||||
|
buttonGetSelected.TabIndex = 4;
|
||||||
|
buttonGetSelected.Text = "Get selected";
|
||||||
|
buttonGetSelected.UseVisualStyleBackColor = true;
|
||||||
|
buttonGetSelected.Click += SelectComponent_ItemSelected;
|
||||||
|
//
|
||||||
|
// buttonClear
|
||||||
|
//
|
||||||
|
buttonClear.Location = new Point(171, 140);
|
||||||
|
buttonClear.Name = "buttonClear";
|
||||||
|
buttonClear.Size = new Size(125, 29);
|
||||||
|
buttonClear.TabIndex = 3;
|
||||||
|
buttonClear.Text = "Clear";
|
||||||
|
buttonClear.UseVisualStyleBackColor = true;
|
||||||
|
buttonClear.Click += buttonClearList_Click;
|
||||||
|
//
|
||||||
|
// textBox
|
||||||
|
//
|
||||||
|
textBox.Location = new Point(171, 41);
|
||||||
|
textBox.Name = "textBox";
|
||||||
|
textBox.Size = new Size(125, 27);
|
||||||
|
textBox.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// buttonAdd
|
||||||
|
//
|
||||||
|
buttonAdd.Location = new Point(171, 92);
|
||||||
|
buttonAdd.Name = "buttonAdd";
|
||||||
|
buttonAdd.Size = new Size(125, 29);
|
||||||
|
buttonAdd.TabIndex = 1;
|
||||||
|
buttonAdd.Text = "Add";
|
||||||
|
buttonAdd.UseVisualStyleBackColor = true;
|
||||||
|
buttonAdd.Click += buttonAdd_Click;
|
||||||
|
//
|
||||||
|
// inputComponent
|
||||||
|
//
|
||||||
|
inputComponent.Location = new Point(6, 26);
|
||||||
|
inputComponent.Name = "inputComponent";
|
||||||
|
inputComponent.Size = new Size(181, 49);
|
||||||
|
inputComponent.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// groupBoxInput
|
||||||
|
//
|
||||||
|
groupBoxInput.Controls.Add(buttonShowFloat);
|
||||||
|
groupBoxInput.Controls.Add(inputComponent);
|
||||||
|
groupBoxInput.Location = new Point(360, 1);
|
||||||
|
groupBoxInput.Name = "groupBoxInput";
|
||||||
|
groupBoxInput.Size = new Size(190, 241);
|
||||||
|
groupBoxInput.TabIndex = 3;
|
||||||
|
groupBoxInput.TabStop = false;
|
||||||
|
groupBoxInput.Text = "Input";
|
||||||
|
//
|
||||||
|
// buttonShowFloat
|
||||||
|
//
|
||||||
|
buttonShowFloat.Location = new Point(45, 81);
|
||||||
|
buttonShowFloat.Name = "buttonShowFloat";
|
||||||
|
buttonShowFloat.Size = new Size(94, 29);
|
||||||
|
buttonShowFloat.TabIndex = 4;
|
||||||
|
buttonShowFloat.Text = "Show";
|
||||||
|
buttonShowFloat.UseVisualStyleBackColor = true;
|
||||||
|
buttonShowFloat.Click += buttonShowFloat_Click;
|
||||||
|
//
|
||||||
|
// groupBoxListOutput
|
||||||
|
//
|
||||||
|
groupBoxListOutput.Controls.Add(buttonGetListOutput);
|
||||||
|
groupBoxListOutput.Controls.Add(buttonAddListOutput);
|
||||||
|
groupBoxListOutput.Controls.Add(buttonClearListOutput);
|
||||||
|
groupBoxListOutput.Controls.Add(listOutputComponent);
|
||||||
|
groupBoxListOutput.Location = new Point(592, 1);
|
||||||
|
groupBoxListOutput.Name = "groupBoxListOutput";
|
||||||
|
groupBoxListOutput.Size = new Size(570, 241);
|
||||||
|
groupBoxListOutput.TabIndex = 4;
|
||||||
|
groupBoxListOutput.TabStop = false;
|
||||||
|
groupBoxListOutput.Text = "ListOutput";
|
||||||
|
//
|
||||||
|
// buttonGetListOutput
|
||||||
|
//
|
||||||
|
buttonGetListOutput.Location = new Point(457, 143);
|
||||||
|
buttonGetListOutput.Name = "buttonGetListOutput";
|
||||||
|
buttonGetListOutput.Size = new Size(94, 29);
|
||||||
|
buttonGetListOutput.TabIndex = 7;
|
||||||
|
buttonGetListOutput.Text = "Get";
|
||||||
|
buttonGetListOutput.UseVisualStyleBackColor = true;
|
||||||
|
buttonGetListOutput.Click += buttonGetListOutput_Click;
|
||||||
|
//
|
||||||
|
// buttonAddListOutput
|
||||||
|
//
|
||||||
|
buttonAddListOutput.Location = new Point(457, 26);
|
||||||
|
buttonAddListOutput.Name = "buttonAddListOutput";
|
||||||
|
buttonAddListOutput.Size = new Size(94, 29);
|
||||||
|
buttonAddListOutput.TabIndex = 6;
|
||||||
|
buttonAddListOutput.Text = "Add";
|
||||||
|
buttonAddListOutput.UseVisualStyleBackColor = true;
|
||||||
|
buttonAddListOutput.Click += buttonAddListOutput_Click;
|
||||||
|
//
|
||||||
|
// buttonClearListOutput
|
||||||
|
//
|
||||||
|
buttonClearListOutput.Location = new Point(457, 81);
|
||||||
|
buttonClearListOutput.Name = "buttonClearListOutput";
|
||||||
|
buttonClearListOutput.Size = new Size(94, 29);
|
||||||
|
buttonClearListOutput.TabIndex = 5;
|
||||||
|
buttonClearListOutput.Text = "Clear";
|
||||||
|
buttonClearListOutput.UseVisualStyleBackColor = true;
|
||||||
|
buttonClearListOutput.Click += buttonClearListOutput_Click;
|
||||||
|
//
|
||||||
|
// listOutputComponent
|
||||||
|
//
|
||||||
|
listOutputComponent.Location = new Point(6, 26);
|
||||||
|
listOutputComponent.Name = "listOutputComponent";
|
||||||
|
listOutputComponent.SelectedRow = -1;
|
||||||
|
listOutputComponent.Size = new Size(414, 204);
|
||||||
|
listOutputComponent.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// Form1
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(1174, 641);
|
||||||
|
Controls.Add(groupBoxListOutput);
|
||||||
|
Controls.Add(groupBoxInput);
|
||||||
|
Controls.Add(groupBoxSelect);
|
||||||
|
Name = "Form1";
|
||||||
|
Text = "Form1";
|
||||||
|
groupBoxSelect.ResumeLayout(false);
|
||||||
|
groupBoxSelect.PerformLayout();
|
||||||
|
groupBoxInput.ResumeLayout(false);
|
||||||
|
groupBoxListOutput.ResumeLayout(false);
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private YunusovComponentsLibrary.SelectedComponent selectComponent;
|
||||||
|
private GroupBox groupBoxSelect;
|
||||||
|
private Button buttonGetSelected;
|
||||||
|
private Button buttonClear;
|
||||||
|
private TextBox textBox;
|
||||||
|
private Button buttonAdd;
|
||||||
|
private YunusovComponentsLibrary.InputComponent inputComponent;
|
||||||
|
private GroupBox groupBoxInput;
|
||||||
|
private Button buttonShowFloat;
|
||||||
|
private GroupBox groupBoxListOutput;
|
||||||
|
private YunusovComponentsLibrary.ListOutputComponent listOutputComponent;
|
||||||
|
private Button buttonGetListOutput;
|
||||||
|
private Button buttonAddListOutput;
|
||||||
|
private Button buttonClearListOutput;
|
||||||
|
}
|
||||||
|
}
|
107
YunusovComponentsLibrary/Form1/Form1.cs
Normal file
107
YunusovComponentsLibrary/Form1/Form1.cs
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
using System.Windows.Forms;
|
||||||
|
using YunusovComponentsLibrary;
|
||||||
|
using YunusovComponentsLibrary.Exceptions;
|
||||||
|
|
||||||
|
namespace Form1
|
||||||
|
{
|
||||||
|
public partial class Form1 : Form
|
||||||
|
{
|
||||||
|
public Form1()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
|
||||||
|
InitializeSelectComponent();
|
||||||
|
InitializeInputComponent();
|
||||||
|
|
||||||
|
}
|
||||||
|
private void InitializeSelectComponent()
|
||||||
|
{
|
||||||
|
selectComponent.Input("Çíà÷åíèå 1");
|
||||||
|
selectComponent.Input("Çíà÷åíèå 2");
|
||||||
|
selectComponent.Input("Çíà÷åíèå 3");
|
||||||
|
selectComponent.Input("Çíà÷åíèå 4");
|
||||||
|
selectComponent.Input("Çíà÷åíèå 5");
|
||||||
|
}
|
||||||
|
private void SelectComponent_ItemSelected(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
MessageBox.Show(selectComponent.SelectedItem);
|
||||||
|
}
|
||||||
|
private void buttonAdd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (textBox.Text != "")
|
||||||
|
selectComponent.Input(textBox.Text);
|
||||||
|
}
|
||||||
|
private void buttonClearList_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
selectComponent.ClearList();
|
||||||
|
}
|
||||||
|
private void InitializeInputComponent()
|
||||||
|
{
|
||||||
|
inputComponent.FloatValue = 12.3f;
|
||||||
|
}
|
||||||
|
private void buttonShowFloat_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
float? Value = inputComponent.FloatValue;
|
||||||
|
if (Value != null)
|
||||||
|
{
|
||||||
|
MessageBox.Show($"Ââåäåííîå ÷èñëî: {Value}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Çíà÷åíèå - null");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (NotFloatException ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message);
|
||||||
|
}
|
||||||
|
catch (EmptyValueException ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void InitializeDataGridViewComponent()
|
||||||
|
{
|
||||||
|
listOutputComponent.ConfigColumn(new()
|
||||||
|
{
|
||||||
|
ColumnsCount = 4,
|
||||||
|
Header = new string[] { "ID", "Èìÿ", "Ôàìèëèÿ", "Âîçðàñò" },
|
||||||
|
Width = new int[] { 10, 150, 150, 100 },
|
||||||
|
IsVisible = new bool[] { false, true, true, true },
|
||||||
|
PropertiesName = new string[] { "Id", "Name", "Yourname", "Age" }
|
||||||
|
});
|
||||||
|
List<TestPerson> Persons = new()
|
||||||
|
{
|
||||||
|
new TestPerson(1, "Âÿ÷åñëàâ", "Èâàíîâ", 20),
|
||||||
|
new TestPerson(2, "Ðîñòèñëàâ", "Çàõàðîâ", 20),
|
||||||
|
new TestPerson(3, "Ñåðãåé", "Ñåðãååâ", 59),
|
||||||
|
new TestPerson(4, "Àðò¸ì", "ßøèí", 25),
|
||||||
|
new TestPerson(5, "Ëåâ", "ßøèí", 89),
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (TestPerson person in Persons)
|
||||||
|
{
|
||||||
|
listOutputComponent.AddItem(person);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonAddListOutput_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
InitializeDataGridViewComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonClearListOutput_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
listOutputComponent.ClearDataGridView();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonGetListOutput_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var Test = listOutputComponent.GetSelectedObject<TestPerson>();
|
||||||
|
MessageBox.Show(Test.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
15
YunusovComponentsLibrary/Form1/Form1.csproj
Normal file
15
YunusovComponentsLibrary/Form1/Form1.csproj
Normal 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="..\YunusovComponentsLibrary\YunusovComponentsLibrary.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
120
YunusovComponentsLibrary/Form1/Form1.resx
Normal file
120
YunusovComponentsLibrary/Form1/Form1.resx
Normal 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>
|
17
YunusovComponentsLibrary/Form1/Program.cs
Normal file
17
YunusovComponentsLibrary/Form1/Program.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
namespace Form1
|
||||||
|
{
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
27
YunusovComponentsLibrary/Form1/TestPerson.cs
Normal file
27
YunusovComponentsLibrary/Form1/TestPerson.cs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
namespace YunusovComponentsLibrary
|
||||||
|
{
|
||||||
|
public class TestPerson
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public string Name { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string Yourname { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public int Age { get; set; }
|
||||||
|
public TestPerson()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
public TestPerson(int Id, string Name, string Yourname, int Age)
|
||||||
|
{
|
||||||
|
this.Id = Id;
|
||||||
|
this.Name = Name;
|
||||||
|
this.Yourname = Yourname;
|
||||||
|
this.Age = Age;
|
||||||
|
}
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return $"[{Id}] {Name} {Yourname}. Возраст: {Age}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
31
YunusovComponentsLibrary/YunusovComponentsLibrary.sln
Normal file
31
YunusovComponentsLibrary/YunusovComponentsLibrary.sln
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.7.34221.43
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "YunusovComponentsLibrary", "YunusovComponentsLibrary\YunusovComponentsLibrary.csproj", "{FADF2E43-1F76-4A8B-A586-4D59676F6335}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Form1", "Form1\Form1.csproj", "{9A55F075-005A-433D-B6CC-89E850999353}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{FADF2E43-1F76-4A8B-A586-4D59676F6335}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{FADF2E43-1F76-4A8B-A586-4D59676F6335}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{FADF2E43-1F76-4A8B-A586-4D59676F6335}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{FADF2E43-1F76-4A8B-A586-4D59676F6335}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{9A55F075-005A-433D-B6CC-89E850999353}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{9A55F075-005A-433D-B6CC-89E850999353}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{9A55F075-005A-433D-B6CC-89E850999353}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{9A55F075-005A-433D-B6CC-89E850999353}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {5A6AC5CC-7959-44F7-8CAC-06D9B6C31516}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
@ -0,0 +1,6 @@
|
|||||||
|
namespace YunusovComponentsLibrary
|
||||||
|
{
|
||||||
|
public class Class1
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
namespace YunusovComponentsLibrary
|
||||||
|
{
|
||||||
|
public class ColumnInfo
|
||||||
|
{
|
||||||
|
public int ColumnsCount { get; set; }
|
||||||
|
|
||||||
|
public string[] Header { get; set; }
|
||||||
|
|
||||||
|
public int[] Width { get; set; }
|
||||||
|
|
||||||
|
public bool[] IsVisible { get; set; }
|
||||||
|
|
||||||
|
public string[] PropertiesName { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
namespace YunusovComponentsLibrary.Exceptions
|
||||||
|
{
|
||||||
|
public class EmptyValueException : ApplicationException
|
||||||
|
{
|
||||||
|
public EmptyValueException()
|
||||||
|
: base("Значение не введено")
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
namespace YunusovComponentsLibrary.Exceptions
|
||||||
|
{
|
||||||
|
public class NotFloatException : ApplicationException
|
||||||
|
{
|
||||||
|
public NotFloatException()
|
||||||
|
: base("Введенное значение не является вещественным")
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
68
YunusovComponentsLibrary/YunusovComponentsLibrary/InputComponent.Designer.cs
generated
Normal file
68
YunusovComponentsLibrary/YunusovComponentsLibrary/InputComponent.Designer.cs
generated
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
namespace YunusovComponentsLibrary
|
||||||
|
{
|
||||||
|
partial class InputComponent
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
IsNullCheckBox = new CheckBox();
|
||||||
|
textBoxInput = new TextBox();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// IsNullCheckBox
|
||||||
|
//
|
||||||
|
IsNullCheckBox.AutoSize = true;
|
||||||
|
IsNullCheckBox.Location = new Point(13, 20);
|
||||||
|
IsNullCheckBox.Name = "IsNullCheckBox";
|
||||||
|
IsNullCheckBox.Size = new Size(18, 17);
|
||||||
|
IsNullCheckBox.TabIndex = 0;
|
||||||
|
IsNullCheckBox.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// textBoxInput
|
||||||
|
//
|
||||||
|
textBoxInput.Location = new Point(37, 14);
|
||||||
|
textBoxInput.Name = "textBoxInput";
|
||||||
|
textBoxInput.Size = new Size(125, 27);
|
||||||
|
textBoxInput.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// InputComponent
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
Controls.Add(textBoxInput);
|
||||||
|
Controls.Add(IsNullCheckBox);
|
||||||
|
Name = "InputComponent";
|
||||||
|
Size = new Size(170, 55);
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private CheckBox IsNullCheckBox;
|
||||||
|
private TextBox textBoxInput;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,75 @@
|
|||||||
|
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 YunusovComponentsLibrary.Exceptions;
|
||||||
|
|
||||||
|
namespace YunusovComponentsLibrary
|
||||||
|
{
|
||||||
|
public partial class InputComponent : UserControl
|
||||||
|
{
|
||||||
|
private event EventHandler? _valueChanged;
|
||||||
|
public InputComponent()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
public float? FloatValue
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (IsNullCheckBox.Checked)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(textBoxInput.Text))
|
||||||
|
{
|
||||||
|
throw new EmptyValueException();
|
||||||
|
}
|
||||||
|
|
||||||
|
float ParsedFloat;
|
||||||
|
if (float.TryParse(textBoxInput.Text, out ParsedFloat))
|
||||||
|
{
|
||||||
|
return ParsedFloat;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new NotFloatException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetNullState(value is null, true);
|
||||||
|
if (value is not null)
|
||||||
|
{
|
||||||
|
textBoxInput.Text = value.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public event EventHandler? ValueChanged
|
||||||
|
{
|
||||||
|
add { _valueChanged += value; }
|
||||||
|
remove { _valueChanged -= value; }
|
||||||
|
}
|
||||||
|
private void SetNullState(bool IsNull = false, bool ClearText = false)
|
||||||
|
{
|
||||||
|
IsNullCheckBox.Checked = IsNull;
|
||||||
|
textBoxInput.Enabled = !IsNull;
|
||||||
|
|
||||||
|
if (ClearText)
|
||||||
|
{
|
||||||
|
textBoxInput.Text = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void textBox_TextChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_valueChanged?.Invoke(this, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -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>
|
60
YunusovComponentsLibrary/YunusovComponentsLibrary/ListOutputComponent.Designer.cs
generated
Normal file
60
YunusovComponentsLibrary/YunusovComponentsLibrary/ListOutputComponent.Designer.cs
generated
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
namespace YunusovComponentsLibrary
|
||||||
|
{
|
||||||
|
partial class ListOutputComponent
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
dataGridView = new DataGridView();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// dataGridView
|
||||||
|
//
|
||||||
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dataGridView.Location = new Point(0, 0);
|
||||||
|
dataGridView.Name = "dataGridView";
|
||||||
|
dataGridView.RowHeadersWidth = 51;
|
||||||
|
dataGridView.RowTemplate.Height = 29;
|
||||||
|
dataGridView.Size = new Size(597, 335);
|
||||||
|
dataGridView.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// ListOutputComponent
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
Controls.Add(dataGridView);
|
||||||
|
Name = "ListOutputComponent";
|
||||||
|
Size = new Size(600, 338);
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private DataGridView dataGridView;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,91 @@
|
|||||||
|
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 YunusovComponentsLibrary
|
||||||
|
{
|
||||||
|
public partial class ListOutputComponent : UserControl
|
||||||
|
{
|
||||||
|
public ListOutputComponent()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
public DataGridViewRowCollection Rows
|
||||||
|
{
|
||||||
|
get { return dataGridView.Rows; }
|
||||||
|
}
|
||||||
|
public int SelectedRow
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return dataGridView.SelectedRows.Count == 1 ? dataGridView.SelectedRows[0].Index : -1;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value >= 0 && value < dataGridView.Rows.Count)
|
||||||
|
{
|
||||||
|
dataGridView.Rows[value].Selected = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void ConfigColumn(ColumnInfo columns)
|
||||||
|
{
|
||||||
|
if (columns.ColumnsCount != columns.Header.Length ||
|
||||||
|
columns.ColumnsCount != columns.Width.Length ||
|
||||||
|
columns.ColumnsCount != columns.IsVisible.Length ||
|
||||||
|
columns.ColumnsCount != columns.PropertiesName.Length)
|
||||||
|
throw new ArgumentException("All arrays must have the same length.");
|
||||||
|
|
||||||
|
dataGridView.Columns.Clear();
|
||||||
|
|
||||||
|
dataGridView.ColumnCount = columns.ColumnsCount;
|
||||||
|
|
||||||
|
for (int i = 0; i < columns.ColumnsCount; ++i)
|
||||||
|
{
|
||||||
|
dataGridView.Columns[i].HeaderText = columns.Header[i];
|
||||||
|
dataGridView.Columns[i].Width = columns.Width[i];
|
||||||
|
dataGridView.Columns[i].Visible = columns.IsVisible[i];
|
||||||
|
dataGridView.Columns[i].Name = columns.PropertiesName[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void ClearDataGridView()
|
||||||
|
{
|
||||||
|
dataGridView.Rows.Clear();
|
||||||
|
}
|
||||||
|
public T GetSelectedObject<T>() where T : class, new()
|
||||||
|
{
|
||||||
|
T obj = new ();
|
||||||
|
var properties = typeof(T).GetProperties();
|
||||||
|
|
||||||
|
foreach (var property in properties)
|
||||||
|
{
|
||||||
|
var cellValue = dataGridView.Rows[SelectedRow].Cells[property.Name].Value;
|
||||||
|
if (cellValue != null)
|
||||||
|
{
|
||||||
|
property.SetValue(obj, Convert.ChangeType(cellValue, property.PropertyType));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
public void AddItem<T>(T item)
|
||||||
|
{
|
||||||
|
if (item == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int rowIndex = dataGridView.Rows.Add();
|
||||||
|
|
||||||
|
foreach (var property in typeof(T).GetProperties())
|
||||||
|
{
|
||||||
|
var value = property.GetValue(item);
|
||||||
|
dataGridView.Rows[rowIndex].Cells[property.Name].Value = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -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>
|
58
YunusovComponentsLibrary/YunusovComponentsLibrary/SelectedComponent.Designer.cs
generated
Normal file
58
YunusovComponentsLibrary/YunusovComponentsLibrary/SelectedComponent.Designer.cs
generated
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
namespace YunusovComponentsLibrary
|
||||||
|
{
|
||||||
|
partial class SelectedComponent
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
listBox = new ListBox();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// listBox
|
||||||
|
//
|
||||||
|
listBox.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
listBox.FormattingEnabled = true;
|
||||||
|
listBox.ItemHeight = 20;
|
||||||
|
listBox.Location = new Point(3, 3);
|
||||||
|
listBox.Name = "listBox";
|
||||||
|
listBox.Size = new Size(125, 164);
|
||||||
|
listBox.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// SelectedComponent
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
Controls.Add(listBox);
|
||||||
|
Name = "SelectedComponent";
|
||||||
|
Size = new Size(131, 181);
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private ListBox listBox;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,45 @@
|
|||||||
|
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 YunusovComponentsLibrary
|
||||||
|
{
|
||||||
|
public partial class SelectedComponent : UserControl
|
||||||
|
{
|
||||||
|
private event EventHandler _itemSelected;
|
||||||
|
public SelectedComponent()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
public void Input(string str)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(str))
|
||||||
|
throw new ArgumentNullException("input");
|
||||||
|
listBox.Items.Add(str);
|
||||||
|
}
|
||||||
|
public void ClearList()
|
||||||
|
{
|
||||||
|
listBox.Items.Clear();
|
||||||
|
}
|
||||||
|
public string SelectedItem
|
||||||
|
{
|
||||||
|
get { return (string)listBox.SelectedItem ?? string.Empty; }
|
||||||
|
set { listBox.SelectedItem = value; }
|
||||||
|
}
|
||||||
|
public event EventHandler? ItemSelected
|
||||||
|
{
|
||||||
|
add { _itemSelected += value; }
|
||||||
|
remove { _itemSelected -= value; }
|
||||||
|
}
|
||||||
|
private void listBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_itemSelected?.Invoke(this, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -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>
|
73
YunusovComponentsLibrary/YunusovComponentsLibrary/Testing.Designer.cs
generated
Normal file
73
YunusovComponentsLibrary/YunusovComponentsLibrary/Testing.Designer.cs
generated
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
namespace YunusovComponentsLibrary
|
||||||
|
{
|
||||||
|
partial class Testing
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
pictureBox = new PictureBox();
|
||||||
|
button = new Button();
|
||||||
|
((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// pictureBox
|
||||||
|
//
|
||||||
|
pictureBox.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
pictureBox.Location = new Point(3, 3);
|
||||||
|
pictureBox.Name = "pictureBox";
|
||||||
|
pictureBox.Size = new Size(187, 150);
|
||||||
|
pictureBox.TabIndex = 0;
|
||||||
|
pictureBox.TabStop = false;
|
||||||
|
//
|
||||||
|
// button
|
||||||
|
//
|
||||||
|
button.Anchor = AnchorStyles.Bottom;
|
||||||
|
button.Location = new Point(49, 156);
|
||||||
|
button.Name = "button";
|
||||||
|
button.Size = new Size(94, 29);
|
||||||
|
button.TabIndex = 1;
|
||||||
|
button.Text = "Загрузить";
|
||||||
|
button.UseVisualStyleBackColor = true;
|
||||||
|
button.Click += button_Click;
|
||||||
|
//
|
||||||
|
// Testing
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
Controls.Add(button);
|
||||||
|
Controls.Add(pictureBox);
|
||||||
|
Name = "Testing";
|
||||||
|
Size = new Size(193, 188);
|
||||||
|
((System.ComponentModel.ISupportInitialize)pictureBox).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private PictureBox pictureBox;
|
||||||
|
private Button button;
|
||||||
|
}
|
||||||
|
}
|
68
YunusovComponentsLibrary/YunusovComponentsLibrary/Testing.cs
Normal file
68
YunusovComponentsLibrary/YunusovComponentsLibrary/Testing.cs
Normal file
@ -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;
|
||||||
|
|
||||||
|
namespace YunusovComponentsLibrary
|
||||||
|
{
|
||||||
|
public partial class Testing : UserControl
|
||||||
|
{
|
||||||
|
private event EventHandler? _avatarChanged;
|
||||||
|
private event Action? _errorOccured;
|
||||||
|
public string Error { get; private set; }
|
||||||
|
public Image Avatar
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return pictureBox.Image;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
pictureBox.Image = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public event EventHandler AvatarChanged
|
||||||
|
{
|
||||||
|
add { _avatarChanged += value; }
|
||||||
|
remove { _avatarChanged -= value; }
|
||||||
|
}
|
||||||
|
public event Action AnErrorOccurred
|
||||||
|
{
|
||||||
|
add { _errorOccured += value; }
|
||||||
|
remove { _errorOccured -= value; }
|
||||||
|
}
|
||||||
|
public Testing()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
Error = string.Empty;
|
||||||
|
}
|
||||||
|
private void ButtonLoad_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var ofd = new OpenFileDialog();
|
||||||
|
if (ofd.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
pictureBox.Image =
|
||||||
|
Image.FromFile(ofd.FileName);
|
||||||
|
_avatarChanged?.Invoke(this, e);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Error = ex.Message;
|
||||||
|
_errorOccured?.Invoke();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void button_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
YunusovComponentsLibrary/YunusovComponentsLibrary/Testing.resx
Normal file
120
YunusovComponentsLibrary/YunusovComponentsLibrary/Testing.resx
Normal 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>
|
@ -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>
|
Loading…
Reference in New Issue
Block a user