Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
cbed01a80b |
14
COP/PutincevLibrary/Attributes/AlwaysCreateAttribute.cs
Normal file
14
COP/PutincevLibrary/Attributes/AlwaysCreateAttribute.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace PutincevLibrary.Attributes
|
||||||
|
{
|
||||||
|
public class AlwaysCreateAttribute : Attribute
|
||||||
|
{
|
||||||
|
public AlwaysCreateAttribute()
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
59
COP/PutincevLibrary/CheckedListBoxControl.Designer.cs
generated
Normal file
59
COP/PutincevLibrary/CheckedListBoxControl.Designer.cs
generated
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
namespace PutincevLibrary
|
||||||
|
{
|
||||||
|
partial class CheckedListBoxControl
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
checkedListBox = new CheckedListBox();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// checkedListBox
|
||||||
|
//
|
||||||
|
checkedListBox.CheckOnClick = true;
|
||||||
|
checkedListBox.Dock = DockStyle.Fill;
|
||||||
|
checkedListBox.FormattingEnabled = true;
|
||||||
|
checkedListBox.Location = new Point(0, 0);
|
||||||
|
checkedListBox.Name = "checkedListBox";
|
||||||
|
checkedListBox.Size = new Size(150, 136);
|
||||||
|
checkedListBox.TabIndex = 0;
|
||||||
|
checkedListBox.ItemCheck += checkedListBox_ItemCheck;
|
||||||
|
//
|
||||||
|
// CheckedListBoxControl
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
Controls.Add(checkedListBox);
|
||||||
|
Name = "CheckedListBoxControl";
|
||||||
|
Size = new Size(150, 136);
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private CheckedListBox checkedListBox;
|
||||||
|
}
|
||||||
|
}
|
70
COP/PutincevLibrary/CheckedListBoxControl.cs
Normal file
70
COP/PutincevLibrary/CheckedListBoxControl.cs
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
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 PutincevLibrary
|
||||||
|
{
|
||||||
|
public partial class CheckedListBoxControl : UserControl
|
||||||
|
{
|
||||||
|
public CheckedListBoxControl()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private EventHandler _onCheckedItemChangedEvent;
|
||||||
|
public event EventHandler CheckedItemChanged
|
||||||
|
{
|
||||||
|
add
|
||||||
|
{
|
||||||
|
_onCheckedItemChangedEvent += value;
|
||||||
|
}
|
||||||
|
remove
|
||||||
|
{
|
||||||
|
_onCheckedItemChangedEvent -= value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public string CheckedItem
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return checkedListBox.CheckedItems[0] as string ?? string.Empty;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (checkedListBox.Items.Contains(value))
|
||||||
|
{
|
||||||
|
checkedListBox.SetItemCheckState(checkedListBox.Items.IndexOf(value), CheckState.Checked);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void SetCheckedListBoxValues(List<string> values)
|
||||||
|
{
|
||||||
|
ClearCheckedListBoxValues();
|
||||||
|
foreach (var item in values)
|
||||||
|
{
|
||||||
|
checkedListBox.Items.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void ClearCheckedListBoxValues()
|
||||||
|
{
|
||||||
|
checkedListBox.Items.Clear();
|
||||||
|
}
|
||||||
|
private void checkedListBox_ItemCheck(object sender, ItemCheckEventArgs e)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < checkedListBox.Items.Count; i++)
|
||||||
|
{
|
||||||
|
if (i != e.Index)
|
||||||
|
{
|
||||||
|
checkedListBox.SetItemChecked(i, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_onCheckedItemChangedEvent?.Invoke(sender, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
COP/PutincevLibrary/CheckedListBoxControl.resx
Normal file
120
COP/PutincevLibrary/CheckedListBoxControl.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
@ -1,6 +0,0 @@
|
|||||||
namespace PutincevLibrary
|
|
||||||
{
|
|
||||||
public class Class1
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
56
COP/PutincevLibrary/DateTimePickerControl.Designer.cs
generated
Normal file
56
COP/PutincevLibrary/DateTimePickerControl.Designer.cs
generated
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
namespace PutincevLibrary
|
||||||
|
{
|
||||||
|
partial class DateTimePickerControl
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
dateTimePicker = new DateTimePicker();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// dateTimePicker
|
||||||
|
//
|
||||||
|
dateTimePicker.Dock = DockStyle.Fill;
|
||||||
|
dateTimePicker.Location = new Point(0, 0);
|
||||||
|
dateTimePicker.Name = "dateTimePicker";
|
||||||
|
dateTimePicker.Size = new Size(150, 27);
|
||||||
|
dateTimePicker.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// DateTimePickerControl
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
Controls.Add(dateTimePicker);
|
||||||
|
Name = "DateTimePickerControl";
|
||||||
|
Size = new Size(150, 26);
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private DateTimePicker dateTimePicker;
|
||||||
|
}
|
||||||
|
}
|
83
COP/PutincevLibrary/DateTimePickerControl.cs
Normal file
83
COP/PutincevLibrary/DateTimePickerControl.cs
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
using PutincevLibrary.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 PutincevLibrary
|
||||||
|
{
|
||||||
|
public partial class DateTimePickerControl : UserControl
|
||||||
|
{
|
||||||
|
public DateTimePickerControl()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private DateTime? minValue;
|
||||||
|
private DateTime? maxValue;
|
||||||
|
|
||||||
|
public event EventHandler? _valueChanged;
|
||||||
|
public DateTime? MinValue
|
||||||
|
{
|
||||||
|
get { return minValue; }
|
||||||
|
set { minValue = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public DateTime? MaxValue
|
||||||
|
{
|
||||||
|
get { return maxValue; }
|
||||||
|
set { maxValue = value; }
|
||||||
|
}
|
||||||
|
public DateTime? SelectedValue
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (!minValue.HasValue || !maxValue.HasValue)
|
||||||
|
{
|
||||||
|
throw new RangeNullException("Диапозон не был задан");
|
||||||
|
}
|
||||||
|
else if (dateTimePicker.Value < minValue ||
|
||||||
|
dateTimePicker.Value > maxValue)
|
||||||
|
{
|
||||||
|
|
||||||
|
throw new WrongRangeException("Значение не попадает в диапазон");
|
||||||
|
}
|
||||||
|
|
||||||
|
return dateTimePicker.Value;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!minValue.HasValue || !maxValue.HasValue)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (value < minValue || value > maxValue)
|
||||||
|
{
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
dateTimePicker.Value = value.Value;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public event EventHandler ValueChanged
|
||||||
|
{
|
||||||
|
add { _valueChanged += value; }
|
||||||
|
remove { _valueChanged -= value; }
|
||||||
|
}
|
||||||
|
private void DateTimePicker_ValueChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
_valueChanged?.Invoke(this, e);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
COP/PutincevLibrary/DateTimePickerControl.resx
Normal file
120
COP/PutincevLibrary/DateTimePickerControl.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
17
COP/PutincevLibrary/Exceptions/AttributeNullException.cs
Normal file
17
COP/PutincevLibrary/Exceptions/AttributeNullException.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
namespace PutincevLibrary.Exceptions
|
||||||
|
{
|
||||||
|
public class AttributeNullException : Exception
|
||||||
|
{
|
||||||
|
public AttributeNullException()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public AttributeNullException(string message) : base(message)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public AttributeNullException(string message, Exception inner) : base(message, inner)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
17
COP/PutincevLibrary/Exceptions/HierarchyNullException.cs
Normal file
17
COP/PutincevLibrary/Exceptions/HierarchyNullException.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
namespace PutincevLibrary.Exceptions
|
||||||
|
{
|
||||||
|
public class HierarchyNullException : Exception
|
||||||
|
{
|
||||||
|
public HierarchyNullException()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public HierarchyNullException(string message) : base(message)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public HierarchyNullException(string message, Exception inner) : base(message, inner)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
7
COP/PutincevLibrary/Exceptions/NodeIsNotLeafException.cs
Normal file
7
COP/PutincevLibrary/Exceptions/NodeIsNotLeafException.cs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
namespace PutincevLibrary.Exceptions
|
||||||
|
{
|
||||||
|
public class NodeIsNotLeafException : UserControlTreeViewException
|
||||||
|
{
|
||||||
|
public NodeIsNotLeafException() : base("Selected node is not a leaf") { }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
namespace PutincevLibrary.Exceptions
|
||||||
|
{
|
||||||
|
public class NotSelectedNodeException : UserControlTreeViewException
|
||||||
|
{
|
||||||
|
public NotSelectedNodeException() : base("Node is not selected") { }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
namespace PutincevLibrary.Exceptions
|
||||||
|
{
|
||||||
|
public class PropertyNotDeclaratedException : UserControlTreeViewException
|
||||||
|
{
|
||||||
|
public PropertyNotDeclaratedException(string propName) : base($"Property \"{propName}\" not declared") { }
|
||||||
|
}
|
||||||
|
}
|
7
COP/PutincevLibrary/Exceptions/PropertyNullException.cs
Normal file
7
COP/PutincevLibrary/Exceptions/PropertyNullException.cs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
namespace PutincevLibrary.Exceptions
|
||||||
|
{
|
||||||
|
public class PropertyNullException : UserControlTreeViewException
|
||||||
|
{
|
||||||
|
public PropertyNullException(string propName) : base($"Property \"{propName}\" is null") { }
|
||||||
|
}
|
||||||
|
}
|
8
COP/PutincevLibrary/Exceptions/RangeNotSetException.cs
Normal file
8
COP/PutincevLibrary/Exceptions/RangeNotSetException.cs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
namespace PutincevLibrary.Exceptions
|
||||||
|
{
|
||||||
|
public class RangeNotSetException : Exception
|
||||||
|
{
|
||||||
|
public RangeNotSetException() { }
|
||||||
|
public RangeNotSetException(string message) : base(message) { }
|
||||||
|
}
|
||||||
|
}
|
17
COP/PutincevLibrary/Exceptions/RangeNullException.cs
Normal file
17
COP/PutincevLibrary/Exceptions/RangeNullException.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
namespace PutincevLibrary.Exceptions
|
||||||
|
{
|
||||||
|
public class RangeNullException : Exception
|
||||||
|
{
|
||||||
|
public RangeNullException()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public RangeNullException(string message) : base(message)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public RangeNullException(string message, Exception inner) : base(message, inner)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
namespace PutincevLibrary.Exceptions
|
||||||
|
{
|
||||||
|
public class TreeHierarchyNotSetException : UserControlTreeViewException
|
||||||
|
{
|
||||||
|
public TreeHierarchyNotSetException() : base("Tree hierarchy not set") { }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
namespace PutincevLibrary.Exceptions
|
||||||
|
{
|
||||||
|
public class UserControlTreeViewException : Exception
|
||||||
|
{
|
||||||
|
public UserControlTreeViewException() { }
|
||||||
|
public UserControlTreeViewException(string message) : base(message) { }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
namespace PutincevLibrary.Exceptions
|
||||||
|
{
|
||||||
|
public class ValueOutOfRangeException : Exception
|
||||||
|
{
|
||||||
|
public ValueOutOfRangeException() { }
|
||||||
|
public ValueOutOfRangeException(string message) : base(message) { }
|
||||||
|
}
|
||||||
|
}
|
17
COP/PutincevLibrary/Exceptions/WrongRangeException.cs
Normal file
17
COP/PutincevLibrary/Exceptions/WrongRangeException.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
namespace PutincevLibrary.Exceptions
|
||||||
|
{
|
||||||
|
public class WrongRangeException : Exception
|
||||||
|
{
|
||||||
|
public WrongRangeException()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public WrongRangeException(string message) : base(message)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public WrongRangeException(string message, Exception inner) : base(message, inner)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -5,6 +5,7 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<UseWindowsForms>true</UseWindowsForms>
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
55
COP/PutincevLibrary/TreeViewControl.Designer.cs
generated
Normal file
55
COP/PutincevLibrary/TreeViewControl.Designer.cs
generated
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
namespace PutincevLibrary
|
||||||
|
{
|
||||||
|
partial class TreeViewControl
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
treeView = new TreeView();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// treeView
|
||||||
|
//
|
||||||
|
treeView.Dock = DockStyle.Fill;
|
||||||
|
treeView.Location = new Point(0, 0);
|
||||||
|
treeView.Name = "treeView";
|
||||||
|
treeView.Size = new Size(150, 150);
|
||||||
|
treeView.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// TreeViewControl
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
Controls.Add(treeView);
|
||||||
|
Name = "TreeViewControl";
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private TreeView treeView;
|
||||||
|
}
|
||||||
|
}
|
117
COP/PutincevLibrary/TreeViewControl.cs
Normal file
117
COP/PutincevLibrary/TreeViewControl.cs
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
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;
|
||||||
|
using PutincevLibrary.Exceptions;
|
||||||
|
using PutincevLibrary.Attributes;
|
||||||
|
|
||||||
|
namespace PutincevLibrary
|
||||||
|
{
|
||||||
|
public partial class TreeViewControl : UserControl
|
||||||
|
{
|
||||||
|
public TreeViewControl()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<(string, bool)> hierarchy = new List<(string, bool)>();
|
||||||
|
|
||||||
|
public int SelectedNodeIndex
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return treeView.SelectedNode?.Index ?? -1;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (treeView.SelectedNode == null) treeView.SelectedNode = value >= 0 && value < treeView.Nodes.Count ? treeView.Nodes[value] : treeView.SelectedNode;
|
||||||
|
else treeView.SelectedNode = value >= 0 && value < treeView.SelectedNode.Nodes.Count ? treeView.SelectedNode.Nodes[value] : treeView.SelectedNode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public T? getSelecetedNodeValue<T>()
|
||||||
|
where T : class, new()
|
||||||
|
{
|
||||||
|
var node = treeView.SelectedNode;
|
||||||
|
|
||||||
|
if (node == null)
|
||||||
|
{
|
||||||
|
throw new NotSelectedNodeException();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((hierarchy?.Count ?? 0) == 0)
|
||||||
|
{
|
||||||
|
throw new TreeHierarchyNotSetException();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (node.Nodes.Count > 0)
|
||||||
|
{
|
||||||
|
throw new NodeIsNotLeafException();
|
||||||
|
}
|
||||||
|
|
||||||
|
T obj = new T();
|
||||||
|
int propIndex = GetNodeDepth(node);
|
||||||
|
while (node != null)
|
||||||
|
{
|
||||||
|
string propValue = node.Text;
|
||||||
|
string propName = hierarchy[propIndex].Item1;
|
||||||
|
|
||||||
|
var prop = obj.GetType().GetProperty(propName);
|
||||||
|
if (prop == null)
|
||||||
|
{
|
||||||
|
throw new PropertyNotDeclaratedException(propName);
|
||||||
|
}
|
||||||
|
|
||||||
|
prop.SetValue(obj, propValue);
|
||||||
|
|
||||||
|
node = node.Parent;
|
||||||
|
propIndex--;
|
||||||
|
}
|
||||||
|
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
private int GetNodeDepth(TreeNode node)
|
||||||
|
{
|
||||||
|
int depth = 0;
|
||||||
|
while (node.Parent != null)
|
||||||
|
{
|
||||||
|
depth++;
|
||||||
|
node = node.Parent;
|
||||||
|
}
|
||||||
|
return depth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addItems<T>(List<T> items)
|
||||||
|
{
|
||||||
|
var type = typeof(T);
|
||||||
|
var fields = type.GetFields();
|
||||||
|
foreach (T item in items)
|
||||||
|
{
|
||||||
|
TreeNodeCollection nodes = treeView.Nodes;
|
||||||
|
for (int i = 0; i < hierarchy.Count; i++)
|
||||||
|
{
|
||||||
|
var field = fields.FirstOrDefault(x => x.Name.Equals(hierarchy[i].Item1));
|
||||||
|
if (field is not null)
|
||||||
|
{
|
||||||
|
var node = nodes.Find(field.Name, false).FirstOrDefault(x => x.Text == field.GetValue(item).ToString());
|
||||||
|
if (node is not null && !hierarchy[i].Item2)
|
||||||
|
{
|
||||||
|
nodes = node.Nodes;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TreeNode newNode = nodes.Add(field.Name, field.GetValue(item).ToString());
|
||||||
|
nodes = newNode.Nodes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
COP/PutincevLibrary/TreeViewControl.resx
Normal file
120
COP/PutincevLibrary/TreeViewControl.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
76
COP/WinForms/Form1.Designer.cs
generated
76
COP/WinForms/Form1.Designer.cs
generated
@ -28,12 +28,80 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.components = new System.ComponentModel.Container();
|
buttonClearList = new Button();
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
buttonFillCheckedList = new Button();
|
||||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
checkedListBoxControl = new PutincevLibrary.CheckedListBoxControl();
|
||||||
this.Text = "Form1";
|
treeViewControl = new PutincevLibrary.TreeViewControl();
|
||||||
|
dateTimePickerControl = new PutincevLibrary.DateTimePickerControl();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// buttonClearList
|
||||||
|
//
|
||||||
|
buttonClearList.Location = new Point(150, 149);
|
||||||
|
buttonClearList.Margin = new Padding(3, 4, 3, 4);
|
||||||
|
buttonClearList.Name = "buttonClearList";
|
||||||
|
buttonClearList.Size = new Size(86, 31);
|
||||||
|
buttonClearList.TabIndex = 4;
|
||||||
|
buttonClearList.Text = "Очистить";
|
||||||
|
buttonClearList.UseVisualStyleBackColor = true;
|
||||||
|
buttonClearList.Click += buttonClearList_Click;
|
||||||
|
//
|
||||||
|
// buttonFillCheckedList
|
||||||
|
//
|
||||||
|
buttonFillCheckedList.Location = new Point(44, 149);
|
||||||
|
buttonFillCheckedList.Margin = new Padding(3, 4, 3, 4);
|
||||||
|
buttonFillCheckedList.Name = "buttonFillCheckedList";
|
||||||
|
buttonFillCheckedList.Size = new Size(100, 31);
|
||||||
|
buttonFillCheckedList.TabIndex = 3;
|
||||||
|
buttonFillCheckedList.Text = "Заполнить";
|
||||||
|
buttonFillCheckedList.UseVisualStyleBackColor = true;
|
||||||
|
buttonFillCheckedList.Click += buttonFillCheckedList_Click;
|
||||||
|
//
|
||||||
|
// checkedListBoxControl
|
||||||
|
//
|
||||||
|
checkedListBoxControl.Location = new Point(48, 14);
|
||||||
|
checkedListBoxControl.Name = "checkedListBoxControl";
|
||||||
|
checkedListBoxControl.Size = new Size(188, 117);
|
||||||
|
checkedListBoxControl.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// treeViewControl
|
||||||
|
//
|
||||||
|
treeViewControl.hierarchy = null;
|
||||||
|
treeViewControl.Location = new Point(570, 12);
|
||||||
|
treeViewControl.Name = "treeViewControl";
|
||||||
|
treeViewControl.Size = new Size(188, 188);
|
||||||
|
treeViewControl.TabIndex = 7;
|
||||||
|
//
|
||||||
|
// dateTimePickerControl
|
||||||
|
//
|
||||||
|
dateTimePickerControl.Location = new Point(278, 38);
|
||||||
|
dateTimePickerControl.MaxValue = null;
|
||||||
|
dateTimePickerControl.MinValue = null;
|
||||||
|
dateTimePickerControl.Name = "dateTimePickerControl";
|
||||||
|
dateTimePickerControl.Size = new Size(188, 32);
|
||||||
|
dateTimePickerControl.TabIndex = 8;
|
||||||
|
//
|
||||||
|
// Form1
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(800, 450);
|
||||||
|
Controls.Add(dateTimePickerControl);
|
||||||
|
Controls.Add(treeViewControl);
|
||||||
|
Controls.Add(checkedListBoxControl);
|
||||||
|
Controls.Add(buttonClearList);
|
||||||
|
Controls.Add(buttonFillCheckedList);
|
||||||
|
Name = "Form1";
|
||||||
|
Text = "Form1";
|
||||||
|
ResumeLayout(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
private Button buttonClearList;
|
||||||
|
private Button buttonFillCheckedList;
|
||||||
|
private PutincevLibrary.CheckedListBoxControl checkedListBoxControl;
|
||||||
|
private PutincevLibrary.TreeViewControl treeViewControl;
|
||||||
|
private PutincevLibrary.DateTimePickerControl dateTimePickerControl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,52 @@
|
|||||||
|
using WinForms.TestClasses;
|
||||||
|
using PutincevLibrary;
|
||||||
|
|
||||||
namespace WinForms
|
namespace WinForms
|
||||||
{
|
{
|
||||||
public partial class Form1 : Form
|
public partial class Form1 : Form
|
||||||
{
|
{
|
||||||
|
List<User> users = new List<User>();
|
||||||
public Form1()
|
public Form1()
|
||||||
{
|
{
|
||||||
|
DateTime min = DateTime.Parse("2009-05-08");
|
||||||
|
DateTime max = DateTime.Today;
|
||||||
|
User user1 = new User("Ïåòðîâ Í.Ñ", "Ïîëüçîâàòåëü", "Ðîññèÿ");
|
||||||
|
User user2 = new User("Ñåðãååâ Í.Ï", "Ïîëüçîâàòåëü", "Ôðàíöèÿ");
|
||||||
|
User user3 = new User("Âðó÷èí Ï.Ê", "Àäìèíèñòðàòîð", "Íîâàÿ Çåëàíäèÿ");
|
||||||
|
User user4 = new User("Ïåòðîâ Í.Ñ", "Àäìèíèñòðàòîð", "ÑØÀ");
|
||||||
|
User user5 = new User("Ïåòðîâ Í.Ñ", "Ñóïåðàäìèíèñòðàòîð", "Ãåðìàíèÿ");
|
||||||
|
users.Add(user1);
|
||||||
|
users.Add(user2);
|
||||||
|
users.Add(user3);
|
||||||
|
users.Add(user4);
|
||||||
|
users.Add(user5);
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
dateTimePickerControl.MaxValue = max;
|
||||||
|
dateTimePickerControl.MinValue = min;
|
||||||
|
treeViewControl.hierarchy = new List<(string, bool)> { ("Country", false), ("AccessLevel", false), ("FIO", false) };
|
||||||
|
foreach (User user in users)
|
||||||
|
{
|
||||||
|
treeViewControl.addItems(users);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonFillCheckedList_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
List<string> list = new List<string>();
|
||||||
|
list.Add("Êóðèöà");
|
||||||
|
list.Add("ßéöî");
|
||||||
|
list.Add("Äèêîáðàç");
|
||||||
|
list.Add("Îáåçüÿíà");
|
||||||
|
list.Add("×åëîâåê");
|
||||||
|
checkedListBoxControl.SetCheckedListBoxValues(list);
|
||||||
|
|
||||||
|
checkedListBoxControl.CheckedItem = list[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonClearList_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
checkedListBoxControl.ClearCheckedListBoxValues();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
22
COP/WinForms/TestClasses/User.cs
Normal file
22
COP/WinForms/TestClasses/User.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using PutincevLibrary.Attributes;
|
||||||
|
namespace WinForms.TestClasses
|
||||||
|
{
|
||||||
|
public class User
|
||||||
|
{
|
||||||
|
[AlwaysCreate]
|
||||||
|
public string FIO { get; set; }
|
||||||
|
public string AccessLevel { get; set; }
|
||||||
|
public string Country { get; set; }
|
||||||
|
public User(string fio, string acc, string cou) {
|
||||||
|
FIO = fio;
|
||||||
|
AccessLevel = acc;
|
||||||
|
Country = cou;
|
||||||
|
}
|
||||||
|
public User() { }
|
||||||
|
}
|
||||||
|
}
|
@ -8,4 +8,8 @@
|
|||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\PutincevLibrary\PutincevLibrary.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
Loading…
Reference in New Issue
Block a user