уже почти

This commit is contained in:
annalyovushkina@yandex.ru 2024-09-15 03:28:24 +04:00
parent 67b7e4e7bf
commit 2672be8d1b
18 changed files with 639 additions and 39 deletions

View File

@ -3,7 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17 # Visual Studio Version 17
VisualStudioVersion = 17.11.35208.52 VisualStudioVersion = 17.11.35208.52
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomComponents", "KOP_Labs\CustomComponents.csproj", "{30670FC3-546A-4837-8A6C-48D6A479F5CA}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CustomComponents", "KOP_Labs\CustomComponents.csproj", "{30670FC3-546A-4837-8A6C-48D6A479F5CA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinFormForTest", "WinFormForTest\WinFormForTest.csproj", "{8C3EF3FC-79ED-4F01-A28D-7BD19DE978A5}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -15,6 +17,10 @@ Global
{30670FC3-546A-4837-8A6C-48D6A479F5CA}.Debug|Any CPU.Build.0 = Debug|Any CPU {30670FC3-546A-4837-8A6C-48D6A479F5CA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{30670FC3-546A-4837-8A6C-48D6A479F5CA}.Release|Any CPU.ActiveCfg = Release|Any CPU {30670FC3-546A-4837-8A6C-48D6A479F5CA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{30670FC3-546A-4837-8A6C-48D6A479F5CA}.Release|Any CPU.Build.0 = Release|Any CPU {30670FC3-546A-4837-8A6C-48D6A479F5CA}.Release|Any CPU.Build.0 = Release|Any CPU
{8C3EF3FC-79ED-4F01-A28D-7BD19DE978A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8C3EF3FC-79ED-4F01-A28D-7BD19DE978A5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8C3EF3FC-79ED-4F01-A28D-7BD19DE978A5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8C3EF3FC-79ED-4F01-A28D-7BD19DE978A5}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@ -35,7 +35,7 @@
// //
textBox.Location = new Point(13, 55); textBox.Location = new Point(13, 55);
textBox.Name = "textBox"; textBox.Name = "textBox";
textBox.Size = new Size(289, 27); textBox.Size = new Size(263, 27);
textBox.TabIndex = 0; textBox.TabIndex = 0;
textBox.TextChanged += textBox_TextChanged; textBox.TextChanged += textBox_TextChanged;
textBox.Enter += textBox_Enter; textBox.Enter += textBox_Enter;
@ -46,7 +46,7 @@
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
Controls.Add(textBox); Controls.Add(textBox);
Name = "CustomComboBox"; Name = "CustomComboBox";
Size = new Size(321, 183); Size = new Size(289, 136);
ResumeLayout(false); ResumeLayout(false);
PerformLayout(); PerformLayout();
} }

View File

@ -7,6 +7,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using CustomComponents.Exceptions;
namespace KOP_Labs namespace KOP_Labs
{ {
@ -17,9 +18,37 @@ namespace KOP_Labs
InitializeComponent(); InitializeComponent();
} }
private string examp = "Введите текст от " + decimal.MinValue + " до" + decimal.MaxValue + " символов"; private string examp = "Введите текст от " + decimal.MinValue + " до" + decimal.MaxValue + " символов";
public string Error { get; protected set; } = string.Empty;
public decimal? MinValue { get; set; } public int? max = null;
public decimal? MaxValue { get; set; } public int? min = null;
public int? Max
{
get
{
return max;
}
set
{
if (value == null || value <= 0) return;
max = value;
}
}
public int? Min
{
get
{
return min;
}
set
{
if (value == null || value < 0) return;
min = value;
}
}
private EventHandler _changeEvent; private EventHandler _changeEvent;
public event EventHandler ChangeEvent public event EventHandler ChangeEvent
@ -49,30 +78,29 @@ namespace KOP_Labs
{ {
get get
{ {
if (MinValue == null || MaxValue == null) if (Min == null || Max == null)
{ {
Error = "Диапазон не задан"; throw new NoBordersException("Границы не заданы");
return null;
} }
if (textBox.Text.Length >= MinValue && textBox.Text.Length <= MaxValue) if (textBox.Text.Length < Min || textBox.Text.Length > Max)
{ {
throw new ArgumentOutOfRangeException("Ваша строка не входит в границы диапозона: " + Min + " - " + Max);
}
return textBox.Text; return textBox.Text;
} }
Error = "Ваш текст" + " лежит \n вне диапозона" + MinValue + " - " + MaxValue;
return null;
}
set set
{ {
if (MinValue == null || MaxValue == null) if (value == null || value.Length < 0 || Max == null)
{ {
Error = "Диапазон не задан"; return;
} }
if (value.Length >= MinValue && value.Length <= MaxValue) if (value.Length < Min && value.Length > Max)
{ {
return;
}
textBox.Text = value; textBox.Text = value;
} }
} }
}
} }
} }

