Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
a6a79d0213 | ||
|
37fe5deca9 | ||
|
1d0c82bfb4 | ||
|
71fa6549fb | ||
|
9834f67584 |
@ -5,6 +5,8 @@ VisualStudioVersion = 17.3.32825.248
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AbazovAppView", "AbazovAppView\AbazovAppView.csproj", "{D7EF43DC-2F09-4EAD-8161-6D4A08BC7786}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AbazovViewComponents", "AbazovViewComponents\AbazovViewComponents.csproj", "{070AAA71-3C9B-4E19-A89D-83372C630C6E}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -15,6 +17,10 @@ Global
|
||||
{D7EF43DC-2F09-4EAD-8161-6D4A08BC7786}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D7EF43DC-2F09-4EAD-8161-6D4A08BC7786}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D7EF43DC-2F09-4EAD-8161-6D4A08BC7786}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{070AAA71-3C9B-4E19-A89D-83372C630C6E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{070AAA71-3C9B-4E19-A89D-83372C630C6E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{070AAA71-3C9B-4E19-A89D-83372C630C6E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{070AAA71-3C9B-4E19-A89D-83372C630C6E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -8,4 +8,8 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\AbazovViewComponents\AbazovViewComponents.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
39
AbazovApp/AbazovAppView/Form1.Designer.cs
generated
39
AbazovApp/AbazovAppView/Form1.Designer.cs
generated
@ -1,39 +0,0 @@
|
||||
namespace AbazovAppView
|
||||
{
|
||||
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()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Text = "Form1";
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
namespace AbazovAppView
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
227
AbazovApp/AbazovAppView/FormTest.Designer.cs
generated
Normal file
227
AbazovApp/AbazovAppView/FormTest.Designer.cs
generated
Normal file
@ -0,0 +1,227 @@
|
||||
namespace AbazovAppView
|
||||
{
|
||||
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.abazovCheckedListBox = new AbazovViewComponents.Components.AbazovCheckedListBox();
|
||||
this.buttonAdd = new System.Windows.Forms.Button();
|
||||
this.buttonClear = new System.Windows.Forms.Button();
|
||||
this.buttonSelected = new System.Windows.Forms.Button();
|
||||
this.abazovDatePicker = new AbazovViewComponents.Components.AbazovDatePicker();
|
||||
this.buttonBoundries = new System.Windows.Forms.Button();
|
||||
this.buttonSetDate = new System.Windows.Forms.Button();
|
||||
this.buttonGetDate = new System.Windows.Forms.Button();
|
||||
this.abazovTreeView = new AbazovViewComponents.Components.AbazovTreeView();
|
||||
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();
|
||||
//
|
||||
// abazovCheckedListBox
|
||||
//
|
||||
this.abazovCheckedListBox.Location = new System.Drawing.Point(12, 12);
|
||||
this.abazovCheckedListBox.Name = "abazovCheckedListBox";
|
||||
this.abazovCheckedListBox.selectedItem = null;
|
||||
this.abazovCheckedListBox.Size = new System.Drawing.Size(170, 134);
|
||||
this.abazovCheckedListBox.TabIndex = 0;
|
||||
this.abazovCheckedListBox.SelectedItemChange += new System.Action<string>(this.abazovCheckedListBox_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);
|
||||
//
|
||||
// abazovDatePicker
|
||||
//
|
||||
this.abazovDatePicker.dateFrom = null;
|
||||
this.abazovDatePicker.dateTo = null;
|
||||
this.abazovDatePicker.Location = new System.Drawing.Point(188, 12);
|
||||
this.abazovDatePicker.Name = "abazovDatePicker";
|
||||
this.abazovDatePicker.Size = new System.Drawing.Size(275, 48);
|
||||
this.abazovDatePicker.TabIndex = 4;
|
||||
this.abazovDatePicker.DateChange += new System.Action<System.DateTime>(this.abazovDatePicker_DateChange);
|
||||
this.abazovDatePicker.AutoSizeChanged += new System.EventHandler(this.abazovDatePicker_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);
|
||||
//
|
||||
// abazovTreeView
|
||||
//
|
||||
this.abazovTreeView.Location = new System.Drawing.Point(469, 12);
|
||||
this.abazovTreeView.Name = "abazovTreeView";
|
||||
this.abazovTreeView.SelectedNodeIndex = -1;
|
||||
this.abazovTreeView.Size = new System.Drawing.Size(369, 249);
|
||||
this.abazovTreeView.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.abazovTreeView);
|
||||
this.Controls.Add(this.buttonGetDate);
|
||||
this.Controls.Add(this.buttonSetDate);
|
||||
this.Controls.Add(this.buttonBoundries);
|
||||
this.Controls.Add(this.abazovDatePicker);
|
||||
this.Controls.Add(this.buttonSelected);
|
||||
this.Controls.Add(this.buttonClear);
|
||||
this.Controls.Add(this.buttonAdd);
|
||||
this.Controls.Add(this.abazovCheckedListBox);
|
||||
this.Name = "FormTest";
|
||||
this.Text = "FormTest";
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private AbazovViewComponents.Components.AbazovCheckedListBox abazovCheckedListBox;
|
||||
private Button buttonAdd;
|
||||
private Button buttonClear;
|
||||
private Button buttonSelected;
|
||||
private AbazovViewComponents.Components.AbazovDatePicker abazovDatePicker;
|
||||
private Button buttonBoundries;
|
||||
private Button buttonSetDate;
|
||||
private Button buttonGetDate;
|
||||
private AbazovViewComponents.Components.AbazovTreeView abazovTreeView;
|
||||
private Button buttonSetHierarchy;
|
||||
private Button buttonAddWorkers;
|
||||
private Button buttonGetValue;
|
||||
private Button buttonGetIndex;
|
||||
private Button buttonSetIndex;
|
||||
}
|
||||
}
|
131
AbazovApp/AbazovAppView/FormTest.cs
Normal file
131
AbazovApp/AbazovAppView/FormTest.cs
Normal file
@ -0,0 +1,131 @@
|
||||
using AbazovViewComponents.Components;
|
||||
using AbazovViewComponents.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 AbazovAppView
|
||||
{
|
||||
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));
|
||||
}
|
||||
abazovCheckedListBox.addItems(items);
|
||||
abazovCheckedListBox.selectedItem = items[1];
|
||||
}
|
||||
|
||||
private void abazovCheckedListBox_SelectedItemChange(string obj)
|
||||
{
|
||||
MessageBox.Show(obj, "Select event");
|
||||
}
|
||||
|
||||
private void buttonClear_Click(object sender, EventArgs e)
|
||||
{
|
||||
abazovCheckedListBox.clear();
|
||||
}
|
||||
|
||||
private void buttonSelected_Click(object sender, EventArgs e)
|
||||
{
|
||||
MessageBox.Show(abazovCheckedListBox.selectedItem ?? "null", "By getter");
|
||||
}
|
||||
|
||||
private void buttonBoundries_Click(object sender, EventArgs e)
|
||||
{
|
||||
abazovDatePicker.dateFrom = new DateTime(1970, 01, 01);
|
||||
abazovDatePicker.dateTo = new DateTime(2010, 01, 01);
|
||||
}
|
||||
|
||||
private void buttonSetDate_Click(object sender, EventArgs e)
|
||||
{
|
||||
var result = MessageBox.Show("Установить значение в границах?", "Выбор", MessageBoxButtons.YesNo);
|
||||
if (result == DialogResult.Yes)
|
||||
{
|
||||
abazovDatePicker.Value = new DateTime(2000, 01, 01);
|
||||
}
|
||||
else
|
||||
{
|
||||
abazovDatePicker.Value = new DateTime(1900, 01, 01);
|
||||
}
|
||||
}
|
||||
|
||||
private void abazovDatePicker_DateChange(object sender, EventArgs e)
|
||||
{
|
||||
MessageBox.Show("ok");
|
||||
}
|
||||
|
||||
private void abazovDatePicker_DateChange(DateTime obj)
|
||||
{
|
||||
MessageBox.Show(obj.ToShortDateString(), "Date change event");
|
||||
}
|
||||
|
||||
private void buttonGetDate_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DateTime? date = abazovDatePicker.Value;
|
||||
MessageBox.Show(date.ToString(), "Через свойство");
|
||||
}
|
||||
catch (DateBoundsNotSetException ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
catch (DateOutOfBoundsException ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonSetHierarchy_Click(object sender, EventArgs e)
|
||||
{
|
||||
abazovTreeView.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, "Иванов"));
|
||||
abazovTreeView.addItems(workers);
|
||||
}
|
||||
|
||||
private void buttonGetValue_Click(object sender, EventArgs e)
|
||||
{
|
||||
Worker? worker = abazovTreeView.getSelecetedNodeValue<Worker>();
|
||||
if (worker == null) return;
|
||||
MessageBox.Show(worker.department + ", номер группы: " + worker.groupNumber + ", " + worker.name);
|
||||
}
|
||||
|
||||
private void buttonGetIndex_Click(object sender, EventArgs e)
|
||||
{
|
||||
MessageBox.Show(abazovTreeView.SelectedNodeIndex.ToString());
|
||||
}
|
||||
|
||||
private void buttonSetIndex_Click(object sender, EventArgs e)
|
||||
{
|
||||
abazovTreeView.SelectedNodeIndex = 0;
|
||||
}
|
||||
}
|
||||
}
|
60
AbazovApp/AbazovAppView/FormTest.resx
Normal file
60
AbazovApp/AbazovAppView/FormTest.resx
Normal file
@ -0,0 +1,60 @@
|
||||
<root>
|
||||
<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>
|
@ -11,7 +11,7 @@ namespace AbazovAppView
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run(new Form1());
|
||||
Application.Run(new FormTest());
|
||||
}
|
||||
}
|
||||
}
|
22
AbazovApp/AbazovAppView/Worker.cs
Normal file
22
AbazovApp/AbazovAppView/Worker.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AbazovAppView
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
10
AbazovApp/AbazovViewComponents/AbazovViewComponents.csproj
Normal file
10
AbazovApp/AbazovViewComponents/AbazovViewComponents.csproj
Normal file
@ -0,0 +1,10 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
58
AbazovApp/AbazovViewComponents/Components/AbazovCheckedListBox.Designer.cs
generated
Normal file
58
AbazovApp/AbazovViewComponents/Components/AbazovCheckedListBox.Designer.cs
generated
Normal file
@ -0,0 +1,58 @@
|
||||
namespace AbazovViewComponents.Components
|
||||
{
|
||||
partial class AbazovCheckedListBox
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
this.checkedListBox = new System.Windows.Forms.CheckedListBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// checkedListBox
|
||||
//
|
||||
this.checkedListBox.FormattingEnabled = true;
|
||||
this.checkedListBox.Location = new System.Drawing.Point(0, 0);
|
||||
this.checkedListBox.Name = "checkedListBox";
|
||||
this.checkedListBox.Size = new System.Drawing.Size(150, 114);
|
||||
this.checkedListBox.TabIndex = 0;
|
||||
this.checkedListBox.SelectedIndexChanged += new System.EventHandler(this.checkedListBox_SelectedIndexChanged);
|
||||
//
|
||||
// AbazovCheckedListBox
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.checkedListBox);
|
||||
this.Name = "AbazovCheckedListBox";
|
||||
this.Size = new System.Drawing.Size(150, 115);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private CheckedListBox checkedListBox;
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
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 AbazovViewComponents.Components
|
||||
{
|
||||
public partial class AbazovCheckedListBox : UserControl
|
||||
{
|
||||
public AbazovCheckedListBox()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public string? selectedItem
|
||||
{
|
||||
get
|
||||
{
|
||||
return checkedListBox.SelectedItem is null ? null : checkedListBox.SelectedItem.ToString();
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value != null && checkedListBox.Items.Contains(value)) checkedListBox.SelectedItem = value;
|
||||
}
|
||||
}
|
||||
|
||||
public event Action<string?> SelectedItemChange;
|
||||
|
||||
public void addItems(List<string> items)
|
||||
{
|
||||
foreach (string item in items)
|
||||
{
|
||||
checkedListBox.Items.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
public void clear()
|
||||
{
|
||||
checkedListBox.Items.Clear();
|
||||
}
|
||||
|
||||
private void checkedListBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
SelectedItemChange?.Invoke(checkedListBox.SelectedItem.ToString());
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
<root>
|
||||
<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>
|
57
AbazovApp/AbazovViewComponents/Components/AbazovDatePicker.Designer.cs
generated
Normal file
57
AbazovApp/AbazovViewComponents/Components/AbazovDatePicker.Designer.cs
generated
Normal file
@ -0,0 +1,57 @@
|
||||
namespace AbazovViewComponents.Components
|
||||
{
|
||||
partial class AbazovDatePicker
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
this.dateTimePicker = new System.Windows.Forms.DateTimePicker();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// dateTimePicker
|
||||
//
|
||||
this.dateTimePicker.Location = new System.Drawing.Point(3, 3);
|
||||
this.dateTimePicker.Name = "dateTimePicker";
|
||||
this.dateTimePicker.Size = new System.Drawing.Size(250, 27);
|
||||
this.dateTimePicker.TabIndex = 0;
|
||||
this.dateTimePicker.ValueChanged += new System.EventHandler(this.dateTimePicker_ValueChanged);
|
||||
//
|
||||
// AbazovDatePicker
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.dateTimePicker);
|
||||
this.Name = "AbazovDatePicker";
|
||||
this.Size = new System.Drawing.Size(257, 38);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DateTimePicker dateTimePicker;
|
||||
}
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using AbazovViewComponents.Exceptions;
|
||||
|
||||
namespace AbazovViewComponents.Components
|
||||
{
|
||||
public partial class AbazovDatePicker : UserControl
|
||||
{
|
||||
public AbazovDatePicker()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
public event Action<DateTime> DateChange;
|
||||
private bool lowBoundrySet = false;
|
||||
private bool highBoundrySet = false;
|
||||
|
||||
public bool BoundriesSet { get { return lowBoundrySet && highBoundrySet; } }
|
||||
|
||||
public DateTime? dateFrom
|
||||
{
|
||||
get
|
||||
{
|
||||
return lowBoundrySet ? dateTimePicker.MinDate : null;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value.HasValue)
|
||||
{
|
||||
dateTimePicker.MinDate = value.Value;
|
||||
lowBoundrySet = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
public DateTime? dateTo
|
||||
{
|
||||
get
|
||||
{
|
||||
return highBoundrySet ? dateTimePicker.MaxDate : null; }
|
||||
set
|
||||
{
|
||||
if (value.HasValue)
|
||||
{
|
||||
dateTimePicker.MaxDate = value.Value;
|
||||
highBoundrySet = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public DateTime? Value
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!lowBoundrySet || !highBoundrySet || dateTimePicker.Value < dateFrom || dateTimePicker.Value > dateTo) return null;
|
||||
return dateTimePicker.Value;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (lowBoundrySet && highBoundrySet && value.HasValue && value.Value >= dateFrom && value.Value <= dateTo) dateTimePicker.Value = value.Value;
|
||||
}
|
||||
}
|
||||
|
||||
private void dateTimePicker_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
DateChange?.Invoke(dateTimePicker.Value);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
<root>
|
||||
<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>
|
56
AbazovApp/AbazovViewComponents/Components/AbazovTreeView.Designer.cs
generated
Normal file
56
AbazovApp/AbazovViewComponents/Components/AbazovTreeView.Designer.cs
generated
Normal file
@ -0,0 +1,56 @@
|
||||
namespace AbazovViewComponents.Components
|
||||
{
|
||||
partial class AbazovTreeView
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
this.treeView = new System.Windows.Forms.TreeView();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// treeView
|
||||
//
|
||||
this.treeView.Location = new System.Drawing.Point(0, 0);
|
||||
this.treeView.Name = "treeView";
|
||||
this.treeView.Size = new System.Drawing.Size(295, 212);
|
||||
this.treeView.TabIndex = 0;
|
||||
//
|
||||
// AbazovTreeView
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.treeView);
|
||||
this.Name = "AbazovTreeView";
|
||||
this.Size = new System.Drawing.Size(295, 212);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private TreeView treeView;
|
||||
}
|
||||
}
|
90
AbazovApp/AbazovViewComponents/Components/AbazovTreeView.cs
Normal file
90
AbazovApp/AbazovViewComponents/Components/AbazovTreeView.cs
Normal file
@ -0,0 +1,90 @@
|
||||
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 AbazovViewComponents.Components
|
||||
{
|
||||
public partial class AbazovTreeView : UserControl
|
||||
{
|
||||
public AbazovTreeView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
private 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>()
|
||||
{
|
||||
if (treeView.SelectedNode == null || treeView.SelectedNode.Nodes.Count > 0) return default(T);
|
||||
|
||||
TreeNode? node = treeView.SelectedNode;
|
||||
|
||||
var type = typeof(T);
|
||||
var fields = type.GetFields();
|
||||
|
||||
var item = Activator.CreateInstance(type);
|
||||
|
||||
while (node != null)
|
||||
{
|
||||
var field = fields.FirstOrDefault(x => x.Name == node.Name);
|
||||
if (field != null)
|
||||
{
|
||||
field.SetValue(item, node.Text);
|
||||
}
|
||||
node = node.Parent;
|
||||
}
|
||||
|
||||
return item != null ? (T) item : default(T);
|
||||
}
|
||||
|
||||
public void setHierarchy(List<(string, bool)> fields)
|
||||
{
|
||||
hierarchy = fields;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AbazovViewComponents.Exceptions
|
||||
{
|
||||
[Serializable]
|
||||
public class DateBoundsNotSetException: ApplicationException
|
||||
{
|
||||
public DateBoundsNotSetException() : base() { }
|
||||
public DateBoundsNotSetException(string message) : base(message) { }
|
||||
public DateBoundsNotSetException(string message, Exception exception) : base(message, exception){ }
|
||||
protected DateBoundsNotSetException(SerializationInfo info, StreamingContext contex) : base(info, contex) { }
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AbazovViewComponents.Exceptions
|
||||
{
|
||||
public class DateOutOfBoundsException : ApplicationException
|
||||
{
|
||||
public DateOutOfBoundsException() : base() { }
|
||||
public DateOutOfBoundsException(string message) : base(message) { }
|
||||
public DateOutOfBoundsException(string message, Exception exception) : base(message, exception) { }
|
||||
protected DateOutOfBoundsException(SerializationInfo info, StreamingContext contex) : base(info, contex) { }
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user