diff --git a/COP/ChubykinaComponents/ChubykinaComponents.csproj b/COP/ChubykinaComponents/ChubykinaComponents.csproj
index 03c84ac..273a91f 100644
--- a/COP/ChubykinaComponents/ChubykinaComponents.csproj
+++ b/COP/ChubykinaComponents/ChubykinaComponents.csproj
@@ -6,6 +6,7 @@
true
enable
True
+ $(VersionPrefix)1.0.3
diff --git a/COP/ChubykinaComponents/Components/UserCheckedListBox.cs b/COP/ChubykinaComponents/Components/UserCheckedListBox.cs
index 6162067..206e374 100644
--- a/COP/ChubykinaComponents/Components/UserCheckedListBox.cs
+++ b/COP/ChubykinaComponents/Components/UserCheckedListBox.cs
@@ -25,7 +25,10 @@ namespace ChubykinaComponents.Components
}
set
{
- if (value != null && checkedListBox.Items.Contains(value)) checkedListBox.SelectedItem = value;
+ if (value != null && checkedListBox.Items.Contains(value)) {
+ checkedListBox.SelectedItem = value;
+ checkedListBox.SetItemChecked(checkedListBox.SelectedIndex, true);
+ }
}
}
diff --git a/COP/ChubykinaComponents/Components/UserTreeView.cs b/COP/ChubykinaComponents/Components/UserTreeView.cs
index 917e351..91f5d10 100644
--- a/COP/ChubykinaComponents/Components/UserTreeView.cs
+++ b/COP/ChubykinaComponents/Components/UserTreeView.cs
@@ -17,6 +17,7 @@ namespace ChubykinaComponents.Components
{
InitializeComponent();
}
+
private List<(string, bool)> hierarchy = new List<(string, bool)>();
public int SelectedNodeIndex
@@ -27,8 +28,10 @@ namespace ChubykinaComponents.Components
}
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;
+ 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;
}
}
@@ -37,15 +40,15 @@ namespace ChubykinaComponents.Components
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 properties = type.GetProperties();
var item = Activator.CreateInstance(type);
while (node != null)
{
- var field = fields.FirstOrDefault(x => x.Name == node.Name);
- if (field != null)
+ var property = properties.FirstOrDefault(x => x.Name == node.Name);
+ if (property != null)
{
- field.SetValue(item, node.Text);
+ property.SetValue(item, Convert.ChangeType(node.Text, property.PropertyType));
}
node = node.Parent;
}
@@ -61,23 +64,23 @@ namespace ChubykinaComponents.Components
public void addItems(List items)
{
var type = typeof(T);
- var fields = type.GetFields();
+ var properties = type.GetProperties();
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 property = properties.FirstOrDefault(x => x.Name.Equals(hierarchy[i].Item1));
+ if (property is not null)
{
- var node = nodes.Find(field.Name, false).FirstOrDefault(x => x.Text == field.GetValue(item).ToString());
+ var node = nodes.Find(property.Name, false).FirstOrDefault(x => x.Text == property.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());
+ TreeNode newNode = nodes.Add(property.Name, property.GetValue(item).ToString());
nodes = newNode.Nodes;
}
}
diff --git a/COP/WinFormsTest/FormClient.Designer.cs b/COP/WinFormsTest/FormClient.Designer.cs
index 6c8d41b..1c2c085 100644
--- a/COP/WinFormsTest/FormClient.Designer.cs
+++ b/COP/WinFormsTest/FormClient.Designer.cs
@@ -30,10 +30,8 @@
{
this.label1 = new System.Windows.Forms.Label();
this.textBoxFio = new System.Windows.Forms.TextBox();
- this.textBoxPassword = new System.Windows.Forms.TextBox();
- this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
- this.mailControl = new BulatovaComponents.MailControl();
+ this.mailControl = new BulatovaComponents.Components.MailControl();
this.userCheckedListBox = new ChubykinaComponents.Components.UserCheckedListBox();
this.label4 = new System.Windows.Forms.Label();
this.buttonSave = new System.Windows.Forms.Button();
@@ -46,43 +44,25 @@
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(12, 9);
+ this.label1.Location = new System.Drawing.Point(12, 20);
this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(52, 20);
+ this.label1.Size = new System.Drawing.Size(42, 20);
this.label1.TabIndex = 0;
this.label1.Text = "ФИО";
//
// textBoxFio
//
this.textBoxFio.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
- this.textBoxFio.Location = new System.Drawing.Point(12, 32);
+ this.textBoxFio.Location = new System.Drawing.Point(12, 43);
this.textBoxFio.Name = "textBoxFio";
this.textBoxFio.Size = new System.Drawing.Size(389, 27);
this.textBoxFio.TabIndex = 1;
//
- // textBoxPassword
- //
- this.textBoxPassword.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
- this.textBoxPassword.Location = new System.Drawing.Point(12, 86);
- this.textBoxPassword.Name = "textBoxPassword";
- this.textBoxPassword.Size = new System.Drawing.Size(389, 27);
- this.textBoxPassword.TabIndex = 3;
- //
- // label2
- //
- this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
- this.label2.AutoSize = true;
- this.label2.Location = new System.Drawing.Point(12, 63);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(62, 20);
- this.label2.TabIndex = 2;
- this.label2.Text = "Пароль";
- //
// label3
//
this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.label3.AutoSize = true;
- this.label3.Location = new System.Drawing.Point(12, 116);
+ this.label3.Location = new System.Drawing.Point(12, 90);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(51, 20);
this.label3.TabIndex = 4;
@@ -92,7 +72,7 @@
//
this.mailControl.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.mailControl.Email = null;
- this.mailControl.Location = new System.Drawing.Point(12, 139);
+ this.mailControl.Location = new System.Drawing.Point(12, 113);
this.mailControl.Name = "mailControl";
this.mailControl.Size = new System.Drawing.Size(389, 42);
this.mailControl.TabIndex = 5;
@@ -101,8 +81,8 @@
// userCheckedListBox
//
this.userCheckedListBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
- this.userCheckedListBox.Location = new System.Drawing.Point(12, 207);
- this.userCheckedListBox.Name = "UserCheckedListBox";
+ this.userCheckedListBox.Location = new System.Drawing.Point(12, 181);
+ this.userCheckedListBox.Name = "userCheckedListBox";
this.userCheckedListBox.selectedItem = null;
this.userCheckedListBox.Size = new System.Drawing.Size(389, 130);
this.userCheckedListBox.TabIndex = 6;
@@ -111,15 +91,15 @@
//
this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.label4.AutoSize = true;
- this.label4.Location = new System.Drawing.Point(12, 184);
+ this.label4.Location = new System.Drawing.Point(12, 158);
this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(78, 20);
+ this.label4.Size = new System.Drawing.Size(82, 20);
this.label4.TabIndex = 7;
- this.label4.Text = "Интересы";
+ this.label4.Text = "Категории";
//
// buttonSave
//
- this.buttonSave.Location = new System.Drawing.Point(12, 420);
+ this.buttonSave.Location = new System.Drawing.Point(12, 350);
this.buttonSave.Name = "buttonSave";
this.buttonSave.Size = new System.Drawing.Size(94, 29);
this.buttonSave.TabIndex = 8;
@@ -129,7 +109,7 @@
//
// buttonCancel
//
- this.buttonCancel.Location = new System.Drawing.Point(307, 420);
+ this.buttonCancel.Location = new System.Drawing.Point(307, 350);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(94, 29);
this.buttonCancel.TabIndex = 9;
@@ -143,7 +123,7 @@
//
// buttonAvatar
//
- this.buttonAvatar.Location = new System.Drawing.Point(12, 343);
+ this.buttonAvatar.Location = new System.Drawing.Point(12, 304);
this.buttonAvatar.Name = "buttonAvatar";
this.buttonAvatar.Size = new System.Drawing.Size(389, 29);
this.buttonAvatar.TabIndex = 10;
@@ -155,7 +135,7 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(413, 461);
+ this.ClientSize = new System.Drawing.Size(413, 392);
this.Controls.Add(this.buttonAvatar);
this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.buttonSave);
@@ -163,8 +143,6 @@
this.Controls.Add(this.userCheckedListBox);
this.Controls.Add(this.mailControl);
this.Controls.Add(this.label3);
- this.Controls.Add(this.textBoxPassword);
- this.Controls.Add(this.label2);
this.Controls.Add(this.textBoxFio);
this.Controls.Add(this.label1);
this.Name = "FormClient";
@@ -179,10 +157,8 @@
private Label label1;
private TextBox textBoxFio;
- private TextBox textBoxPassword;
- private Label label2;
private Label label3;
- private BulatovaComponents.MailControl mailControl;
+ private BulatovaComponents.Components.MailControl mailControl;
private ChubykinaComponents.Components.UserCheckedListBox userCheckedListBox;
private Label label4;
private Button buttonSave;
diff --git a/COP/WinFormsTest/FormClient.resx b/COP/WinFormsTest/FormClient.resx
index 1af7de1..e6275bd 100644
--- a/COP/WinFormsTest/FormClient.resx
+++ b/COP/WinFormsTest/FormClient.resx
@@ -1,64 +1,4 @@
-
-
-
+
@@ -117,4 +57,7 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ 17, 17
+
\ No newline at end of file
diff --git a/COP/WinFormsTest/FormMain.Designer.cs b/COP/WinFormsTest/FormMain.Designer.cs
index 1ff8f5d..0f6281d 100644
--- a/COP/WinFormsTest/FormMain.Designer.cs
+++ b/COP/WinFormsTest/FormMain.Designer.cs
@@ -41,7 +41,7 @@
this.категорииToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.controlDataTable = new ControlsLibraryNet60.Data.ControlDataTableTable();
this.excelImagesComponent = new ChubykinaComponents.LogicalComponents.ExcelImagesComponent(this.components);
- this.wordTableComponentClient = new BulatovaComponents.LogicalComponents.WordTableComponent(this.components);
+ this.wordTableComponentClient = new BulatovaComponents.NonVisualComponents.WordTableComponent(this.components);
this.componentDocumentWithChartBarPdf = new ComponentsLibraryNet60.DocumentWithChart.ComponentDocumentWithChartBarPdf(this.components);
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
@@ -131,7 +131,7 @@
//
this.категорииToolStripMenuItem.Name = "категорииToolStripMenuItem";
this.категорииToolStripMenuItem.Size = new System.Drawing.Size(92, 24);
- this.категорииToolStripMenuItem.Text = "Интересы";
+ this.категорииToolStripMenuItem.Text = "Категории";
this.категорииToolStripMenuItem.Click += new System.EventHandler(this.категорииToolStripMenuItem_Click);
//
// controlDataTable
@@ -175,7 +175,7 @@
private ToolStripMenuItem категорииToolStripMenuItem;
private ControlsLibraryNet60.Data.ControlDataTableTable controlDataTable;
private ChubykinaComponents.LogicalComponents.ExcelImagesComponent excelImagesComponent;
- private BulatovaComponents.LogicalComponents.WordTableComponent wordTableComponentClient;
+ private BulatovaComponents.NonVisualComponents.WordTableComponent wordTableComponentClient;
private ComponentsLibraryNet60.DocumentWithChart.ComponentDocumentWithChartBarPdf componentDocumentWithChartBarPdf;
}
}
\ No newline at end of file
diff --git a/COP/WinFormsTest/FormMain.cs b/COP/WinFormsTest/FormMain.cs
index bd0ede1..14d2ebe 100644
--- a/COP/WinFormsTest/FormMain.cs
+++ b/COP/WinFormsTest/FormMain.cs
@@ -97,18 +97,29 @@ namespace WinFormsTest
private void документToolStripMenuItem_Click(object sender, EventArgs e)
{
+ SaveFileDialog saveFileDialog = new()
+ {
+ Filter = "Excel Files|*.xlsx"
+ };
+ if (saveFileDialog.ShowDialog() != DialogResult.OK) return;
+ string path = saveFileDialog.FileName;
List photos = new List();
foreach (var client in _logic.ReadList(null))
{
photos.Add(client.Photo);
}
- string path = AppDomain.CurrentDomain.BaseDirectory + "Фото.xlsx";
if (excelImagesComponent.createWithImages(new ExcelImageInfo(path, "Фото", photos.ToArray()))) MessageBox.Show("Документ создан");
}
private void документСДиаграммойToolStripMenuItem_Click(object sender, EventArgs e)
{
- string path = AppDomain.CurrentDomain.BaseDirectory + "Интересы.pdf";
+ Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
+ SaveFileDialog saveFileDialog = new()
+ {
+ Filter = "PDF Files|*.pdf"
+ };
+ if (saveFileDialog.ShowDialog() != DialogResult.OK) return;
+ string path = saveFileDialog.FileName;
Dictionary> data = new Dictionary>();
data = _logic
@@ -118,9 +129,9 @@ namespace WinFormsTest
componentDocumentWithChartBarPdf.CreateDoc(new ComponentDocumentWithChartConfig
{
- Header = "Интересы",
+ Header = "Категории",
FilePath = path,
- ChartTitle = "Интересы",
+ ChartTitle = "Категории",
LegendLocation = ComponentsLibraryNet60.Models.Location.Bottom,
Data = data,
});
@@ -130,7 +141,12 @@ namespace WinFormsTest
private void документСТаблицейToolStripMenuItem_Click(object sender, EventArgs e)
{
- string path = AppDomain.CurrentDomain.BaseDirectory + "Клиенты.docx";
+ SaveFileDialog saveFileDialog = new()
+ {
+ Filter = "Word Files|*.docx"
+ };
+ if (saveFileDialog.ShowDialog() != DialogResult.OK) return;
+ string path = saveFileDialog.FileName;
List<(int, int)> merges = new List<(int, int)> { (1, 2) };
List widths = new List { 100, 100, 100, 100 };
List<(string, string)> headers = new List<(string, string)> {
@@ -142,7 +158,9 @@ namespace WinFormsTest
};
wordTableComponentClient.createWithTable(path, "Список клиентов", merges, widths, headers, _logic.ReadList(null));
+ MessageBox.Show("Документ создан");
}
+
}
}
diff --git a/COP/WinFormsTest/WinFormsTest.csproj b/COP/WinFormsTest/WinFormsTest.csproj
index cc2e2d1..8829709 100644
--- a/COP/WinFormsTest/WinFormsTest.csproj
+++ b/COP/WinFormsTest/WinFormsTest.csproj
@@ -9,7 +9,7 @@
-
+