View File

@ -36,9 +36,9 @@
checkedListBox.FormattingEnabled = true; checkedListBox.FormattingEnabled = true;
checkedListBox.Location = new Point(3, 16); checkedListBox.Location = new Point(3, 16);
checkedListBox.Name = "checkedListBox"; checkedListBox.Name = "checkedListBox";
checkedListBox.Size = new Size(214, 180); checkedListBox.Size = new Size(197, 136);
checkedListBox.TabIndex = 0; checkedListBox.TabIndex = 0;
checkedListBox.SelectedIndexChanged += this.checkedListBox_SelectedIndexChanged; checkedListBox.SelectedIndexChanged += checkedListBox_SelectedIndexChanged;
// //
// CustomListBox // CustomListBox
// //
@ -46,7 +46,7 @@
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
Controls.Add(checkedListBox); Controls.Add(checkedListBox);
Name = "CustomListBox"; Name = "CustomListBox";
Size = new Size(220, 223); Size = new Size(220, 184);
ResumeLayout(false); ResumeLayout(false);
} }

View File

@ -73,9 +73,14 @@ namespace KOP_Labs
} }
set set
{ {
if (checkedListBox.Items.Contains(value)) { int index = checkedListBox.Items.IndexOf(value);
if (index == -1)
{
return;
}
checkedListBox.SelectedItem = value; checkedListBox.SelectedItem = value;
} checkedListBox.SetItemChecked(index, true);
} }
} }
} }

View File

@ -35,7 +35,7 @@
// //
treeView.Location = new Point(3, 3); treeView.Location = new Point(3, 3);
treeView.Name = "treeView"; treeView.Name = "treeView";
treeView.Size = new Size(360, 425); treeView.Size = new Size(291, 358);
treeView.TabIndex = 0; treeView.TabIndex = 0;
// //
// CustomTree // CustomTree
@ -44,7 +44,7 @@
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
Controls.Add(treeView); Controls.Add(treeView);
Name = "CustomTree"; Name = "CustomTree";
Size = new Size(366, 431); Size = new Size(307, 364);
ResumeLayout(false); ResumeLayout(false);
} }

View File

@ -1,9 +1,12 @@
using System; using CustomComponents.Exceptions;
using CustomComponents.Helpers;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Data; using System.Data;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using System.Reflection;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
@ -17,10 +20,103 @@ namespace KOP_Labs
InitializeComponent(); InitializeComponent();
} }
public List<string>? Hierarcy { get; set; }
public void Clear() public void Clear()
{ {
treeView.Nodes.Clear(); treeView.Nodes.Clear();
} }
public void AddNode<T>(T obj) {
if (Hierarcy == null)
{
throw new HierarcyNullException("Иерархия не задана");
}
if (obj == null)
{
throw new ArgumentNullException("Объект не найден");
}
var values = GetValuesVithStructure(obj);
var treeNode = new TreeNode();
AddNodesToTreeNode(treeView.Nodes, treeNode.Nodes);
var nodes = AddElementsToParent(values, treeNode);
treeView.Nodes.Clear();
AddNodesToTreeNode(nodes.Nodes, treeView.Nodes);
}
private void AddNodesToTreeNode(TreeNodeCollection fromNodeCollection, TreeNodeCollection toNodeCollection)
{
for (int i = 0; i < fromNodeCollection.Count; i++)
{
var node = fromNodeCollection[i].Clone() as TreeNode;
toNodeCollection.Add(node);
}
}
private Dictionary<string, (object, bool)> GetValuesVithStructure<T>(T obj)
{
PropertyInfo[]? properties = obj?.GetType().GetProperties();
var dict = new Dictionary<string, (object, bool)>();
foreach (var elem in Hierarcy!) {
PropertyInfo? prop = properties?.Single(prop => prop.Name == elem);
if (prop == null)
{
throw new PropertyNullException(nameof(prop));
}
var atr = prop.GetCustomAttributes()?.SingleOrDefault(atr => atr is AlwaysCreateAttribute);
dict[elem] = (prop.GetValue(obj)!, atr == null ? false : true);
}
return dict;
}
private TreeNode AddElementsToParent(Dictionary<string, (object, bool)> elements, TreeNode parent)
{
if (elements.Count == 0)
{
return parent;
}
var firstElem = elements.First();
var child = parent.Nodes
.Cast<TreeNode>()
.SingleOrDefault(node => node.Text == (string)firstElem.Value.Item1);
if (child != null && !firstElem.Value.Item2)
{
elements.Remove(firstElem.Key);
return AddElementsToParent(elements, child).Parent;
}
else
{
var newChild = new TreeNode(firstElem.Value.Item1?.ToString() ?? string.Empty);
newChild.Tag = new Tuple<string, object>(firstElem.Key, firstElem.Value.Item1!);
elements.Remove(firstElem.Key);
parent.Nodes.Add(AddElementsToParent(elements, newChild));
return parent;
}
}
public T GetSelectedNode<T>()
where T : new()
{
if (Hierarcy == null)
{
throw new HierarcyNullException("Иерархия не задана");
}
if (treeView.SelectedNode == null)
{
return new T();
}
return GetNode(new T(), treeView.SelectedNode);
}
private T GetNode<T>(T obj, TreeNode node)
{
if (node != null && node.Tag != null)
{
var tag = node.Tag as Tuple<string, object>;
var property = obj?.GetType().GetProperty(tag!.Item1);
property?.SetValue(obj, Convert.ChangeType(tag!.Item2, property.PropertyType));
GetNode(obj, node.Parent);
}
return obj;
}
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CustomComponents.Helpers
{
public class AlwaysCreateAttribute : Attribute
{
public AlwaysCreateAttribute() { }
}
}

