вроде готовая первая лаба я не знаю

This commit is contained in:
Полина Чубыкина 2024-09-16 20:15:18 +04:00
parent 1cd0c60973
commit 8888ebe3f0
12 changed files with 742 additions and 1 deletions

View File

@ -3,7 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.3.32825.248
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Components", "Components\Components.csproj", "{F22A3AAE-6F8D-4AEB-91B1-E8303166B5FF}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Components", "Components\Components.csproj", "{F22A3AAE-6F8D-4AEB-91B1-E8303166B5FF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinFormsTest", "WinFormsTest\WinFormsTest.csproj", "{F589AB00-F69A-4826-BE33-662F14E39F25}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -15,6 +17,10 @@ Global
{F22A3AAE-6F8D-4AEB-91B1-E8303166B5FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F22A3AAE-6F8D-4AEB-91B1-E8303166B5FF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F22A3AAE-6F8D-4AEB-91B1-E8303166B5FF}.Release|Any CPU.Build.0 = Release|Any CPU
{F589AB00-F69A-4826-BE33-662F14E39F25}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F589AB00-F69A-4826-BE33-662F14E39F25}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F589AB00-F69A-4826-BE33-662F14E39F25}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F589AB00-F69A-4826-BE33-662F14E39F25}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

39
COP/WinFormsApp1/Form1.Designer.cs generated Normal file
View File

@ -0,0 +1,39 @@
namespace WinFormsApp1
{
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()
{
this.components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Text = "Form";
}
#endregion
}
}

10
COP/WinFormsApp1/Form1.cs Normal file
View File

@ -0,0 +1,10 @@
namespace WinFormsApp1
{
public partial class Form : Form
{
public Form()
{
InitializeComponent();
}
}
}

120
COP/WinFormsApp1/Form1.resx Normal file
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 WinFormsApp1
{
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());
}
}
}

View File

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

227
COP/WinFormsTest/FormTest.Designer.cs generated Normal file
View File

