Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9e89370e0c | |||
| 09263c1e14 | |||
| 2d2a534a39 | |||
| 037a67c1d2 | |||
| eac3b572d7 | |||
| 2766f696df | |||
| 4cadabee22 | |||
| 7a727f4099 |
21
Valova_App/Book.cs
Normal file
21
Valova_App/Book.cs
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Valova_App
|
||||||
|
{
|
||||||
|
public class Book
|
||||||
|
{
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string Author { get; set; }
|
||||||
|
|
||||||
|
public Book(string author, string name)
|
||||||
|
{
|
||||||
|
Author = author;
|
||||||
|
Name = name;
|
||||||
|
}
|
||||||
|
public Book() { }
|
||||||
|
}
|
||||||
|
}
|
||||||
213
Valova_App/Form1.Designer.cs
generated
Normal file
213
Valova_App/Form1.Designer.cs
generated
Normal file
@@ -0,0 +1,213 @@
|
|||||||
|
namespace Valova_App
|
||||||
|
{
|
||||||
|
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()
|
||||||
|
{
|
||||||
|
valovaComboBox = new Valova_VisualComponents.ValovaComboBox();
|
||||||
|
valovaTextBox = new Valova_VisualComponents.ValovaTextBox();
|
||||||
|
valovaListBox = new Valova_VisualComponents.ValovaListBox();
|
||||||
|
buttonAddToComboBox = new Button();
|
||||||
|
buttonClearComboBox = new Button();
|
||||||
|
textBoxForComboBox = new TextBox();
|
||||||
|
buttonCheckComboBox = new Button();
|
||||||
|
buttonGetTextBox = new Button();
|
||||||
|
textBoxAuthor = new TextBox();
|
||||||
|
textBoxName = new TextBox();
|
||||||
|
textBoxRow = new TextBox();
|
||||||
|
textBoxPar = new TextBox();
|
||||||
|
button1 = new Button();
|
||||||
|
buttonGet = new Button();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// valovaComboBox
|
||||||
|
//
|
||||||
|
valovaComboBox.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
valovaComboBox.Location = new Point(31, 12);
|
||||||
|
valovaComboBox.Name = "valovaComboBox";
|
||||||
|
valovaComboBox.SelectedValue = "";
|
||||||
|
valovaComboBox.Size = new Size(152, 150);
|
||||||
|
valovaComboBox.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// valovaTextBox
|
||||||
|
//
|
||||||
|
valovaTextBox.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
valovaTextBox.Location = new Point(236, 12);
|
||||||
|
valovaTextBox.Name = "valovaTextBox";
|
||||||
|
valovaTextBox.Pattern = null;
|
||||||
|
valovaTextBox.Size = new Size(161, 148);
|
||||||
|
valovaTextBox.TabIndex = 1;
|
||||||
|
valovaTextBox.Load += valovaTextBox1_Load;
|
||||||
|
//
|
||||||
|
// valovaListBox
|
||||||
|
//
|
||||||
|
valovaListBox.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
valovaListBox.Location = new Point(456, 12);
|
||||||
|
valovaListBox.Name = "valovaListBox";
|
||||||
|
valovaListBox.SelectedIndex = -1;
|
||||||
|
valovaListBox.Size = new Size(321, 150);
|
||||||
|
valovaListBox.TabIndex = 2;
|
||||||
|
valovaListBox.Load += valovaListBox_Load;
|
||||||
|
//
|
||||||
|
// buttonAddToComboBox
|
||||||
|
//
|
||||||
|
buttonAddToComboBox.Location = new Point(31, 196);
|
||||||
|
buttonAddToComboBox.Name = "buttonAddToComboBox";
|
||||||
|
buttonAddToComboBox.Size = new Size(152, 32);
|
||||||
|
buttonAddToComboBox.TabIndex = 3;
|
||||||
|
buttonAddToComboBox.Text = "Add item";
|
||||||
|
buttonAddToComboBox.UseVisualStyleBackColor = true;
|
||||||
|
buttonAddToComboBox.Click += buttonAddToComboBox_Click;
|
||||||
|
//
|
||||||
|
// buttonClearComboBox
|
||||||
|
//
|
||||||
|
buttonClearComboBox.Location = new Point(31, 234);
|
||||||
|
buttonClearComboBox.Name = "buttonClearComboBox";
|
||||||
|
buttonClearComboBox.Size = new Size(152, 32);
|
||||||
|
buttonClearComboBox.TabIndex = 4;
|
||||||
|
buttonClearComboBox.Text = "Clear";
|
||||||
|
buttonClearComboBox.UseVisualStyleBackColor = true;
|
||||||
|
buttonClearComboBox.Click += buttonClearComboBox_Click;
|
||||||
|
//
|
||||||
|
// textBoxForComboBox
|
||||||
|
//
|
||||||
|
textBoxForComboBox.Location = new Point(31, 168);
|
||||||
|
textBoxForComboBox.Name = "textBoxForComboBox";
|
||||||
|
textBoxForComboBox.Size = new Size(152, 23);
|
||||||
|
textBoxForComboBox.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// buttonCheckComboBox
|
||||||
|
//
|
||||||
|
buttonCheckComboBox.Location = new Point(31, 272);
|
||||||
|
buttonCheckComboBox.Name = "buttonCheckComboBox";
|
||||||
|
buttonCheckComboBox.Size = new Size(152, 32);
|
||||||
|
buttonCheckComboBox.TabIndex = 6;
|
||||||
|
buttonCheckComboBox.Text = "Check";
|
||||||
|
buttonCheckComboBox.UseVisualStyleBackColor = true;
|
||||||
|
buttonCheckComboBox.Click += buttonCheckComboBox_Click;
|
||||||
|
//
|
||||||
|
// buttonGetTextBox
|
||||||
|
//
|
||||||
|
buttonGetTextBox.Location = new Point(236, 168);
|
||||||
|
buttonGetTextBox.Name = "buttonGetTextBox";
|
||||||
|
buttonGetTextBox.Size = new Size(161, 32);
|
||||||
|
buttonGetTextBox.TabIndex = 8;
|
||||||
|
buttonGetTextBox.Text = "Get";
|
||||||
|
buttonGetTextBox.UseVisualStyleBackColor = true;
|
||||||
|
buttonGetTextBox.Click += buttonGetTextBox_Click;
|
||||||
|
//
|
||||||
|
// textBoxAuthor
|
||||||
|
//
|
||||||
|
textBoxAuthor.Location = new Point(456, 177);
|
||||||
|
textBoxAuthor.Name = "textBoxAuthor";
|
||||||
|
textBoxAuthor.Size = new Size(148, 23);
|
||||||
|
textBoxAuthor.TabIndex = 9;
|
||||||
|
//
|
||||||
|
// textBoxName
|
||||||
|
//
|
||||||
|
textBoxName.Location = new Point(610, 177);
|
||||||
|
textBoxName.Name = "textBoxName";
|
||||||
|
textBoxName.Size = new Size(167, 23);
|
||||||
|
textBoxName.TabIndex = 10;
|
||||||
|
//
|
||||||
|
// textBoxRow
|
||||||
|
//
|
||||||
|
textBoxRow.Location = new Point(456, 240);
|
||||||
|
textBoxRow.Name = "textBoxRow";
|
||||||
|
textBoxRow.Size = new Size(32, 23);
|
||||||
|
textBoxRow.TabIndex = 11;
|
||||||
|
//
|
||||||
|
// textBoxPar
|
||||||
|
//
|
||||||
|
textBoxPar.Location = new Point(494, 240);
|
||||||
|
textBoxPar.Name = "textBoxPar";
|
||||||
|
textBoxPar.Size = new Size(148, 23);
|
||||||
|
textBoxPar.TabIndex = 12;
|
||||||
|
//
|
||||||
|
// button1
|
||||||
|
//
|
||||||
|
button1.Location = new Point(648, 234);
|
||||||
|
button1.Name = "button1";
|
||||||
|
button1.Size = new Size(100, 32);
|
||||||
|
button1.TabIndex = 13;
|
||||||
|
button1.Text = "Add";
|
||||||
|
button1.UseVisualStyleBackColor = true;
|
||||||
|
button1.Click += button1_Click;
|
||||||
|
//
|
||||||
|
// buttonGet
|
||||||
|
//
|
||||||
|
buttonGet.Location = new Point(567, 287);
|
||||||
|
buttonGet.Name = "buttonGet";
|
||||||
|
buttonGet.Size = new Size(100, 32);
|
||||||
|
buttonGet.TabIndex = 14;
|
||||||
|
buttonGet.Text = "Get";
|
||||||
|
buttonGet.UseVisualStyleBackColor = true;
|
||||||
|
buttonGet.Click += buttonGet_Click;
|
||||||
|
//
|
||||||
|
// Form1
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(800, 450);
|
||||||
|
Controls.Add(buttonGet);
|
||||||
|
Controls.Add(button1);
|
||||||
|
Controls.Add(textBoxPar);
|
||||||
|
Controls.Add(textBoxRow);
|
||||||
|
Controls.Add(textBoxName);
|
||||||
|
Controls.Add(textBoxAuthor);
|
||||||
|
Controls.Add(buttonGetTextBox);
|
||||||
|
Controls.Add(buttonCheckComboBox);
|
||||||
|
Controls.Add(textBoxForComboBox);
|
||||||
|
Controls.Add(buttonClearComboBox);
|
||||||
|
Controls.Add(buttonAddToComboBox);
|
||||||
|
Controls.Add(valovaListBox);
|
||||||
|
Controls.Add(valovaTextBox);
|
||||||
|
Controls.Add(valovaComboBox);
|
||||||
|
Name = "Form1";
|
||||||
|
Text = "Form1";
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Valova_VisualComponents.ValovaComboBox valovaComboBox;
|
||||||
|
private Valova_VisualComponents.ValovaTextBox valovaTextBox;
|
||||||
|
private Valova_VisualComponents.ValovaListBox valovaListBox;
|
||||||
|
private Button buttonAddToComboBox;
|
||||||
|
private Button buttonClearComboBox;
|
||||||
|
private TextBox textBoxForComboBox;
|
||||||
|
private Button buttonCheckComboBox;
|
||||||
|
private Button buttonGetTextBox;
|
||||||
|
private TextBox textBoxAuthor;
|
||||||
|
private TextBox textBoxName;
|
||||||
|
private TextBox textBoxRow;
|
||||||
|
private TextBox textBoxPar;
|
||||||
|
private Button button1;
|
||||||
|
private Button buttonGet;
|
||||||
|
}
|
||||||
|
}
|
||||||
70
Valova_App/Form1.cs
Normal file
70
Valova_App/Form1.cs
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
using Valova_VisualComponents;
|
||||||
|
|
||||||
|
namespace Valova_App
|
||||||
|
{
|
||||||
|
public partial class Form1 : Form
|
||||||
|
{
|
||||||
|
|
||||||
|
public Form1()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
valovaComboBox.Items.AddRange(new String[] { "1 example", "2 example", "3 example", "4 example" });
|
||||||
|
|
||||||
|
valovaTextBox.Pattern = @"^\+7\(\d{3}\)\d{3}-\d{2}-\d{2}$";
|
||||||
|
valovaTextBox.SetExample("+7(927)000-00-00");
|
||||||
|
|
||||||
|
valovaListBox.SetLayout("My favorite book is {Author} {Name}", "{", "}");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void valovaTextBox1_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonAddToComboBox_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!String.IsNullOrEmpty(textBoxForComboBox.Text))
|
||||||
|
{
|
||||||
|
valovaComboBox.Items.Add(textBoxForComboBox.Text);
|
||||||
|
textBoxForComboBox.Clear();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Insert text");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonClearComboBox_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
valovaComboBox.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonCheckComboBox_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
textBoxForComboBox.Text = valovaComboBox.SelectedValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonGetTextBox_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
MessageBox.Show(valovaTextBox.TextBoxValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void valovaListBox_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void button1_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Book newBook = new Book(textBoxAuthor.Text, textBoxName.Text);
|
||||||
|
|
||||||
|
valovaListBox.AddItemInList(newBook, int.Parse(textBoxRow.Text), textBoxPar.Text);
|
||||||
|
}
|
||||||
|
private void buttonGet_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Book b = valovaListBox.GetItemFromList<Book>();
|
||||||
|
MessageBox.Show(b.Author + " " + b.Name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
120
Valova_App/Form1.resx
Normal file
120
Valova_App/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
Valova_App/Program.cs
Normal file
17
Valova_App/Program.cs
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
namespace Valova_App
|
||||||
|
{
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
15
Valova_App/Valova_App.csproj
Normal file
15
Valova_App/Valova_App.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="..\Valova_VisualComponents\Valova_VisualComponents\Valova_VisualComponents.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
31
Valova_VisualComponents/Valova_VisualComponents.sln
Normal file
31
Valova_VisualComponents/Valova_VisualComponents.sln
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.9.34723.18
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Valova_VisualComponents", "Valova_VisualComponents\Valova_VisualComponents.csproj", "{23CBD69E-2876-4A20-996F-4230AD3E642A}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Valova_App", "..\Valova_App\Valova_App.csproj", "{EF001CCD-92F6-4A12-AC58-39CFF673A16B}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{23CBD69E-2876-4A20-996F-4230AD3E642A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{23CBD69E-2876-4A20-996F-4230AD3E642A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{23CBD69E-2876-4A20-996F-4230AD3E642A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{23CBD69E-2876-4A20-996F-4230AD3E642A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{EF001CCD-92F6-4A12-AC58-39CFF673A16B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{EF001CCD-92F6-4A12-AC58-39CFF673A16B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{EF001CCD-92F6-4A12-AC58-39CFF673A16B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{EF001CCD-92F6-4A12-AC58-39CFF673A16B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {8560DD17-BEB9-41F4-9FC5-FA6D16222CB6}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Valova_VisualComponents
|
||||||
|
{
|
||||||
|
public class InvalidLayoutException : ApplicationException
|
||||||
|
{
|
||||||
|
public InvalidLayoutException() : base("Значение не соответсвует шаблону") { }
|
||||||
|
public InvalidLayoutException(string message) : base(message) { }
|
||||||
|
public InvalidLayoutException(string message, Exception exception) : base(message, exception) { }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Valova_VisualComponents
|
||||||
|
{
|
||||||
|
public class PatternNotSetException : ApplicationException
|
||||||
|
{
|
||||||
|
public PatternNotSetException() : base("Шаблон не задан") { }
|
||||||
|
public PatternNotSetException(string message) : base(message) { }
|
||||||
|
public PatternNotSetException(string message, Exception exception) : base(message, exception) { }
|
||||||
|
}
|
||||||
|
}
|
||||||
57
Valova_VisualComponents/Valova_VisualComponents/ValovaComboBox.Designer.cs
generated
Normal file
57
Valova_VisualComponents/Valova_VisualComponents/ValovaComboBox.Designer.cs
generated
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
namespace Valova_VisualComponents
|
||||||
|
{
|
||||||
|
partial class ValovaComboBox
|
||||||
|
{
|
||||||
|
/// <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.FormattingEnabled = true;
|
||||||
|
comboBox.Location = new Point(3, 3);
|
||||||
|
comboBox.Name = "comboBox";
|
||||||
|
comboBox.Size = new Size(144, 23);
|
||||||
|
comboBox.TabIndex = 0;
|
||||||
|
comboBox.SelectedIndexChanged += comboBox_SelectedIndexChanged;
|
||||||
|
//
|
||||||
|
// ValovaComboBox
|
||||||
|
//
|
||||||
|
BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
Controls.Add(comboBox);
|
||||||
|
Name = "ValovaComboBox";
|
||||||
|
Size = new Size(148, 148);
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
private ComboBox comboBox;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
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 Valova_VisualComponents
|
||||||
|
{
|
||||||
|
public partial class ValovaComboBox : UserControl
|
||||||
|
{
|
||||||
|
public ComboBox.ObjectCollection Items => comboBox.Items;
|
||||||
|
|
||||||
|
public event EventHandler _сhangeEvent;
|
||||||
|
|
||||||
|
public event EventHandler ChangeEvent
|
||||||
|
{
|
||||||
|
add
|
||||||
|
{
|
||||||
|
_сhangeEvent += value;
|
||||||
|
|
||||||
|
}
|
||||||
|
remove
|
||||||
|
{
|
||||||
|
_сhangeEvent -= value;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public ValovaComboBox()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public string SelectedValue
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return comboBox.SelectedItem.ToString() ?? string.Empty;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
comboBox.SelectedIndex = comboBox.Items.IndexOf(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Clear()
|
||||||
|
{
|
||||||
|
Items.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void comboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_сhangeEvent?.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>
|
||||||
58
Valova_VisualComponents/Valova_VisualComponents/ValovaListBox.Designer.cs
generated
Normal file
58
Valova_VisualComponents/Valova_VisualComponents/ValovaListBox.Designer.cs
generated
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
namespace Valova_VisualComponents
|
||||||
|
{
|
||||||
|
partial class ValovaListBox
|
||||||
|
{
|
||||||
|
/// <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.FormattingEnabled = true;
|
||||||
|
listBox.ItemHeight = 15;
|
||||||
|
listBox.Location = new Point(2, 11);
|
||||||
|
listBox.Name = "listBox";
|
||||||
|
listBox.Size = new Size(314, 109);
|
||||||
|
listBox.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// ValovaListBox
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
Controls.Add(listBox);
|
||||||
|
Name = "ValovaListBox";
|
||||||
|
Size = new Size(319, 148);
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private ListBox listBox;
|
||||||
|
}
|
||||||
|
}
|
||||||
113
Valova_VisualComponents/Valova_VisualComponents/ValovaListBox.cs
Normal file
113
Valova_VisualComponents/Valova_VisualComponents/ValovaListBox.cs
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
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 Valova_VisualComponents
|
||||||
|
{
|
||||||
|
public partial class ValovaListBox : UserControl
|
||||||
|
{
|
||||||
|
private string LayoutString;
|
||||||
|
private string StartS;
|
||||||
|
private string EndS;
|
||||||
|
private int SelectedStr;
|
||||||
|
|
||||||
|
public ValovaListBox()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int SelectedIndex
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (listBox.SelectedIndex == -1)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return listBox.SelectedIndex;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (listBox.Items.Count != 0)
|
||||||
|
{
|
||||||
|
listBox.SelectedIndex = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void SetLayout(string layoutString, string startS, string endS)
|
||||||
|
{
|
||||||
|
if (layoutString == null || startS == null || endS == null) return;
|
||||||
|
LayoutString = layoutString;
|
||||||
|
StartS = startS;
|
||||||
|
EndS = endS;
|
||||||
|
}
|
||||||
|
public void AddItemInList<T>(T obj, int rowIndex, string propertyName)
|
||||||
|
{
|
||||||
|
if (obj == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (listBox.Items.Count <= rowIndex)
|
||||||
|
{
|
||||||
|
for (int i = listBox.Items.Count; i <= rowIndex; i++)
|
||||||
|
{
|
||||||
|
listBox.Items.Add(LayoutString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
string str = listBox.Items[rowIndex].ToString();
|
||||||
|
|
||||||
|
var properties = obj.GetType().GetProperties();
|
||||||
|
var prop = properties.FirstOrDefault(p => p.Name.Equals(propertyName, StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
|
if (prop != null)
|
||||||
|
{
|
||||||
|
string str1 = $"{StartS}{prop.Name}{EndS}";
|
||||||
|
str = str.Replace(str1, $"{StartS}{prop.GetValue(obj)?.ToString()}{EndS}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new ArgumentException($"Свойство с именем '{propertyName}' не найдено в объекте.");
|
||||||
|
}
|
||||||
|
|
||||||
|
listBox.Items[rowIndex] = str;
|
||||||
|
}
|
||||||
|
|
||||||
|
public T GetItemFromList<T>() where T : class, new()
|
||||||
|
{
|
||||||
|
string SelectedStr = "";
|
||||||
|
if (listBox.SelectedIndex != -1)
|
||||||
|
{
|
||||||
|
SelectedStr = listBox.SelectedItem.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
T currentObject = new T();
|
||||||
|
|
||||||
|
foreach (var prop in typeof(T).GetProperties())
|
||||||
|
{
|
||||||
|
if (!prop.CanWrite)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
int startS = SelectedStr.IndexOf(StartS);
|
||||||
|
int endS = SelectedStr.IndexOf(EndS);
|
||||||
|
if (startS == -1 || endS == -1)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
string propValue = SelectedStr.Substring(startS + 1, endS - startS - 1);
|
||||||
|
SelectedStr = SelectedStr.Substring(endS + 1);
|
||||||
|
prop.SetValue(currentObject, Convert.ChangeType(propValue, prop.PropertyType));
|
||||||
|
}
|
||||||
|
return currentObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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>
|
||||||
59
Valova_VisualComponents/Valova_VisualComponents/ValovaTextBox.Designer.cs
generated
Normal file
59
Valova_VisualComponents/Valova_VisualComponents/ValovaTextBox.Designer.cs
generated
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
namespace Valova_VisualComponents
|
||||||
|
{
|
||||||
|
partial class ValovaTextBox
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
textBox = new TextBox();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// textBox
|
||||||
|
//
|
||||||
|
textBox.Location = new Point(-1, 18);
|
||||||
|
textBox.Name = "textBox";
|
||||||
|
textBox.Size = new Size(161, 23);
|
||||||
|
textBox.TabIndex = 0;
|
||||||
|
textBox.TextChanged += textBox_TextChanged;
|
||||||
|
textBox.Enter += textBox_Enter;
|
||||||
|
//
|
||||||
|
// ValovaTextBox
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
Controls.Add(textBox);
|
||||||
|
Name = "ValovaTextBox";
|
||||||
|
Size = new Size(159, 146);
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private TextBox textBox;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace Valova_VisualComponents
|
||||||
|
{
|
||||||
|
public partial class ValovaTextBox : UserControl
|
||||||
|
{
|
||||||
|
private string? pattern;
|
||||||
|
private string example = "+7(XXX)XXX-XX-XX";
|
||||||
|
public ValovaTextBox()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public string? Pattern
|
||||||
|
{
|
||||||
|
get { return pattern; }
|
||||||
|
set { pattern = value; }
|
||||||
|
}
|
||||||
|
public string TextBoxValue
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(Pattern))
|
||||||
|
throw new PatternNotSetException();
|
||||||
|
|
||||||
|
Regex regex = new Regex(Pattern);
|
||||||
|
bool isValid = regex.IsMatch(textBox.Text);
|
||||||
|
if (isValid)
|
||||||
|
{
|
||||||
|
return textBox.Text;
|
||||||
|
}
|
||||||
|
else throw new InvalidLayoutException();
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
Regex regex = new Regex(Pattern);
|
||||||
|
bool isValid = regex.IsMatch(value);
|
||||||
|
if (isValid)
|
||||||
|
{
|
||||||
|
textBox.Text = value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Error = "Неправильно";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Error
|
||||||
|
{
|
||||||
|
get; private set;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetExample(string exampleStr)
|
||||||
|
{
|
||||||
|
Regex regex = new Regex(Pattern);
|
||||||
|
bool isValid = regex.IsMatch(exampleStr);
|
||||||
|
if (isValid)
|
||||||
|
{
|
||||||
|
example = exampleStr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void textBox_Enter(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
ToolTip tt = new ToolTip();
|
||||||
|
tt.Show(example, textBox, 20, -21, 2000);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void textBox_TextChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_changeEvent?.Invoke(sender, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
private EventHandler _changeEvent;
|
||||||
|
|
||||||
|
public event EventHandler ChangeEvent
|
||||||
|
{
|
||||||
|
add
|
||||||
|
{
|
||||||
|
_changeEvent += value;
|
||||||
|
}
|
||||||
|
remove
|
||||||
|
{
|
||||||
|
_changeEvent -= 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>
|
||||||
@@ -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>
|
||||||
Reference in New Issue
Block a user