159
KOP_Labs/WinFormForTest/Form1.Designer.cs generated Normal file
View File

@ -0,0 +1,159 @@
namespace WinFormForTest
{
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()
{
customComboBox1 = new KOP_Labs.CustomComboBox();
customListBox1 = new KOP_Labs.CustomListBox();
customTree1 = new KOP_Labs.CustomTree();
buttonClear = new Button();
buttonEnter = new Button();
buttonGet = new Button();
labelItem = new Label();
buttonCheck = new Button();
checkBoxValid = new CheckBox();
SuspendLayout();
//
// customComboBox1
//
customComboBox1.Location = new Point(264, 50);
customComboBox1.Max = 20;
customComboBox1.Min = 5;
customComboBox1.Name = "customComboBox1";
customComboBox1.Size = new Size(301, 125);
customComboBox1.TabIndex = 0;
customComboBox1.TextBoxValue = "";
//
// customListBox1
//
customListBox1.Location = new Point(12, 23);
customListBox1.Name = "customListBox1";
customListBox1.SelectedElement = "";
customListBox1.Size = new Size(231, 187);
customListBox1.TabIndex = 1;
//
// customTree1
//
customTree1.Hierarcy = null;
customTree1.Location = new Point(615, 50);
customTree1.Name = "customTree1";
customTree1.Size = new Size(309, 384);
customTree1.TabIndex = 2;
//
// buttonClear
//
buttonClear.Location = new Point(12, 216);
buttonClear.Name = "buttonClear";
buttonClear.Size = new Size(161, 29);
buttonClear.TabIndex = 3;
buttonClear.Text = "Очистить список";
buttonClear.UseVisualStyleBackColor = true;
buttonClear.Click += buttonClear_Click;
//
// buttonEnter
//
buttonEnter.Location = new Point(12, 251);
buttonEnter.Name = "buttonEnter";
buttonEnter.Size = new Size(183, 29);
buttonEnter.TabIndex = 4;
buttonEnter.Text = "Добавить элементы";
buttonEnter.UseVisualStyleBackColor = true;
buttonEnter.Click += buttonEnter_Click;
//
// buttonGet
//
buttonGet.Location = new Point(12, 286);
buttonGet.Name = "buttonGet";
buttonGet.Size = new Size(94, 29);
buttonGet.TabIndex = 5;
buttonGet.Text = "Получить";
buttonGet.UseVisualStyleBackColor = true;
buttonGet.Click += buttonGet_Click;
//
// labelItem
//
labelItem.AutoSize = true;
labelItem.Location = new Point(123, 290);
labelItem.Name = "labelItem";
labelItem.Size = new Size(59, 20);
labelItem.TabIndex = 6;
labelItem.Text = "Объект";
//
// buttonCheck
//
buttonCheck.Location = new Point(273, 181);
buttonCheck.Name = "buttonCheck";
buttonCheck.Size = new Size(94, 29);
buttonCheck.TabIndex = 7;
buttonCheck.Text = "Проверить";
buttonCheck.UseVisualStyleBackColor = true;
buttonCheck.Click += buttonCheck_Click;
//
// checkBoxValid
//
checkBoxValid.AutoSize = true;
checkBoxValid.Location = new Point(417, 181);
checkBoxValid.Name = "checkBoxValid";
checkBoxValid.Size = new Size(100, 24);
checkBoxValid.TabIndex = 9;
checkBoxValid.Text = "Проверка";
checkBoxValid.UseVisualStyleBackColor = true;
//
// Form1
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1042, 573);
Controls.Add(checkBoxValid);
Controls.Add(buttonCheck);
Controls.Add(labelItem);
Controls.Add(buttonGet);
Controls.Add(buttonEnter);
Controls.Add(buttonClear);
Controls.Add(customTree1);
Controls.Add(customListBox1);
Controls.Add(customComboBox1);
Name = "Form1";
Text = "Form1";
ResumeLayout(false);
PerformLayout();
}
#endregion
private KOP_Labs.CustomComboBox customComboBox1;
private KOP_Labs.CustomListBox customListBox1;
private KOP_Labs.CustomTree customTree1;
private Button buttonClear;
private Button buttonEnter;
private Button buttonGet;
private Label labelItem;
private Button buttonCheck;
private CheckBox checkBoxValid;
}
}