@ -0,0 +1,227 @@
namespace WinFormsTest
{
partial class FormTest
{
/// <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()
{
this.userCheckedListBox = new Components.Components.UserCheckedListBox();
this.buttonAdd = new System.Windows.Forms.Button();
this.buttonClear = new System.Windows.Forms.Button();
this.buttonSelected = new System.Windows.Forms.Button();
this.userDatePicker = new Components.Components.UserDatePicker();
this.buttonBoundries = new System.Windows.Forms.Button();
this.buttonSetDate = new System.Windows.Forms.Button();
this.buttonGetDate = new System.Windows.Forms.Button();
this.userTreeView = new Components.Components.UserTreeView();
this.buttonSetHierarchy = new System.Windows.Forms.Button();
this.buttonAddWorkers = new System.Windows.Forms.Button();
this.buttonGetValue = new System.Windows.Forms.Button();
this.buttonGetIndex = new System.Windows.Forms.Button();
this.buttonSetIndex = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// userCheckedListBox
//
this.userCheckedListBox.Location = new System.Drawing.Point(12, 12);
this.userCheckedListBox.Name = "userCheckedListBox";
this.userCheckedListBox.selectedItem = null;
this.userCheckedListBox.Size = new System.Drawing.Size(170, 134);
this.userCheckedListBox.TabIndex = 0;
this.userCheckedListBox.SelectedItemChange += new System.Action<string>(this.userCheckedListBox_SelectedItemChange);
//
// buttonAdd
//
this.buttonAdd.Location = new System.Drawing.Point(12, 143);
this.buttonAdd.Name = "buttonAdd";
this.buttonAdd.Size = new System.Drawing.Size(150, 29);
this.buttonAdd.TabIndex = 1;
this.buttonAdd.Text = "Добавить";
this.buttonAdd.UseVisualStyleBackColor = true;
this.buttonAdd.Click += new System.EventHandler(this.buttonAdd_Click);
//
// buttonClear
//
this.buttonClear.Location = new System.Drawing.Point(12, 178);
this.buttonClear.Name = "buttonClear";
this.buttonClear.Size = new System.Drawing.Size(150, 29);
this.buttonClear.TabIndex = 2;
this.buttonClear.Text = "Очистить";
this.buttonClear.UseVisualStyleBackColor = true;
this.buttonClear.Click += new System.EventHandler(this.buttonClear_Click);
//
// buttonSelected
//
this.buttonSelected.Location = new System.Drawing.Point(12, 213);
this.buttonSelected.Name = "buttonSelected";
this.buttonSelected.Size = new System.Drawing.Size(150, 48);
this.buttonSelected.TabIndex = 3;
this.buttonSelected.Text = "Выбранный элемент";
this.buttonSelected.UseVisualStyleBackColor = true;
this.buttonSelected.Click += new System.EventHandler(this.buttonSelected_Click);
//
// userDatePicker
//
this.userDatePicker.dateFrom = null;
this.userDatePicker.dateTo = null;
this.userDatePicker.Location = new System.Drawing.Point(188, 12);
this.userDatePicker.Name = "userDatePicker";
this.userDatePicker.Size = new System.Drawing.Size(275, 48);
this.userDatePicker.TabIndex = 4;
this.userDatePicker.DateChange += new System.Action<System.DateTime>(this.userDatePicker_DateChange);
this.userDatePicker.AutoSizeChanged += new System.EventHandler(this.userDatePicker_DateChange);
//
// buttonBoundries
//
this.buttonBoundries.Location = new System.Drawing.Point(188, 143);
this.buttonBoundries.Name = "buttonBoundries";
this.buttonBoundries.Size = new System.Drawing.Size(254, 29);
this.buttonBoundries.TabIndex = 5;
this.buttonBoundries.Text = "Установить границы";
this.buttonBoundries.UseVisualStyleBackColor = true;
this.buttonBoundries.Click += new System.EventHandler(this.buttonBoundries_Click);
//
// buttonSetDate
//
this.buttonSetDate.Location = new System.Drawing.Point(188, 178);
this.buttonSetDate.Name = "buttonSetDate";
this.buttonSetDate.Size = new System.Drawing.Size(254, 29);
this.buttonSetDate.TabIndex = 6;
this.buttonSetDate.Text = "Установить значение";
this.buttonSetDate.UseVisualStyleBackColor = true;
this.buttonSetDate.Click += new System.EventHandler(this.buttonSetDate_Click);
//
// buttonGetDate
//
this.buttonGetDate.Location = new System.Drawing.Point(188, 213);
this.buttonGetDate.Name = "buttonGetDate";
this.buttonGetDate.Size = new System.Drawing.Size(254, 29);
this.buttonGetDate.TabIndex = 7;
this.buttonGetDate.Text = "Получить значение";
this.buttonGetDate.UseVisualStyleBackColor = true;
this.buttonGetDate.Click += new System.EventHandler(this.buttonGetDate_Click);
//
// userTreeView
//
this.userTreeView.Location = new System.Drawing.Point(469, 12);
this.userTreeView.Name = "userTreeView";
this.userTreeView.SelectedNodeIndex = -1;
this.userTreeView.Size = new System.Drawing.Size(369, 249);
this.userTreeView.TabIndex = 8;
//
// buttonSetHierarchy
//
this.buttonSetHierarchy.Location = new System.Drawing.Point(469, 257);
this.buttonSetHierarchy.Name = "buttonSetHierarchy";
this.buttonSetHierarchy.Size = new System.Drawing.Size(296, 29);
this.buttonSetHierarchy.TabIndex = 9;
this.buttonSetHierarchy.Text = "Установить иерархию";
this.buttonSetHierarchy.UseVisualStyleBackColor = true;
this.buttonSetHierarchy.Click += new System.EventHandler(this.buttonSetHierarchy_Click);
//
// buttonAddWorkers
//
this.buttonAddWorkers.Location = new System.Drawing.Point(469, 292);
this.buttonAddWorkers.Name = "buttonAddWorkers";
this.buttonAddWorkers.Size = new System.Drawing.Size(296, 29);
this.buttonAddWorkers.TabIndex = 10;
this.buttonAddWorkers.Text = "Добавить рабочих";
this.buttonAddWorkers.UseVisualStyleBackColor = true;
this.buttonAddWorkers.Click += new System.EventHandler(this.buttonAddWorkers_Click);
//
// buttonGetValue
//
this.buttonGetValue.Location = new System.Drawing.Point(469, 327);
this.buttonGetValue.Name = "buttonGetValue";
this.buttonGetValue.Size = new System.Drawing.Size(296, 29);
this.buttonGetValue.TabIndex = 11;
this.buttonGetValue.Text = "Получить значение";
this.buttonGetValue.UseVisualStyleBackColor = true;
this.buttonGetValue.Click += new System.EventHandler(this.buttonGetValue_Click);
//
// buttonGetIndex
//
this.buttonGetIndex.Location = new System.Drawing.Point(469, 362);
this.buttonGetIndex.Name = "buttonGetIndex";
this.buttonGetIndex.Size = new System.Drawing.Size(296, 29);
this.buttonGetIndex.TabIndex = 12;
this.buttonGetIndex.Text = "Получить индекс";
this.buttonGetIndex.UseVisualStyleBackColor = true;
this.buttonGetIndex.Click += new System.EventHandler(this.buttonGetIndex_Click);
//
// buttonSetIndex
//
this.buttonSetIndex.Location = new System.Drawing.Point(469, 397);
this.buttonSetIndex.Name = "buttonSetIndex";
this.buttonSetIndex.Size = new System.Drawing.Size(296, 29);
this.buttonSetIndex.TabIndex = 13;
this.buttonSetIndex.Text = "Установить индекс";
this.buttonSetIndex.UseVisualStyleBackColor = true;
this.buttonSetIndex.Click += new System.EventHandler(this.buttonSetIndex_Click);
//
// FormTest
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(850, 450);
this.Controls.Add(this.buttonSetIndex);
this.Controls.Add(this.buttonGetIndex);
this.Controls.Add(this.buttonGetValue);
this.Controls.Add(this.buttonAddWorkers);
this.Controls.Add(this.buttonSetHierarchy);
this.Controls.Add(this.userTreeView);
this.Controls.Add(this.buttonGetDate);
this.Controls.Add(this.buttonSetDate);
this.Controls.Add(this.buttonBoundries);
this.Controls.Add(this.userDatePicker);
this.Controls.Add(this.buttonSelected);
this.Controls.Add(this.buttonClear);
this.Controls.Add(this.buttonAdd);
this.Controls.Add(this.userCheckedListBox);
this.Name = "FormTest";
this.Text = "FormTest";
this.ResumeLayout(false);
}
#endregion
private Components.Components.UserCheckedListBox userCheckedListBox;
private Button buttonAdd;
private Button buttonClear;
private Button buttonSelected;
private Components.Components.UserDatePicker userDatePicker;
private Button buttonBoundries;
private Button buttonSetDate;
private Button buttonGetDate;
private Components.Components.UserTreeView userTreeView;
private Button buttonSetHierarchy;
private Button buttonAddWorkers;
private Button buttonGetValue;
private Button buttonGetIndex;
private Button buttonSetIndex;
}
}

