Compare commits
No commits in common. "Lab02" and "main" have entirely different histories.
@ -5,8 +5,6 @@ VisualStudioVersion = 17.3.32825.248
|
|||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AbazovAppView", "AbazovAppView\AbazovAppView.csproj", "{D7EF43DC-2F09-4EAD-8161-6D4A08BC7786}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AbazovAppView", "AbazovAppView\AbazovAppView.csproj", "{D7EF43DC-2F09-4EAD-8161-6D4A08BC7786}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AbazovViewComponents", "AbazovViewComponents\AbazovViewComponents.csproj", "{070AAA71-3C9B-4E19-A89D-83372C630C6E}"
|
|
||||||
EndProject
|
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@ -17,10 +15,6 @@ Global
|
|||||||
{D7EF43DC-2F09-4EAD-8161-6D4A08BC7786}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{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.ActiveCfg = Release|Any CPU
|
||||||
{D7EF43DC-2F09-4EAD-8161-6D4A08BC7786}.Release|Any CPU.Build.0 = 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
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
@ -8,8 +8,4 @@
|
|||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\AbazovViewComponents\AbazovViewComponents.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
@ -1,20 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace AbazovAppView
|
|
||||||
{
|
|
||||||
public class Department
|
|
||||||
{
|
|
||||||
public string name;
|
|
||||||
public int sells;
|
|
||||||
|
|
||||||
public Department(string name, int sells)
|
|
||||||
{
|
|
||||||
this.name = name;
|
|
||||||
this.sells = sells;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
39
AbazovApp/AbazovAppView/Form1.Designer.cs
generated
Normal file
39
AbazovApp/AbazovAppView/Form1.Designer.cs
generated
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
10
AbazovApp/AbazovAppView/Form1.cs
Normal file
10
AbazovApp/AbazovAppView/Form1.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
namespace AbazovAppView
|
||||||
|
{
|
||||||
|
public partial class Form1 : Form
|
||||||
|
{
|
||||||
|
public Form1()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
AbazovApp/AbazovAppView/Form1.resx
Normal file
120
AbazovApp/AbazovAppView/Form1.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>
|
282
AbazovApp/AbazovAppView/FormTest.Designer.cs
generated
282
AbazovApp/AbazovAppView/FormTest.Designer.cs
generated
@ -1,282 +0,0 @@
|
|||||||
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.components = new System.ComponentModel.Container();
|
|
||||||
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.excelImagesComponent = new AbazovViewComponents.LogicalComponents.ExcelImagesComponent(this.components);
|
|
||||||
this.buttonExcelImages = new System.Windows.Forms.Button();
|
|
||||||
this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
|
|
||||||
this.buttonExcelTable = new System.Windows.Forms.Button();
|
|
||||||
this.excelTableComponent = new AbazovViewComponents.LogicalComponents.ExcelTableComponent(this.components);
|
|
||||||
this.excelDiagramComponent = new AbazovViewComponents.LogicalComponents.ExcelDiagramComponent(this.components);
|
|
||||||
this.buttonExcelDiagram = 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.Value = null;
|
|
||||||
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);
|
|
||||||
//
|
|
||||||
// buttonExcelImages
|
|
||||||
//
|
|
||||||
this.buttonExcelImages.Location = new System.Drawing.Point(12, 327);
|
|
||||||
this.buttonExcelImages.Name = "buttonExcelImages";
|
|
||||||
this.buttonExcelImages.Size = new System.Drawing.Size(150, 29);
|
|
||||||
this.buttonExcelImages.TabIndex = 14;
|
|
||||||
this.buttonExcelImages.Text = "Excel (картинки)";
|
|
||||||
this.buttonExcelImages.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonExcelImages.Click += new System.EventHandler(this.buttonExcelImages_Click);
|
|
||||||
//
|
|
||||||
// openFileDialog
|
|
||||||
//
|
|
||||||
this.openFileDialog.Filter = "Изображения|*.png;*.jpg;";
|
|
||||||
this.openFileDialog.Multiselect = true;
|
|
||||||
this.openFileDialog.Title = "Выберте изображения";
|
|
||||||
//
|
|
||||||
// buttonExcelTable
|
|
||||||
//
|
|
||||||
this.buttonExcelTable.Location = new System.Drawing.Point(168, 327);
|
|
||||||
this.buttonExcelTable.Name = "buttonExcelTable";
|
|
||||||
this.buttonExcelTable.Size = new System.Drawing.Size(128, 29);
|
|
||||||
this.buttonExcelTable.TabIndex = 15;
|
|
||||||
this.buttonExcelTable.Text = "Excel (Таблица)";
|
|
||||||
this.buttonExcelTable.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonExcelTable.Click += new System.EventHandler(this.buttonExcelTable_Click);
|
|
||||||
//
|
|
||||||
// buttonExcelDiagram
|
|
||||||
//
|
|
||||||
this.buttonExcelDiagram.Location = new System.Drawing.Point(12, 372);
|
|
||||||
this.buttonExcelDiagram.Name = "buttonExcelDiagram";
|
|
||||||
this.buttonExcelDiagram.Size = new System.Drawing.Size(150, 29);
|
|
||||||
this.buttonExcelDiagram.TabIndex = 16;
|
|
||||||
this.buttonExcelDiagram.Text = "Excel (Диаграмма)";
|
|
||||||
this.buttonExcelDiagram.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonExcelDiagram.Click += new System.EventHandler(this.buttonExcelDiagram_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.buttonExcelDiagram);
|
|
||||||
this.Controls.Add(this.buttonExcelTable);
|
|
||||||
this.Controls.Add(this.buttonExcelImages);
|
|
||||||
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;
|
|
||||||
private AbazovViewComponents.LogicalComponents.ExcelImagesComponent excelImagesComponent;
|
|
||||||
private Button buttonExcelImages;
|
|
||||||
private OpenFileDialog openFileDialog;
|
|
||||||
private Button buttonExcelTable;
|
|
||||||
private AbazovViewComponents.LogicalComponents.ExcelTableComponent excelTableComponent;
|
|
||||||
private AbazovViewComponents.LogicalComponents.ExcelDiagramComponent excelDiagramComponent;
|
|
||||||
private Button buttonExcelDiagram;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,180 +0,0 @@
|
|||||||
using AbazovViewComponents.Components;
|
|
||||||
using AbazovViewComponents.Exceptions;
|
|
||||||
using AbazovViewComponents.LogicalComponents;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonExcelImages_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var res = openFileDialog.ShowDialog(this);
|
|
||||||
if (res != DialogResult.OK) return;
|
|
||||||
var files = openFileDialog.FileNames;
|
|
||||||
openFileDialog.Dispose();
|
|
||||||
List<Bitmap> images = new List<Bitmap>();
|
|
||||||
string path = AppDomain.CurrentDomain.BaseDirectory + "test.xlsx";
|
|
||||||
if (excelImagesComponent.createWithImages(new ExcelImageInfo(path, "Header", files))) MessageBox.Show("Успех!");
|
|
||||||
else MessageBox.Show("Ошибка, проверьте консоль");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonExcelTable_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
List<OfficeWorker> workers = new List<OfficeWorker>();
|
|
||||||
|
|
||||||
workers.Add(new OfficeWorker(1, "Иванов", "Иван", 20, "Отдел продаж", "Бухгалтер", 25, "+7(834)234-03-49"));
|
|
||||||
workers.Add(new OfficeWorker(1, "Петров", "Петр", 25, "Отдел продаж", "Менеджер", 20, "+7(834)123-03-49"));
|
|
||||||
workers.Add(new OfficeWorker(1, "Сидоров", "Сергей", 27, "Отдел кадров", "HR", 2, "+7(834)593-03-49", true));
|
|
||||||
string path = AppDomain.CurrentDomain.BaseDirectory + "test2.xlsx";
|
|
||||||
List<(int, int)> merges = new List<(int, int)>();
|
|
||||||
merges.Add((1, 3));
|
|
||||||
merges.Add((4, 6));
|
|
||||||
List<int> heights = Enumerable.Repeat(20, 9).ToList();
|
|
||||||
|
|
||||||
List<(string, string)> headers = new List<(string, string)> { ("id", "id"), ("", "Личные данные"),
|
|
||||||
("lastName", "Фамилия"), ("firstName", "Имя"),
|
|
||||||
("age", "Возраст"), ("", "Работа"),
|
|
||||||
("department", "Отдел"), ("position", "Должность"),
|
|
||||||
("boxNumber", "Номер бокса"), ("phoneNumber", "Телефон"),
|
|
||||||
("isInVacation", "В отпуске"), };
|
|
||||||
|
|
||||||
if (excelTableComponent.createWithTable(path, "test2", merges, heights, headers, workers)) MessageBox.Show("Успех");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonExcelDiagram_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
List<Department> departments = new List<Department>();
|
|
||||||
|
|
||||||
departments.Add(new Department("Dep 1", 330));
|
|
||||||
departments.Add(new Department("Dep 2", 500));
|
|
||||||
departments.Add(new Department("Dep 3", 170));
|
|
||||||
string path = AppDomain.CurrentDomain.BaseDirectory + "test3.xlsx";
|
|
||||||
if (excelDiagramComponent.createWithDiagram(path, "test3", "Продажи", DiagramLegendEnum.TopRight, departments, "name", "sells")) MessageBox.Show("Успех");
|
|
||||||
else MessageBox.Show("Fail :(");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,72 +0,0 @@
|
|||||||
<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>
|
|
||||||
<metadata name="excelImagesComponent.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
|
||||||
<value>17, 17</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="openFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
|
||||||
<value>233, 17</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="excelTableComponent.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
|
||||||
<value>392, 17</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="excelDiagramComponent.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
|
||||||
<value>596, 17</value>
|
|
||||||
</metadata>
|
|
||||||
</root>
|
|
@ -1,34 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace AbazovAppView
|
|
||||||
{
|
|
||||||
public class OfficeWorker
|
|
||||||
{
|
|
||||||
public OfficeWorker(int id, string lastName, string firstName, int age, string department, string position, int boxNumber, string phoneNumber, bool isInVacation = false)
|
|
||||||
{
|
|
||||||
this.id = id;
|
|
||||||
this.lastName = lastName;
|
|
||||||
this.firstName = firstName;
|
|
||||||
this.age = age;
|
|
||||||
this.department = department;
|
|
||||||
this.position = position;
|
|
||||||
this.boxNumber = boxNumber;
|
|
||||||
this.phoneNumber = phoneNumber;
|
|
||||||
this.isInVacation = isInVacation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int id;
|
|
||||||
public string lastName;
|
|
||||||
public string firstName;
|
|
||||||
public int age;
|
|
||||||
public string department;
|
|
||||||
public string position;
|
|
||||||
public int boxNumber;
|
|
||||||
public string phoneNumber;
|
|
||||||
public bool isInVacation;
|
|
||||||
}
|
|
||||||
}
|
|
@ -11,7 +11,7 @@ namespace AbazovAppView
|
|||||||
// To customize application configuration such as set high DPI settings or default font,
|
// To customize application configuration such as set high DPI settings or default font,
|
||||||
// see https://aka.ms/applicationconfiguration.
|
// see https://aka.ms/applicationconfiguration.
|
||||||
ApplicationConfiguration.Initialize();
|
ApplicationConfiguration.Initialize();
|
||||||
Application.Run(new FormTest());
|
Application.Run(new Form1());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,22 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net6.0-windows</TargetFramework>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
<UseWindowsForms>true</UseWindowsForms>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<COMReference Include="Microsoft.Office.Core">
|
|
||||||
<WrapperTool>tlbimp</WrapperTool>
|
|
||||||
<VersionMinor>8</VersionMinor>
|
|
||||||
<VersionMajor>2</VersionMajor>
|
|
||||||
<Guid>2df8d04c-5bfa-101b-bde5-00aa0044de52</Guid>
|
|
||||||
<Lcid>0</Lcid>
|
|
||||||
<Isolated>false</Isolated>
|
|
||||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
|
||||||
<Private>true</Private>
|
|
||||||
</COMReference>
|
|
||||||
<COMReference Include="Microsoft.Office.Interop.Excel">
|
|
||||||
<WrapperTool>tlbimp</WrapperTool>
|
|
||||||
<VersionMinor>9</VersionMinor>
|
|
||||||
<VersionMajor>1</VersionMajor>
|
|
||||||
<Guid>00020813-0000-0000-c000-000000000046</Guid>
|
|
||||||
<Lcid>0</Lcid>
|
|
||||||
<Isolated>false</Isolated>
|
|
||||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
|
||||||
<Private>true</Private>
|
|
||||||
</COMReference>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
@ -1,58 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,52 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace 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());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
<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>
|
|
@ -1,57 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,74 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
<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>
|
|
@ -1,56 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,90 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
<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>
|
|
@ -1,19 +0,0 @@
|
|||||||
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) { }
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
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) { }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace AbazovViewComponents.LogicalComponents
|
|
||||||
{
|
|
||||||
public enum DiagramLegendEnum
|
|
||||||
{
|
|
||||||
TopLeft = 0,
|
|
||||||
TopRight = 1,
|
|
||||||
BottomRight = 2,
|
|
||||||
BottomLeft = 3,
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,36 +0,0 @@
|
|||||||
namespace AbazovViewComponents.LogicalComponents
|
|
||||||
{
|
|
||||||
partial class ExcelDiagramComponent
|
|
||||||
{
|
|
||||||
/// <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()
|
|
||||||
{
|
|
||||||
components = new System.ComponentModel.Container();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,118 +0,0 @@
|
|||||||
using Microsoft.Office.Interop.Excel;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace AbazovViewComponents.LogicalComponents
|
|
||||||
{
|
|
||||||
public partial class ExcelDiagramComponent : Component
|
|
||||||
{
|
|
||||||
public ExcelDiagramComponent()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ExcelDiagramComponent(IContainer container)
|
|
||||||
{
|
|
||||||
container.Add(this);
|
|
||||||
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool createWithDiagram<T>(string path, string title, string diagramTitle, DiagramLegendEnum diagramLegendAnchor, List<T> data, string seriesNameField, string valueField)
|
|
||||||
{
|
|
||||||
var excelApp = new Microsoft.Office.Interop.Excel.Application { SheetsInNewWorkbook = 1 };
|
|
||||||
Workbook workbook = excelApp.Workbooks.Add(Type.Missing);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Worksheet worksheet = (Worksheet)workbook.Worksheets.get_Item(1);
|
|
||||||
|
|
||||||
FieldInfo? seriesName = typeof(T).GetField(seriesNameField);
|
|
||||||
FieldInfo? value = typeof(T).GetField(valueField);
|
|
||||||
if (seriesName == null || value == null) throw new ArgumentException("Переданного поля не существует");
|
|
||||||
int columnCount = 2;
|
|
||||||
foreach(var item in data)
|
|
||||||
{
|
|
||||||
var cell = worksheet.get_Range("A" + columnCount, "A" + columnCount);
|
|
||||||
cell.Font.Size = 14;
|
|
||||||
cell.Font.Name = "Times New Roman";
|
|
||||||
cell.ColumnWidth = 8;
|
|
||||||
cell.RowHeight = 25;
|
|
||||||
cell.HorizontalAlignment = Constants.xlCenter;
|
|
||||||
cell.VerticalAlignment = Constants.xlCenter;
|
|
||||||
cell.Value2 = seriesName.GetValue(item);
|
|
||||||
|
|
||||||
cell = worksheet.get_Range("B" + columnCount, "B" + columnCount);
|
|
||||||
cell.Font.Size = 14;
|
|
||||||
cell.Font.Name = "Times New Roman";
|
|
||||||
cell.ColumnWidth = 8;
|
|
||||||
cell.RowHeight = 25;
|
|
||||||
cell.HorizontalAlignment = Constants.xlCenter;
|
|
||||||
cell.VerticalAlignment = Constants.xlCenter;
|
|
||||||
cell.Value2 = value.GetValue(item);
|
|
||||||
|
|
||||||
columnCount++;
|
|
||||||
}
|
|
||||||
|
|
||||||
//header
|
|
||||||
var excelcells = worksheet.get_Range("A1", "A1");
|
|
||||||
excelcells.Font.Bold = true;
|
|
||||||
excelcells.Font.Size = 14;
|
|
||||||
excelcells.Font.Name = "Times New Roman";
|
|
||||||
excelcells.ColumnWidth = 8;
|
|
||||||
excelcells.RowHeight = 25;
|
|
||||||
excelcells.HorizontalAlignment = Constants.xlCenter;
|
|
||||||
excelcells.VerticalAlignment = Constants.xlCenter;
|
|
||||||
excelcells.Value2 = title;
|
|
||||||
|
|
||||||
var charts = worksheet.ChartObjects() as ChartObjects;
|
|
||||||
int chartWidth = 300;
|
|
||||||
int chartHeight = 300;
|
|
||||||
var chartObject = charts.Add(250, 10, chartWidth, chartHeight);
|
|
||||||
var chart = chartObject.Chart;
|
|
||||||
var range = worksheet.get_Range($"A2", $"B{columnCount - 1}");
|
|
||||||
chart.SetSourceData(range);
|
|
||||||
chart.ChartType = XlChartType.xlPie;
|
|
||||||
switch (diagramLegendAnchor)
|
|
||||||
{
|
|
||||||
case DiagramLegendEnum.TopLeft:
|
|
||||||
chart.Legend.Top = 0;
|
|
||||||
chart.Legend.Left = 0;
|
|
||||||
break;
|
|
||||||
case DiagramLegendEnum.TopRight:
|
|
||||||
chart.Legend.Top = 0;
|
|
||||||
chart.Legend.Left = chartWidth - chart.Legend.Width;
|
|
||||||
break;
|
|
||||||
case DiagramLegendEnum.BottomLeft:
|
|
||||||
chart.Legend.Top = chartHeight - chart.Legend.Height;
|
|
||||||
chart.Legend.Left = 0;
|
|
||||||
break;
|
|
||||||
case DiagramLegendEnum.BottomRight:
|
|
||||||
chart.Legend.Top = chartHeight - chart.Legend.Height;
|
|
||||||
chart.Legend.Left = chartWidth - chart.Legend.Width;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
chart.ChartWizard(Source: range, Title: diagramTitle);
|
|
||||||
|
|
||||||
object missing = System.Reflection.Missing.Value;
|
|
||||||
workbook.SaveAs(path, XlFileFormat.xlOpenXMLWorkbook, missing, missing, false, false, XlSaveAsAccessMode.xlNoChange,
|
|
||||||
XlSaveConflictResolution.xlUserResolution, true, missing, missing, missing);
|
|
||||||
workbook.Close();
|
|
||||||
excelApp.Quit();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
workbook.Close();
|
|
||||||
excelApp.Quit();
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace AbazovViewComponents.LogicalComponents
|
|
||||||
{
|
|
||||||
public class ExcelImageInfo
|
|
||||||
{
|
|
||||||
public ExcelImageInfo(string path, string title, string[] imagePaths)
|
|
||||||
{
|
|
||||||
this.path = path;
|
|
||||||
this.title = title;
|
|
||||||
this.imagePaths = imagePaths;
|
|
||||||
}
|
|
||||||
|
|
||||||
public string path;
|
|
||||||
public string title;
|
|
||||||
public string[] imagePaths;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,36 +0,0 @@
|
|||||||
namespace AbazovViewComponents.LogicalComponents
|
|
||||||
{
|
|
||||||
partial class ExcelImagesComponent
|
|
||||||
{
|
|
||||||
/// <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()
|
|
||||||
{
|
|
||||||
components = new System.ComponentModel.Container();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,74 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Microsoft.Office.Interop.Excel;
|
|
||||||
using Microsoft.Office.Core;
|
|
||||||
|
|
||||||
namespace AbazovViewComponents.LogicalComponents
|
|
||||||
{
|
|
||||||
public partial class ExcelImagesComponent : Component
|
|
||||||
{
|
|
||||||
public ExcelImagesComponent()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ExcelImagesComponent(IContainer container)
|
|
||||||
{
|
|
||||||
container.Add(this);
|
|
||||||
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool createWithImages(ExcelImageInfo info)
|
|
||||||
{
|
|
||||||
var excelApp = new Microsoft.Office.Interop.Excel.Application { SheetsInNewWorkbook = 1 };
|
|
||||||
Workbook workbook = excelApp.Workbooks.Add(Type.Missing);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
//create
|
|
||||||
Worksheet worksheet = (Worksheet)workbook.Worksheets.get_Item(1);
|
|
||||||
|
|
||||||
//header
|
|
||||||
var excelcells = worksheet.get_Range("A1", "D1");
|
|
||||||
excelcells.Merge(Type.Missing);
|
|
||||||
excelcells.Font.Bold = true;
|
|
||||||
excelcells.Font.Size = 14;
|
|
||||||
excelcells.Font.Name = "Times New Roman";
|
|
||||||
excelcells.ColumnWidth = 8;
|
|
||||||
excelcells.RowHeight = 25;
|
|
||||||
excelcells.HorizontalAlignment = Constants.xlCenter;
|
|
||||||
excelcells.VerticalAlignment = Constants.xlCenter;
|
|
||||||
excelcells.Value2 = info.title;
|
|
||||||
|
|
||||||
int topOffset = 25;
|
|
||||||
foreach (string path in info.imagePaths)
|
|
||||||
{
|
|
||||||
Bitmap bm = new Bitmap(path);
|
|
||||||
worksheet.Shapes.AddPicture2(path, MsoTriState.msoFalse, MsoTriState.msoCTrue, 0, topOffset, bm.Width, bm.Height, MsoPictureCompress.msoPictureCompressFalse);
|
|
||||||
topOffset += bm.Height;
|
|
||||||
bm.Dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
//save
|
|
||||||
object missing = System.Reflection.Missing.Value;
|
|
||||||
workbook.SaveAs(info.path, XlFileFormat.xlOpenXMLWorkbook, missing, missing, false, false, XlSaveAsAccessMode.xlNoChange,
|
|
||||||
XlSaveConflictResolution.xlUserResolution, true, missing, missing, missing);
|
|
||||||
workbook.Close();
|
|
||||||
excelApp.Quit();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
workbook.Close();
|
|
||||||
excelApp.Quit();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,36 +0,0 @@
|
|||||||
namespace AbazovViewComponents.LogicalComponents
|
|
||||||
{
|
|
||||||
partial class ExcelTableComponent
|
|
||||||
{
|
|
||||||
/// <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()
|
|
||||||
{
|
|
||||||
components = new System.ComponentModel.Container();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,194 +0,0 @@
|
|||||||
using Microsoft.Office.Core;
|
|
||||||
using Microsoft.Office.Interop.Excel;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data.Common;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace AbazovViewComponents.LogicalComponents
|
|
||||||
{
|
|
||||||
public partial class ExcelTableComponent : Component
|
|
||||||
{
|
|
||||||
public ExcelTableComponent()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ExcelTableComponent(IContainer container)
|
|
||||||
{
|
|
||||||
container.Add(this);
|
|
||||||
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
|
|
||||||
private string GetExcelColumnName(int columnNumber)
|
|
||||||
{
|
|
||||||
string columnName = "";
|
|
||||||
|
|
||||||
while (columnNumber > 0)
|
|
||||||
{
|
|
||||||
int modulo = (columnNumber - 1) % 26;
|
|
||||||
columnName = Convert.ToChar('A' + modulo) + columnName;
|
|
||||||
columnNumber = (columnNumber - modulo) / 26;
|
|
||||||
}
|
|
||||||
|
|
||||||
return columnName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool createWithTable<T>(string path, string title, List<(int, int)> merges, List<int> heights, List<(string, string)> headers, List<T> items)
|
|
||||||
{
|
|
||||||
if (merges.Count == 0 || heights.Count == 0 || headers.Count == 0 || items.Count == 0) throw new ArgumentException("Недостаточно данных");
|
|
||||||
int[] cellsArray = new int[heights.Count];
|
|
||||||
foreach (var merge in merges)
|
|
||||||
{
|
|
||||||
if (merge.Item1 >= merge.Item2) throw new ArgumentException("Неправильно заполнены объединения строк");
|
|
||||||
for (int i = merge.Item1; i < merge.Item2; i++)
|
|
||||||
{
|
|
||||||
cellsArray[i]++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
foreach (int cell in cellsArray)
|
|
||||||
{
|
|
||||||
if (cell > 1) throw new ArgumentException("Объединения заходят друг на друга");
|
|
||||||
}
|
|
||||||
|
|
||||||
var excelApp = new Microsoft.Office.Interop.Excel.Application { SheetsInNewWorkbook = 1 };
|
|
||||||
Workbook workbook = excelApp.Workbooks.Add(Type.Missing);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
//create
|
|
||||||
Worksheet worksheet = (Worksheet)workbook.Worksheets.get_Item(1);
|
|
||||||
|
|
||||||
//header
|
|
||||||
var excelcells = worksheet.get_Range("A1", "A1");
|
|
||||||
excelcells.Font.Bold = true;
|
|
||||||
excelcells.Font.Size = 14;
|
|
||||||
excelcells.Font.Name = "Times New Roman";
|
|
||||||
excelcells.ColumnWidth = 8;
|
|
||||||
excelcells.RowHeight = 25;
|
|
||||||
excelcells.HorizontalAlignment = Constants.xlCenter;
|
|
||||||
excelcells.VerticalAlignment = Constants.xlCenter;
|
|
||||||
excelcells.Value2 = title;
|
|
||||||
|
|
||||||
//checks
|
|
||||||
List<Microsoft.Office.Interop.Excel.Range> ranges = new List<Microsoft.Office.Interop.Excel.Range>();
|
|
||||||
foreach (var merge in merges)
|
|
||||||
{
|
|
||||||
ranges.Add(worksheet.get_Range("A" + (merge.Item1 + 2), "A" + (merge.Item2 + 2)));
|
|
||||||
}
|
|
||||||
|
|
||||||
int rangeIndex = 0;
|
|
||||||
int headerIndex = 0;
|
|
||||||
List<FieldInfo> cellFields = new List<FieldInfo>();
|
|
||||||
var type = typeof(T);
|
|
||||||
for (int i = 0; i < heights.Count; i++)
|
|
||||||
{
|
|
||||||
if (cellsArray[i] == 1)
|
|
||||||
{
|
|
||||||
//work with merge
|
|
||||||
if (!string.IsNullOrEmpty(headers[headerIndex].Item1)) throw new ArgumentException("Заголовки и объединения строк не совпадают");
|
|
||||||
|
|
||||||
var groupRange = ranges[rangeIndex];
|
|
||||||
groupRange.Merge(Type.Missing);
|
|
||||||
groupRange.Font.Bold = true;
|
|
||||||
groupRange.Font.Size = 14;
|
|
||||||
groupRange.Font.Name = "Times New Roman";
|
|
||||||
groupRange.ColumnWidth = 20;
|
|
||||||
groupRange.HorizontalAlignment = Constants.xlCenter;
|
|
||||||
groupRange.VerticalAlignment = Constants.xlCenter;
|
|
||||||
groupRange.Value2 = headers[headerIndex].Item2;
|
|
||||||
headerIndex++;
|
|
||||||
|
|
||||||
//work with cells in merge
|
|
||||||
for (; i <= merges[rangeIndex].Item2; i++)
|
|
||||||
{
|
|
||||||
//work with cell
|
|
||||||
if (string.IsNullOrEmpty(headers[headerIndex].Item1)) throw new ArgumentException("Заголовки и объединения строк не совпадают");
|
|
||||||
var field = type.GetField(headers[headerIndex].Item1);
|
|
||||||
if (field == null) throw new ArgumentException("В заголовках указано поле, которого нет в переданном классе");
|
|
||||||
//format header
|
|
||||||
var range = worksheet.get_Range("B" + (i + 2), "B" + (i + 2));
|
|
||||||
range.Font.Bold = true;
|
|
||||||
range.Font.Size = 14;
|
|
||||||
range.Font.Name = "Times New Roman";
|
|
||||||
range.ColumnWidth = 20;
|
|
||||||
range.RowHeight = heights[i];
|
|
||||||
range.HorizontalAlignment = Constants.xlCenter;
|
|
||||||
range.VerticalAlignment = Constants.xlCenter;
|
|
||||||
range.Value2 = headers[headerIndex].Item2;
|
|
||||||
|
|
||||||
cellFields.Add(field);
|
|
||||||
headerIndex++;
|
|
||||||
}
|
|
||||||
i--;
|
|
||||||
rangeIndex++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//work with cell
|
|
||||||
if (string.IsNullOrEmpty(headers[headerIndex].Item1)) throw new ArgumentException("Заголовки и объединения строк не совпадают");
|
|
||||||
var field = type.GetField(headers[headerIndex].Item1);
|
|
||||||
if (field == null) throw new ArgumentException("В заголовках указано поле, которого нет в переданном классе");
|
|
||||||
//format header
|
|
||||||
var range = worksheet.get_Range("A" + (i + 2), "B" + (i + 2));
|
|
||||||
range.Merge(Type.Missing);
|
|
||||||
range.Font.Bold = true;
|
|
||||||
range.Font.Size = 14;
|
|
||||||
range.Font.Name = "Times New Roman";
|
|
||||||
range.ColumnWidth = 40;
|
|
||||||
range.RowHeight = heights[i];
|
|
||||||
range.HorizontalAlignment = Constants.xlCenter;
|
|
||||||
range.VerticalAlignment = Constants.xlCenter;
|
|
||||||
range.Value2 = headers[headerIndex].Item2;
|
|
||||||
|
|
||||||
cellFields.Add(field);
|
|
||||||
headerIndex++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int columnNum = 3;
|
|
||||||
foreach (T item in items)
|
|
||||||
{
|
|
||||||
string column = GetExcelColumnName(columnNum);
|
|
||||||
int rowNum = 2;
|
|
||||||
foreach (var cellField in cellFields)
|
|
||||||
{
|
|
||||||
var range = worksheet.get_Range(column + rowNum, column + rowNum);
|
|
||||||
range.Font.Size = 14;
|
|
||||||
range.Font.Name = "Times New Roman";
|
|
||||||
range.ColumnWidth = 20;
|
|
||||||
range.HorizontalAlignment = Constants.xlCenter;
|
|
||||||
range.VerticalAlignment = Constants.xlCenter;
|
|
||||||
range.Value2 = cellField.FieldType == typeof(bool) ? ((bool) cellField.GetValue(item) ? "Да" : "Нет") : cellField.GetValue(item);
|
|
||||||
|
|
||||||
rowNum++;
|
|
||||||
}
|
|
||||||
columnNum++;
|
|
||||||
}
|
|
||||||
var borderRange = worksheet.get_Range("A2", GetExcelColumnName(columnNum-1) + (headerIndex - 1));
|
|
||||||
borderRange.Borders.LineStyle = XlLineStyle.xlContinuous;
|
|
||||||
borderRange.Borders.Weight = 2d;
|
|
||||||
|
|
||||||
//save
|
|
||||||
object missing = System.Reflection.Missing.Value;
|
|
||||||
workbook.SaveAs(path, XlFileFormat.xlOpenXMLWorkbook, missing, missing, false, false, XlSaveAsAccessMode.xlNoChange,
|
|
||||||
XlSaveConflictResolution.xlUserResolution, true, missing, missing, missing);
|
|
||||||
workbook.Close();
|
|
||||||
excelApp.Quit();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
workbook.Close();
|
|
||||||
excelApp.Quit();
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user