View File

@ -0,0 +1,76 @@
using WinFormForTest.TestClasses;
namespace WinFormForTest
{
public partial class Form1 : Form
{
List<Plant> plants = new List<Plant>();
public Form1()
{
InitializeComponent();
customListBox1.AddToList("Ýëåìåíò 1");
customListBox1.AddToList("Ýëåìåíò 2");
customListBox1.AddToList("Ýëåìåíò 3");
Plant pl1 = new Plant("ôðóêò", "ïîìèäîð", "êðàñíûé");
Plant pl2 = new Plant("îâîùü", "ïîìèäîð", "æ¸ëòûé");
Plant pl3 = new Plant("îâîùü", "îãóðåö", "çåë¸íûé");
Plant pl4 = new Plant("ôðóêò", "ÿáëîêî", "çåë¸íûé");
Plant pl5 = new Plant("ôðóêò", "àïåëüñèí", "îðàíæåâûé");
Plant pl6 = new Plant("ôðóêò", "àïåëüñèí", "êðàñíûé");
plants.Add(pl1);
plants.Add(pl4);
plants.Add(pl2);
plants.Add(pl5);
plants.Add(pl3);
plants.Add(pl6);
LoadTree();
}
public void LoadTree()
{
customTree1.Hierarcy = new List<string> { "Color", "Name", "Type" };
foreach (Plant plant in plants)
{
customTree1.AddNode(plant);
}
}
private void buttonClear_Click(object sender, EventArgs e)
{
customListBox1.Clear();
}
private void buttonCheck_Click(object sender, EventArgs e)
{
try
{
if (customComboBox1.TextBoxValue != null)
{
checkBoxValid.Text = "ïîäõîäèò";
checkBoxValid.Checked = true;
checkBoxValid.BackColor = Color.Green;
}
}
catch (Exception ex)
{
checkBoxValid.Text = "íå ïîäõîäèò";
checkBoxValid.Checked = false;
checkBoxValid.BackColor = Color.Red;
MessageBox.Show(ex.Message);
}
}
private void buttonEnter_Click(object sender, EventArgs e)
{
customListBox1.AddToList("Ýëåìåíò 4");
customListBox1.AddToList("Ýëåìåíò 5");
customListBox1.AddToList("Ýëåìåíò 6");
}
private void buttonGet_Click(object sender, EventArgs e)
{
labelItem.Text = customListBox1.SelectedElement;
}
}
}

View File

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

View File

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

View File

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CustomComponents.Helpers;
namespace WinFormForTest.TestClasses
{
public class Plant
{
[AlwaysCreate]
public string Type { get; set; }
public string Name { get; set; }
public string Color { get; set; }
public Plant(string type, string name, string color)
{
Type = type;
Name = name;
Color = color;
}
public Plant() { }
}
}

View File

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