Compare commits

..

No commits in common. "lab1" and "main" have entirely different histories.
lab1 ... main

21 changed files with 0 additions and 1481 deletions

View File

@ -5,8 +5,6 @@ VisualStudioVersion = 17.9.34714.143
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ComponentProgramming", "ComponentProgramming\ComponentProgramming.csproj", "{97AC6509-906E-4688-9C6F-67406629A6CA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Forms", "Forms\Forms.csproj", "{A490A64E-3A3B-4782-B0DB-142543BDC6A5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -17,10 +15,6 @@ Global
{97AC6509-906E-4688-9C6F-67406629A6CA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{97AC6509-906E-4688-9C6F-67406629A6CA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{97AC6509-906E-4688-9C6F-67406629A6CA}.Release|Any CPU.Build.0 = Release|Any CPU
{A490A64E-3A3B-4782-B0DB-142543BDC6A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A490A64E-3A3B-4782-B0DB-142543BDC6A5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A490A64E-3A3B-4782-B0DB-142543BDC6A5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A490A64E-3A3B-4782-B0DB-142543BDC6A5}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -1,61 +0,0 @@
namespace ComponentProgramming
{
partial class ControlComboBox
{
/// <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()
{
comboBoxElements = new ComboBox();
SuspendLayout();
//
// comboBoxElements
//
comboBoxElements.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
comboBoxElements.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxElements.FormattingEnabled = true;
comboBoxElements.Location = new Point(5, 4);
comboBoxElements.Margin = new Padding(3, 4, 3, 4);
comboBoxElements.Name = "comboBoxElements";
comboBoxElements.Size = new Size(194, 28);
comboBoxElements.TabIndex = 0;
comboBoxElements.SelectedIndexChanged += comboBoxElements_SelectedIndexChanged;
//
// ControlComboBox
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
Controls.Add(comboBoxElements);
Margin = new Padding(3, 4, 3, 4);
Name = "ControlComboBox";
Size = new Size(202, 39);
ResumeLayout(false);
}
#endregion
private ComboBox comboBoxElements;
}
}

View File

@ -1,60 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Runtime.InteropServices.JavaScript.JSType;
namespace ComponentProgramming
{
public partial class ControlComboBox : UserControl
{
private event EventHandler? _comboBoxChanged;
public string SelectedItem
{
get
{
if (comboBoxElements.SelectedItem == null)
{
return "";
}
return comboBoxElements.SelectedItem.ToString()!;
}
set
{
comboBoxElements.SelectedItem = value;
}
}
public event EventHandler ComboBoxChanged
{
add { _comboBoxChanged += value; }
remove { _comboBoxChanged -= value; }
}
public ControlComboBox()
{
InitializeComponent();
}
public ComboBox.ObjectCollection ComboBoxItems
{
get { return comboBoxElements.Items; }
}
public void ClearComboBox()
{
comboBoxElements.Items.Clear();
}
private void comboBoxElements_SelectedIndexChanged(object sender, EventArgs e)
{
_comboBoxChanged?.Invoke(this, e);
}
}
}

View File

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

View File

@ -1,72 +0,0 @@
namespace ComponentProgramming
{
partial class ControlImage
{
/// <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()
{
pictureBoxAvatar = new PictureBox();
buttonLoad = new Button();
((System.ComponentModel.ISupportInitialize)pictureBoxAvatar).BeginInit();
SuspendLayout();
//
// pictureBoxAvatar
//
pictureBoxAvatar.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
pictureBoxAvatar.Location = new Point(3, 3);
pictureBoxAvatar.Name = "pictureBoxAvatar";
pictureBoxAvatar.Size = new Size(144, 115);
pictureBoxAvatar.TabIndex = 0;
pictureBoxAvatar.TabStop = false;
//
// buttonLoad
//
buttonLoad.Anchor = AnchorStyles.Bottom;
buttonLoad.Location = new Point(35, 124);
buttonLoad.Name = "buttonLoad";
buttonLoad.Size = new Size(75, 23);
buttonLoad.TabIndex = 1;
buttonLoad.Text = "Загрузить";
buttonLoad.UseVisualStyleBackColor = true;
buttonLoad.Click += buttonLoad_Click;
//
// Control
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
Controls.Add(buttonLoad);
Controls.Add(pictureBoxAvatar);
Name = "Control";
((System.ComponentModel.ISupportInitialize)pictureBoxAvatar).EndInit();
ResumeLayout(false);
}
#endregion
private PictureBox pictureBoxAvatar;
private Button buttonLoad;
}
}

View File

@ -1,67 +0,0 @@
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 ComponentProgramming
{
public partial class ControlImage : UserControl
{
private event EventHandler? _avatarChanged;
private event Action? _errorOccured;
public string Error { get; private set; }
public Image Avatar
{
get
{
return pictureBoxAvatar.Image;
}
set
{
pictureBoxAvatar.Image = value;
}
}
public event EventHandler AvatarChanged
{
add { _avatarChanged += value; }
remove { _avatarChanged -= value; }
}
public event Action AnErrorOccured
{
add { _errorOccured += value; }
remove { _errorOccured -= value; }
}
public ControlImage()
{
InitializeComponent();
Error = string.Empty;
}
private void buttonLoad_Click(object sender, EventArgs e)
{
var ofd = new OpenFileDialog();
if(ofd.ShowDialog() == DialogResult.OK)
{
try
{
pictureBoxAvatar.Image = Image.FromFile(ofd.FileName);
pictureBoxAvatar.Width = pictureBoxAvatar.Image.Width;
_avatarChanged?.Invoke(this, e);
}
catch( Exception ex)
{
Error = ex.Message;
_errorOccured?.Invoke();
}
}
}
}
}

View File

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

View File

@ -1,58 +0,0 @@
namespace ComponentProgramming
{
partial class ControlListBox
{
/// <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.Dock = DockStyle.Fill;
listBox.FormattingEnabled = true;
listBox.ItemHeight = 15;
listBox.Location = new Point(0, 0);
listBox.Name = "listBox";
listBox.Size = new Size(520, 312);
listBox.TabIndex = 0;
//
// ControlListBox
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
Controls.Add(listBox);
Name = "ControlListBox";
Size = new Size(520, 312);
ResumeLayout(false);
}
#endregion
private ListBox listBox;
}
}

View File

@ -1,116 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ComponentProgramming
{
public partial class ControlListBox : UserControl
{
public ControlListBox()
{
InitializeComponent();
}
private string _templateString;
private string _startSymbol;
private string _endSymbol;
public void SetTemplateString(string templateString, string startSymbol, string endSymbol)
{
if(templateString != "" && startSymbol != "" && endSymbol != "")
{
_startSymbol = startSymbol;
_endSymbol = endSymbol;
_templateString = templateString;
}
else
{
throw new ArgumentNullException("Введите все значения");
}
}
public int GetIndex
{
get { return listBox.SelectedIndex; }
set
{
if(listBox.SelectedIndex != 0)
{
listBox.SelectedIndex = value;
}
}
}
public T? GetSelectedObject<T>() where T : class, new()
{
if(listBox.SelectedIndex == -1)
{
return null;
}
string row = listBox.SelectedItem!.ToString()!;
T obj = new T();
List<string> substrings = new List<string>();
List<string> props = new List<string>();
string template = _templateString;
foreach (var prop in typeof(T).GetProperties())
{
props.Add(prop.Name);
template = template.Replace(prop.Name, "");
}
substrings.AddRange(template.Split(_startSymbol + _endSymbol));
int int1 = 0; int int2 = 0;
foreach (var prop in typeof(T).GetProperties())
{
for (int i = 0; i <= substrings.Count - 2; i++)
{
int1 = row.IndexOf(substrings[i]) + substrings[i].Length;
int2 = row.IndexOf(substrings[i + 1]);
if (substrings[i+1] == "")
{
int2 = row.Length;
}
if (props[i] == prop.Name)
{
var value = row[int1..int2];
if (value.Contains(prop.Name))
{
value = null;
}
prop.SetValue(obj, Convert.ChangeType(value, prop.PropertyType));
}
}
}
return obj;
}
public void FillProp<T>(T dataObj, int rowIndex, string propName)
{
while (listBox.Items.Count <= rowIndex)
{
listBox.Items.Add(_templateString);
}
string row = listBox.Items[rowIndex].ToString()!;
PropertyInfo propInfo = dataObj!.GetType().GetProperty(propName)!;
if(propInfo != null)
{
object propValue = propInfo.GetValue(dataObj)!;
row = row.Replace($"{_startSymbol}{propName}{_endSymbol}", $"{propValue.ToString()}");
listBox.Items[rowIndex] = row;
}
}
}
}

View File

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

View File

@ -1,60 +0,0 @@
namespace ComponentProgramming
{
partial class ControlTextBox
{
/// <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(3, 4);
textBox.Margin = new Padding(3, 4, 3, 4);
textBox.Name = "textBox";
textBox.PlaceholderText = "+79063211213";
textBox.Size = new Size(133, 27);
textBox.TabIndex = 0;
textBox.TextChanged += textBox_TextChanged;
//
// ControlTextBox
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
Controls.Add(textBox);
Margin = new Padding(3, 4, 3, 4);
Name = "ControlTextBox";
Size = new Size(138, 34);
ResumeLayout(false);
PerformLayout();
}
#endregion
private TextBox textBox;
}
}

View File

@ -1,75 +0,0 @@
using ComponentProgramming.Exceptions;
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 ComponentProgramming
{
public partial class ControlTextBox : UserControl
{
public ControlTextBox()
{
InitializeComponent();
}
private string? _numPuttern;
public string? NumPattern
{
get { return _numPuttern; }
set { _numPuttern = value!; }
}
public string? text
{
get
{
if (_numPuttern == null)
{
throw new NumberException("Стандарт не задан!");
}
Regex regex = new(_numPuttern);
if (regex.IsMatch(textBox.Text))
{
return textBox.Text;
}
else
{
throw new NumberException(textBox.Text + " не соответствует стандарту!");
}
}
set
{
if (_numPuttern == null)
{
return;
}
Regex regex = new(_numPuttern!);
if (regex.IsMatch(value!))
{
textBox.Text = value;
}
}
}
private event EventHandler? _textBoxChanged;
public event EventHandler TextBoxChanged
{
add { _textBoxChanged += value; }
remove { _textBoxChanged -= value; }
}
private void textBox_TextChanged(object sender, EventArgs e)
{
_textBoxChanged?.Invoke(this, e);
}
}
}

View File

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

View File

@ -1,18 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ComponentProgramming.Exceptions
{
public class NumberException : Exception
{
public NumberException() { }
public NumberException(string message) : base(message)
{
}
}
}

View File

@ -1,24 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Forms
{
public class Person
{
public int Id { get; set; }
public string Name { get; set; }
public string Surname { get; set; }
public Person() { }
public Person(int id, string name, string surname)
{
Name = name;
Id = id;
Surname = surname;
}
}
}

View File

@ -1,137 +0,0 @@
namespace Forms
{
partial class Form
{
/// <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()
{
controlComboBox = new ComponentProgramming.ControlComboBox();
controlTextBox = new ComponentProgramming.ControlTextBox();
buttonGetObj = new Button();
buttonClear = new Button();
buttonEnter = new Button();
buttonAdd = new Button();
controlListBox = new ComponentProgramming.ControlListBox();
SuspendLayout();
//
// controlComboBox
//
controlComboBox.Location = new Point(12, 3);
controlComboBox.Margin = new Padding(3, 4, 3, 4);
controlComboBox.Name = "controlComboBox";
controlComboBox.SelectedItem = "";
controlComboBox.Size = new Size(177, 31);
controlComboBox.TabIndex = 0;
controlComboBox.ComboBoxChanged += controlComboBox_ComboBoxChanged;
//
// controlTextBox
//
controlTextBox.Location = new Point(226, 3);
controlTextBox.Margin = new Padding(3, 4, 3, 4);
controlTextBox.Name = "controlTextBox";
controlTextBox.NumPattern = null;
controlTextBox.Size = new Size(150, 29);
controlTextBox.TabIndex = 1;
//
// buttonGetObj
//
buttonGetObj.Location = new Point(23, 415);
buttonGetObj.Name = "buttonGetObj";
buttonGetObj.Size = new Size(126, 23);
buttonGetObj.TabIndex = 3;
buttonGetObj.Text = "Получить объект";
buttonGetObj.UseVisualStyleBackColor = true;
buttonGetObj.Click += buttonGetObj_Click;
//
// buttonClear
//
buttonClear.Location = new Point(654, 415);
buttonClear.Name = "buttonClear";
buttonClear.Size = new Size(134, 26);
buttonClear.TabIndex = 4;
buttonClear.Text = "Очистить объекты";
buttonClear.UseVisualStyleBackColor = true;
buttonClear.Click += buttonClear_Click;
//
// buttonEnter
//
buttonEnter.Location = new Point(272, 36);
buttonEnter.Margin = new Padding(3, 2, 3, 2);
buttonEnter.Name = "buttonEnter";
buttonEnter.Size = new Size(74, 24);
buttonEnter.TabIndex = 5;
buttonEnter.Text = "Ввод";
buttonEnter.UseVisualStyleBackColor = true;
buttonEnter.Click += buttonEnter_Click;
//
// buttonAdd
//
buttonAdd.Location = new Point(331, 415);
buttonAdd.Margin = new Padding(3, 2, 3, 2);
buttonAdd.Name = "buttonAdd";
buttonAdd.Size = new Size(147, 23);
buttonAdd.TabIndex = 6;
buttonAdd.Text = "Добавить значение";
buttonAdd.UseVisualStyleBackColor = true;
buttonAdd.Click += buttonAdd_Click;
//
// controlListBox
//
controlListBox.GetIndex = -1;
controlListBox.Location = new Point(12, 65);
controlListBox.Name = "controlListBox";
controlListBox.Size = new Size(776, 344);
controlListBox.TabIndex = 7;
//
// Form
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(controlListBox);
Controls.Add(buttonAdd);
Controls.Add(buttonEnter);
Controls.Add(buttonClear);
Controls.Add(buttonGetObj);
Controls.Add(controlTextBox);
Controls.Add(controlComboBox);
Name = "Form";
Text = "Form";
ResumeLayout(false);
}
#endregion
private ComponentProgramming.ControlImage control;
private ComponentProgramming.ControlComboBox controlComboBox;
private ComponentProgramming.ControlTextBox controlTextBox;
private Button buttonGetObj;
private Button buttonClear;
private Button buttonEnter;
private Button buttonAdd;
private ComponentProgramming.ControlListBox controlListBox;
}
}

View File

@ -1,73 +0,0 @@
namespace Forms
{
public partial class Form : System.Windows.Forms.Form
{
public Form()
{
InitializeComponent();
FillBox();
FillTextBox();
FillList();
}
private void FillBox()
{
controlComboBox.ComboBoxItems.Add("Çíà÷åíèå 1");
controlComboBox.ComboBoxItems.Add("Çíà÷åíèå 2");
controlComboBox.ComboBoxItems.Add("Çíà÷åíèå 3");
controlComboBox.ComboBoxItems.Add("Çíà÷åíèå 4");
controlComboBox.SelectedItem = "dafafadsf";
}
private void FillTextBox()
{
controlTextBox.NumPattern = @"^\+7\d{10}$";
controlTextBox.text = "+79063908075";
}
private void FillList()
{
controlListBox.SetTemplateString("Ïðèâåò [Name] dsfdsfds [Surname]", "[", "]");
controlListBox.FillProp<Person>(new Person("Ñàøêasdasà", "Èçîòîâ"), 0, "Name");
controlListBox.FillProp<Person>(new Person("Ñàøêà", "Èçîòîâ"), 4, "Surname");
}
private void controlComboBox_ComboBoxChanged(object sender, EventArgs e)
{
var elem = controlComboBox.SelectedItem;
MessageBox.Show($"Âûáðàííî: {elem}");
}
private void controlTextBox_CheckBoxChanged(object sender, EventArgs e)
{
if (controlTextBox.text == null)
{
MessageBox.Show($"CheckBox checked");
}
else
{
MessageBox.Show($"CheckBox not checked");
}
}
private void buttonGetObj_Click(object sender, EventArgs e)
{
var obj = controlListBox.GetSelectedObject<Person>();
MessageBox.Show($"{obj.Name} {obj.Surname}");
}
private void buttonClear_Click(object sender, EventArgs e)
{
//controlDataGrid.ClearData();
}
private void buttonEnter_Click(object sender, EventArgs e)
{
var val = controlTextBox.text;
MessageBox.Show($"Ââåäåíî {val}");
}
private void buttonAdd_Click(object sender, EventArgs e)
{
//controlDataGrid.SetData<Person>(new Person(1, "asdasdas", "asdasd1asd"), 2, 3);
}
}
}

View File

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

View File

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

View File

@ -1,22 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Forms
{
public class Person
{
public string Name { get; set; }
public string Surname { get; set; }
public Person() { }
public Person(string name, string surname)
{
Name = name;
Surname = surname;
}
}
}

View File

@ -1,17 +0,0 @@
namespace Forms
{
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 Form());
}
}
}