View File

@ -0,0 +1,137 @@
using Components.Exceptions;
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 WinFormsTest
{
public partial class FormTest : Form
{
public FormTest()
{
InitializeComponent();
}
private void buttonAdd_Click(object sender, EventArgs e)
{
Random random = new Random();
List<string> items = new List<string>();
for (int i = 0; i < 3; i++)
{
items.Add("item" + random.Next(0, 10000));
}
userCheckedListBox.addItems(items);
userCheckedListBox.selectedItem = items[1];
}
private void userCheckedListBox_SelectedItemChange(string obj)
{
MessageBox.Show(obj, "Select event");
}
private void buttonClear_Click(object sender, EventArgs e)
{
userCheckedListBox.clear();
}
private void buttonSelected_Click(object sender, EventArgs e)
{
MessageBox.Show(userCheckedListBox.selectedItem ?? "null", "By getter");
}
private void buttonBoundries_Click(object sender, EventArgs e)
{
userDatePicker.dateFrom = new DateTime(1970, 01, 01);
userDatePicker.dateTo = new DateTime(2010, 01, 01);
}
private void buttonSetDate_Click(object sender, EventArgs e)
{
var result = MessageBox.Show("Установить значение в границах?", "Выбор", MessageBoxButtons.YesNo);
if (result == DialogResult.Yes)
{
userDatePicker.Value = new DateTime(2000, 01, 01);
}
else
{
userDatePicker.Value = new DateTime(1900, 01, 01);
}
}
private void userDatePicker_DateChange(object sender, EventArgs e)
{
MessageBox.Show("ok");
}
private void userDatePicker_DateChange(DateTime obj)
{
MessageBox.Show(obj.ToShortDateString(), "Date change event");
}
private void buttonGetDate_Click(object sender, EventArgs e)
{
try
{
DateTime? date = userDatePicker.Value;
if (date.HasValue && date == new DateTime(2000, 01, 01))
{
MessageBox.Show(date.Value.ToShortDateString(), "Через свойство", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
MessageBox.Show("Дата не выбрана, дата выходит за пределы диапазона или диапазон не задан.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
catch (DateBoundsNotSetException ex)
{
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
catch (DateOutOfBoundsException ex)
{
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void buttonSetHierarchy_Click(object sender, EventArgs e)
{
userTreeView.setHierarchy(new List<(string, bool)>() { ("department", false), ("groupNumber", false), ("name", true) });
}
private void buttonAddWorkers_Click(object sender, EventArgs e)
{
List<Worker> workers = new List<Worker>();
workers.Add(new Worker("Отдел 1", 1, "Иванов"));
workers.Add(new Worker("Отдел 1", 1, "Петров"));
workers.Add(new Worker("Отдел 1", 1, "Иванов"));
workers.Add(new Worker("Отдел 1", 2, "Иванов"));
workers.Add(new Worker("Отдел 2", 1, "Иванов"));
workers.Add(new Worker("Отдел 2", 1, "Иванов"));
workers.Add(new Worker("Отдел 2", 1, "Петров"));
workers.Add(new Worker("Отдел 2", 2, "Иванов"));
userTreeView.addItems(workers);
}
private void buttonGetValue_Click(object sender, EventArgs e)
{
Worker? worker = userTreeView.getSelecetedNodeValue<Worker>();
if (worker == null) return;
MessageBox.Show(worker.department + ", номер группы: " + worker.groupNumber + ", " + worker.name);
}
private void buttonGetIndex_Click(object sender, EventArgs e)
{
MessageBox.Show(userTreeView.SelectedNodeIndex.ToString());
}
private void buttonSetIndex_Click(object sender, EventArgs e)
{
userTreeView.SelectedNodeIndex = 0;
}
}
}

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 WinFormsTest
{
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 FormTest());
}
}
}

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="..\Components\Components.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WinFormsTest
{
public class Worker
{
public Worker(string department, int groupNumber, string name)
{
this.department = department;
this.groupNumber = groupNumber;
this.name = name;
}
public string department;
public int groupNumber;
public string name;
}
}