diff --git a/ExecForm/ExecForm1.csproj b/ExecForm/ExecForm1.csproj
deleted file mode 100644
index b3e737e..0000000
--- a/ExecForm/ExecForm1.csproj
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
- WinExe
- net8.0-windows
- enable
- true
- enable
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ExecForm/Form1.Designer.cs b/ExecForm/Form1.Designer.cs
deleted file mode 100644
index ce66285..0000000
--- a/ExecForm/Form1.Designer.cs
+++ /dev/null
@@ -1,80 +0,0 @@
-namespace ExecForm
-{
- partial class Form1
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- chooseList1 = new Library14Petrushin.ChooseList();
- hierarchicalTreeView1 = new Library14Petrushin.HierarchicalTreeView();
- textBoxRange1 = new Library14Petrushin.TextBoxRange();
- SuspendLayout();
- //
- // chooseList1
- //
- chooseList1.Location = new Point(12, 12);
- chooseList1.Name = "chooseList1";
- chooseList1.SelectedValue = "";
- chooseList1.Size = new Size(185, 190);
- chooseList1.TabIndex = 0;
- //
- // hierarchicalTreeView1
- //
- hierarchicalTreeView1.Location = new Point(567, 2);
- hierarchicalTreeView1.Name = "hierarchicalTreeView1";
- hierarchicalTreeView1.SelectedNodeIndex = -1;
- hierarchicalTreeView1.Size = new Size(266, 504);
- hierarchicalTreeView1.TabIndex = 2;
- //
- // textBoxRange1
- //
- textBoxRange1.Location = new Point(254, 21);
- textBoxRange1.MaxLength = null;
- textBoxRange1.MinLength = null;
- textBoxRange1.Name = "textBoxRange1";
- textBoxRange1.Size = new Size(259, 118);
- textBoxRange1.TabIndex = 3;
- //
- // Form1
- //
- AutoScaleDimensions = new SizeF(8F, 20F);
- AutoScaleMode = AutoScaleMode.Font;
- ClientSize = new Size(834, 507);
- Controls.Add(textBoxRange1);
- Controls.Add(hierarchicalTreeView1);
- Controls.Add(chooseList1);
- Name = "Form1";
- Text = "Form1";
- ResumeLayout(false);
- }
-
- #endregion
-
- private Library14Petrushin.ChooseList chooseList1;
- private Library14Petrushin.HierarchicalTreeView hierarchicalTreeView1;
- private Library14Petrushin.TextBoxRange textBoxRange1;
- }
-}
diff --git a/ExecForm/Form1.cs b/ExecForm/Form1.cs
deleted file mode 100644
index 61e1daa..0000000
--- a/ExecForm/Form1.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-using Library14Petrushin.Classes;
-using Library14Petrushin;
-
-namespace ExecForm
-{
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
-
-
- //
- chooseList1.AddItemToList("Item 1");
- chooseList1.AddItemToList("Item 2");
- chooseList1.AddItemToList("Item 3");
-
- textBoxRange1.MinLength = 3;
- textBoxRange1.MaxLength = 10;
-
- var hierarchy = new List { "Department", "Position", "FullName" };
- var alwaysNewBranch = new Dictionary { { "FullName", true } };
- hierarchicalTreeView1.SetHierarchy(hierarchy, alwaysNewBranch);
-
- var employees = new List
- {
- new Employee { Department = "IT", Position = "Developer", FullName = "John Doe" },
- new Employee { Department = "HR", Position = "Manager", FullName = "Jane Smith" }
- };
-
- // AddObjectToTree
- foreach (var employee in employees)
- {
- hierarchicalTreeView1.AddObjectToTree(employee, hierarchy.Last());
- }
-
- }
- }
-}
diff --git a/ExecForm/Form1.resx b/ExecForm/Form1.resx
deleted file mode 100644
index af32865..0000000
--- a/ExecForm/Form1.resx
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
\ No newline at end of file
diff --git a/ExecForm/Program.cs b/ExecForm/Program.cs
deleted file mode 100644
index af90307..0000000
--- a/ExecForm/Program.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-namespace ExecForm
-{
- internal static class Program
- {
- ///
- /// The main entry point for the application.
- ///
- [STAThread]
- static void Main()
- {
- // To customize application configuration such as set high DPI settings or default font,
- // see https://aka.ms/applicationconfiguration.
- ApplicationConfiguration.Initialize();
- Application.Run(new Form1());
- }
- }
-}
\ No newline at end of file
diff --git a/ExexForm2/ExexForm2.csproj b/ExexForm2/ExexForm2.csproj
deleted file mode 100644
index b3e737e..0000000
--- a/ExexForm2/ExexForm2.csproj
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
- WinExe
- net8.0-windows
- enable
- true
- enable
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ExexForm2/Form1.Designer.cs b/ExexForm2/Form1.Designer.cs
deleted file mode 100644
index 6947beb..0000000
--- a/ExexForm2/Form1.Designer.cs
+++ /dev/null
@@ -1,152 +0,0 @@
-namespace ExexForm2
-{
- partial class Form1
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- components = new System.ComponentModel.Container();
- pdfImg1 = new Library14Petrushin.PdfImg(components);
- btnSelectImages = new Button();
- btnSelectDirectory = new Button();
- btnCreatePdf = new Button();
- txtDocumentTitle = new TextBox();
- lstImages = new ListBox();
- lblDirectory = new Label();
- btnCrTb = new Button();
- pdfColGroupTable1 = new Library14Petrushin.PdfColGroupTable();
- pdfCirclDiagr1 = new Library14Petrushin.PdfCirclDiagr();
- btnCircl = new Button();
- SuspendLayout();
- //
- // btnSelectImages
- //
- btnSelectImages.Location = new Point(24, 28);
- btnSelectImages.Name = "btnSelectImages";
- btnSelectImages.Size = new Size(116, 50);
- btnSelectImages.TabIndex = 0;
- btnSelectImages.Text = "выбор изображения";
- btnSelectImages.UseVisualStyleBackColor = true;
- btnSelectImages.Click += btnSelectImages_Click;
- //
- // btnSelectDirectory
- //
- btnSelectDirectory.Location = new Point(24, 89);
- btnSelectDirectory.Name = "btnSelectDirectory";
- btnSelectDirectory.Size = new Size(116, 49);
- btnSelectDirectory.TabIndex = 1;
- btnSelectDirectory.Text = "выбор директории";
- btnSelectDirectory.UseVisualStyleBackColor = true;
- btnSelectDirectory.Click += btnSelectDirectory_Click;
- //
- // btnCreatePdf
- //
- btnCreatePdf.Location = new Point(24, 158);
- btnCreatePdf.Name = "btnCreatePdf";
- btnCreatePdf.Size = new Size(101, 48);
- btnCreatePdf.TabIndex = 2;
- btnCreatePdf.Text = "Создать";
- btnCreatePdf.UseVisualStyleBackColor = true;
- btnCreatePdf.Click += btnCreatePdf_Click;
- //
- // txtDocumentTitle
- //
- txtDocumentTitle.Location = new Point(24, 224);
- txtDocumentTitle.Name = "txtDocumentTitle";
- txtDocumentTitle.Size = new Size(101, 27);
- txtDocumentTitle.TabIndex = 3;
- //
- // lstImages
- //
- lstImages.FormattingEnabled = true;
- lstImages.Location = new Point(146, 28);
- lstImages.Name = "lstImages";
- lstImages.Size = new Size(179, 404);
- lstImages.TabIndex = 4;
- //
- // lblDirectory
- //
- lblDirectory.AutoSize = true;
- lblDirectory.Location = new Point(24, 280);
- lblDirectory.Name = "lblDirectory";
- lblDirectory.Size = new Size(50, 20);
- lblDirectory.TabIndex = 5;
- lblDirectory.Text = "label1";
- //
- // btnCrTb
- //
- btnCrTb.Location = new Point(349, 28);
- btnCrTb.Name = "btnCrTb";
- btnCrTb.Size = new Size(142, 29);
- btnCrTb.TabIndex = 6;
- btnCrTb.Text = "Создать таблицу";
- btnCrTb.UseVisualStyleBackColor = true;
- btnCrTb.Click += btnCreatePdfTable_Click;
- //
- // btnCircl
- //
- btnCircl.Location = new Point(606, 28);
- btnCircl.Name = "btnCircl";
- btnCircl.Size = new Size(161, 29);
- btnCircl.TabIndex = 7;
- btnCircl.Text = "Создать диаграмму";
- btnCircl.UseVisualStyleBackColor = true;
- btnCircl.Click += btnCreatePdfCircl_Click;
- //
- // Form1
- //
- AutoScaleDimensions = new SizeF(8F, 20F);
- AutoScaleMode = AutoScaleMode.Font;
- ClientSize = new Size(800, 450);
- Controls.Add(btnCircl);
- Controls.Add(btnCrTb);
- Controls.Add(lblDirectory);
- Controls.Add(lstImages);
- Controls.Add(txtDocumentTitle);
- Controls.Add(btnCreatePdf);
- Controls.Add(btnSelectDirectory);
- Controls.Add(btnSelectImages);
- Name = "Form1";
- Text = "Form1";
- ResumeLayout(false);
- PerformLayout();
- }
-
- #endregion
-
- private Library14Petrushin.PdfImg pdfImg1;
- private Button btnSelectImages;
- private Button btnSelectDirectory;
- private Button btnCreatePdf;
- private TextBox txtDocumentTitle;
- private ListBox lstImages;
- private Label lblDirectory;
- private Button btnCrTb;
- private Library14Petrushin.PdfColGroupTable pdfColGroupTable1;
- private Library14Petrushin.PdfCirclDiagr pdfCirclDiagr1;
- private Button btnCircl;
- }
-}
diff --git a/ExexForm2/Form1.cs b/ExexForm2/Form1.cs
deleted file mode 100644
index 82861c0..0000000
--- a/ExexForm2/Form1.cs
+++ /dev/null
@@ -1,169 +0,0 @@
-using Library14Petrushin;
-using Library14Petrushin.Classes;
-
-namespace ExexForm2
-{
- public partial class Form1 : Form
- {
- private PdfImg pdfImg;
- private List selectedImages;
- private string selectedDirectory;
- private PdfColGroupTable pdfTable;
- private PdfCirclDiagr pdfCirclDiagr;
-
- public Form1()
- {
- InitializeComponent();
- pdfImg = new PdfImg();
- selectedImages = new List();
- pdfTable = new PdfColGroupTable();
- pdfCirclDiagr = new PdfCirclDiagr();
- }
-
- private void btnSelectImages_Click(object sender, EventArgs e)
- {
- using (OpenFileDialog openFileDialog = new OpenFileDialog())
- {
- openFileDialog.Filter = "Image Files|*.jpg;*.jpeg;*.png;*.bmp;*.gif";
- openFileDialog.Multiselect = true;
-
- if (openFileDialog.ShowDialog() == DialogResult.OK)
- {
- foreach (string fileName in openFileDialog.FileNames)
- {
- selectedImages.Add(new ImageData { ImagePath = fileName });
- lstImages.Items.Add(fileName);
- }
- }
- }
- }
-
- private void btnSelectDirectory_Click(object sender, EventArgs e)
- {
- using (FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog())
- {
- if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
- {
- selectedDirectory = folderBrowserDialog.SelectedPath;
- lblDirectory.Text = "Selected Directory: " + selectedDirectory;
- }
- }
- }
-
- private void btnCreatePdf_Click(object sender, EventArgs e)
- {
- if (string.IsNullOrEmpty(txtDocumentTitle.Text) || selectedImages.Count == 0 || string.IsNullOrEmpty(selectedDirectory))
- {
- MessageBox.Show("Please select images, directory, and enter a document title.");
- return;
- }
-
- string fileName = Path.Combine(selectedDirectory, "output1.pdf");
- pdfImg.CreatePdfDocument(fileName, txtDocumentTitle.Text, selectedImages);
- MessageBox.Show("PDF document created successfully!");
- }
-
-
- // 2 -------------------------------------------
-
-
- private void btnCreatePdfTable_Click(object sender, EventArgs e)
- {
- string selectDirTable = "";
- string fileName = "";
-
- using (FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog())
- {
- if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
- {
- selectDirTable = folderBrowserDialog.SelectedPath;
- }
- }
-
- using (SaveFileDialog saveFileDialog = new SaveFileDialog())
- {
- saveFileDialog.Filter = "PDF Files (*.pdf)|*.pdf";
- saveFileDialog.DefaultExt = "pdf";
- saveFileDialog.InitialDirectory = selectDirTable;
- saveFileDialog.FileName = "output2.pdf";
-
- if (saveFileDialog.ShowDialog() == DialogResult.OK)
- {
- fileName = saveFileDialog.FileName;
- }
- }
-
- if (!string.IsNullOrEmpty(fileName))
- {
- var generator = new PdfColGroupTable();
-
- var data1 = new List
- {
- new Person { FirstName = "John", LastName = "Doe", Age = 30 },
- new Person { FirstName = "Jane", LastName = "Smith", Age = 25 }
- };
-
- var commonHeaders = new List { "Name", "", "" };
- var headersNames = new List<(string, string)> {
- ("First Name","FirstName"),
- ("Last Name", "LastName"),
- ("Age", "Age")
- };
- var rowHeights = new List { 20, 20 };
- var mergeCells = new List<(int startRow, int endRow, int startColumn, int endColumn)>
- {
- (0, 1, 0, 0), // 0 1
- (2, 2, 0, 1)
- };
-
- generator.GeneratePdf(fileName, "Example Document", mergeCells, rowHeights, headersNames, commonHeaders, data1);
- }
- }
-
-
- // 3 -------------------------------------------
-
-
- private void btnCreatePdfCircl_Click(object sender, EventArgs e)
- {
- string selectDir = "";
- string fileName = "";
-
- using (FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog())
- {
- if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
- {
- selectDir = folderBrowserDialog.SelectedPath;
- }
- }
-
- using (SaveFileDialog saveFileDialog = new SaveFileDialog())
- {
- saveFileDialog.Filter = "PDF Files (*.pdf)|*.pdf";
- saveFileDialog.DefaultExt = "pdf";
- saveFileDialog.InitialDirectory = selectDir;
- saveFileDialog.FileName = "output3.pdf";
-
- if (saveFileDialog.ShowDialog() == DialogResult.OK)
- {
- fileName = saveFileDialog.FileName;
- }
- }
-
- if (!string.IsNullOrEmpty(fileName))
- {
- var pdfCirclDiagr = new PdfCirclDiagr();
-
- List chartData = new List
- {
- new ChartData { SeriesName = "Series 1", Value = 10 },
- new ChartData { SeriesName = "Series 2", Value = 20 },
- new ChartData { SeriesName = "Series 3", Value = 30 },
- new ChartData { SeriesName = "Series 4", Value = 40 }
- };
-
- pdfCirclDiagr.GeneratePdf(fileName, "Document Title", "Chart Title", LegendPosition.Right, chartData);
- }
- }
- }
-}
\ No newline at end of file
diff --git a/ExexForm2/Form1.resx b/ExexForm2/Form1.resx
deleted file mode 100644
index 4e594b6..0000000
--- a/ExexForm2/Form1.resx
+++ /dev/null
@@ -1,129 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- 17, 17
-
-
- 130, 17
-
-
- 315, 17
-
-
\ No newline at end of file
diff --git a/ExexForm2/Program.cs b/ExexForm2/Program.cs
deleted file mode 100644
index 9dac8de..0000000
--- a/ExexForm2/Program.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-namespace ExexForm2
-{
- internal static class Program
- {
- ///
- /// The main entry point for the application.
- ///
- [STAThread]
- static void Main()
- {
- // To customize application configuration such as set high DPI settings or default font,
- // see https://aka.ms/applicationconfiguration.
- ApplicationConfiguration.Initialize();
- Application.Run(new Form1());
- }
- }
-}
\ No newline at end of file
diff --git a/Laba3/FormMain.Designer.cs b/Laba3/FormMain.Designer.cs
new file mode 100644
index 0000000..495830c
--- /dev/null
+++ b/Laba3/FormMain.Designer.cs
@@ -0,0 +1,173 @@
+using DocumentFormat.OpenXml.Office2010.CustomUI;
+using Microsoft.Vbe.Interop;
+using System.Windows.Forms;
+
+namespace View
+{
+ partial class FormMain
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ panelControl = new Panel();
+ ControlsStripMenuItem = new ToolStripMenuItem();
+ ActionsToolStripMenuItem = new ToolStripMenuItem();
+ AddElementToolStripMenuItem = new ToolStripMenuItem();
+ UpdElementToolStripMenuItem = new ToolStripMenuItem();
+ DelElementToolStripMenuItem = new ToolStripMenuItem();
+ DocsToolStripMenuItem = new ToolStripMenuItem();
+ WordDocToolStripMenuItem = new ToolStripMenuItem();
+ TableDocToolStripMenuItem = new ToolStripMenuItem();
+ ChartDocToolStripMenuItem = new ToolStripMenuItem();
+ menuStrip = new MenuStrip();
+ menuStrip.SuspendLayout();
+ SuspendLayout();
+ //
+ // panelControl
+ //
+ panelControl.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
+ panelControl.BackColor = SystemColors.Info;
+ panelControl.Location = new Point(14, 36);
+ panelControl.Margin = new Padding(3, 4, 3, 4);
+ panelControl.Name = "panelControl";
+ panelControl.Size = new Size(1024, 236);
+ panelControl.TabIndex = 2;
+ //
+ // ControlsStripMenuItem
+ //
+ ControlsStripMenuItem.Name = "ControlsStripMenuItem";
+ ControlsStripMenuItem.Size = new Size(113, 26);
+ ControlsStripMenuItem.Text = "Компоненты";
+ //
+ // ActionsToolStripMenuItem
+ //
+ ActionsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { AddElementToolStripMenuItem, UpdElementToolStripMenuItem, DelElementToolStripMenuItem });
+ ActionsToolStripMenuItem.Name = "ActionsToolStripMenuItem";
+ ActionsToolStripMenuItem.Size = new Size(88, 26);
+ ActionsToolStripMenuItem.Text = "Действия";
+ //
+ // AddElementToolStripMenuItem
+ //
+ AddElementToolStripMenuItem.Name = "AddElementToolStripMenuItem";
+ AddElementToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.A;
+ AddElementToolStripMenuItem.Size = new Size(213, 26);
+ AddElementToolStripMenuItem.Text = "Добавить";
+ AddElementToolStripMenuItem.Click += AddElementToolStripMenuItem_Click;
+ //
+ // UpdElementToolStripMenuItem
+ //
+ UpdElementToolStripMenuItem.Name = "UpdElementToolStripMenuItem";
+ UpdElementToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.U;
+ UpdElementToolStripMenuItem.Size = new Size(213, 26);
+ UpdElementToolStripMenuItem.Text = "Изменить";
+ UpdElementToolStripMenuItem.Click += UpdElementToolStripMenuItem_Click;
+ //
+ // DelElementToolStripMenuItem
+ //
+ DelElementToolStripMenuItem.Name = "DelElementToolStripMenuItem";
+ DelElementToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.D;
+ DelElementToolStripMenuItem.Size = new Size(213, 26);
+ DelElementToolStripMenuItem.Text = "Удалить";
+ DelElementToolStripMenuItem.Click += DelElementToolStripMenuItem_Click;
+ //
+ // DocsToolStripMenuItem
+ //
+ DocsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { WordDocToolStripMenuItem, TableDocToolStripMenuItem, ChartDocToolStripMenuItem });
+ DocsToolStripMenuItem.Name = "DocsToolStripMenuItem";
+ DocsToolStripMenuItem.Size = new Size(101, 26);
+ DocsToolStripMenuItem.Text = "Документы";
+ //
+ // WordDocToolStripMenuItem
+ //
+ WordDocToolStripMenuItem.Name = "WordDocToolStripMenuItem";
+ WordDocToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.S;
+ WordDocToolStripMenuItem.Size = new Size(291, 26);
+ WordDocToolStripMenuItem.Text = "Диаграмма ворд";
+ WordDocToolStripMenuItem.Click += WordDocToolStripMenuItem_Click;
+ //
+ // TableDocToolStripMenuItem
+ //
+ TableDocToolStripMenuItem.Name = "TableDocToolStripMenuItem";
+ TableDocToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.T;
+ TableDocToolStripMenuItem.Size = new Size(291, 26);
+ TableDocToolStripMenuItem.Text = "Документ с таблицой";
+ TableDocToolStripMenuItem.Click += TableDocToolStripMenuItem_Click;
+ //
+ // ChartDocToolStripMenuItem
+ //
+ ChartDocToolStripMenuItem.Name = "ChartDocToolStripMenuItem";
+ ChartDocToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.C;
+ ChartDocToolStripMenuItem.Size = new Size(291, 26);
+ ChartDocToolStripMenuItem.Text = "Текст пдф";
+ ChartDocToolStripMenuItem.Click += ChartDocToolStripMenuItem_Click;
+ //
+ // menuStrip
+ //
+ menuStrip.AutoSize = false;
+ menuStrip.ImageScalingSize = new Size(20, 20);
+ menuStrip.Items.AddRange(new ToolStripItem[] { ControlsStripMenuItem, ActionsToolStripMenuItem, DocsToolStripMenuItem });
+ menuStrip.Location = new Point(0, 0);
+ menuStrip.Name = "menuStrip";
+ menuStrip.Padding = new Padding(7, 3, 0, 3);
+ menuStrip.Size = new Size(1051, 32);
+ menuStrip.TabIndex = 0;
+ menuStrip.Text = "Меню";
+ //
+ // FormMain
+ //
+ AutoScaleDimensions = new SizeF(8F, 20F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(1051, 288);
+ Controls.Add(panelControl);
+ Controls.Add(menuStrip);
+ MainMenuStrip = menuStrip;
+ Margin = new Padding(3, 4, 3, 4);
+ Name = "FormMain";
+ StartPosition = FormStartPosition.CenterScreen;
+ Text = "Главная форма";
+ KeyDown += FormMain_KeyDown;
+ menuStrip.ResumeLayout(false);
+ menuStrip.PerformLayout();
+ ResumeLayout(false);
+ }
+
+ #endregion
+ private Panel panelControl;
+ private ToolStripMenuItem ControlsStripMenuItem;
+ private ToolStripMenuItem ActionsToolStripMenuItem;
+ private ToolStripMenuItem AddElementToolStripMenuItem;
+ private ToolStripMenuItem UpdElementToolStripMenuItem;
+ private ToolStripMenuItem DelElementToolStripMenuItem;
+ private ToolStripMenuItem DocsToolStripMenuItem;
+ private ToolStripMenuItem WordDocToolStripMenuItem;
+ private ToolStripMenuItem TableDocToolStripMenuItem;
+ private ToolStripMenuItem ChartDocToolStripMenuItem;
+ private MenuStrip menuStrip;
+ private Library14Petrushin.PdfImg pdfImg;
+ private Library15Gerimovich.WordDiagramComponent wordDiagramComponent;
+ private WinFormsLibrary1.ComponentTable componentTable;
+ }
+}
\ No newline at end of file
diff --git a/Laba3/FormMain.cs b/Laba3/FormMain.cs
new file mode 100644
index 0000000..de3b99c
--- /dev/null
+++ b/Laba3/FormMain.cs
@@ -0,0 +1,256 @@
+using Data.Models;
+using Library14Petrushin;
+using Library15Gerimovich.OfficePackage.HelperModels;
+using Library15Gerimovich;
+using WinFormsLibrary1;
+using WinFormsLibrary1.Models;
+using View.ViewModels;
+using PluginsConventionLibrary.Plugins;
+using System.Reflection;
+
+namespace View
+{
+ public partial class FormMain : Form
+ {
+ private readonly Dictionary _plugins;
+ private string _selectedPlugin;
+ private ContextMenuStrip contextMenu = new ContextMenuStrip();
+
+ public FormMain()
+ {
+ InitializeComponent();
+
+ _plugins = LoadPlugins();
+ _selectedPlugin = string.Empty;
+ }
+
+ /*private Dictionary LoadPlugins()
+ {
+ PluginsManager manager = new PluginsManager();
+ var plugins = manager.plugins_dictionary;
+
+ ToolStripItem[] toolStripItems = new ToolStripItem[plugins.Count];
+ int i = 0;
+ if (plugins.Count > 0)
+ {
+ foreach (var plugin in plugins)
+ {
+ ToolStripMenuItem itemMenu = new ToolStripMenuItem();
+ itemMenu.Text = plugin.Value.PluginName;
+ itemMenu.Click += (sender, e) =>
+ {
+ _selectedPlugin = plugin.Value.PluginName;
+ panelControl.Controls.Clear();
+ panelControl.Controls.Add(_plugins[_selectedPlugin].GetControl);
+ panelControl.Controls[0].Dock = DockStyle.Fill;
+ };
+ toolStripItems[i] = itemMenu;
+ i++;
+ }
+ ControlsStripMenuItem.DropDownItems.AddRange(toolStripItems);
+ }
+ return plugins;
+ }*/
+
+ private Dictionary LoadPlugins()
+ {
+ var plugins = new Dictionary();
+
+ string pluginsDir = Directory.GetParent(Directory.GetCurrentDirectory())!.Parent!.Parent!.Parent!.FullName + "\\Plugins";
+
+ string[] dllFiles = Directory.GetFiles(pluginsDir, "*.dll", SearchOption.AllDirectories);
+
+ foreach (string dllFile in dllFiles)
+ {
+ try
+ {
+
+ Assembly assembly = Assembly.LoadFrom(dllFile);
+ Type[] types = assembly.GetTypes();
+
+ foreach (var type in types)
+ {
+
+ if (typeof(IPluginsConvention).IsAssignableFrom(type) && !type.IsInterface)
+ {
+ var plugin = (IPluginsConvention)Activator.CreateInstance(type)!;
+ plugins.Add(plugin.PluginName, plugin);
+ CreateMenuItem(plugin.PluginName);
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine($"Ошибка при загрузке сборки {dllFile}: {ex.Message}");
+ }
+ }
+
+ return plugins;
+ }
+
+ private void CreateMenuItem(string pluginName)
+ {
+ ToolStripMenuItem menuItem = new(pluginName);
+ menuItem.Click += (object? sender, EventArgs e) =>
+ {
+ UserControl userControl = _plugins[pluginName].GetControl;
+ if (userControl != null)
+ {
+ panelControl.Controls.Clear();
+ userControl.Dock = DockStyle.Fill;
+ _plugins[pluginName].ReloadData();
+ _selectedPlugin = pluginName;
+ panelControl.Controls.Add(userControl);
+ }
+ };
+ ControlsStripMenuItem.DropDownItems.Add(menuItem);
+ }
+
+ private void FormMain_KeyDown(object sender, KeyEventArgs e)
+ {
+ if (!e.Control)
+ {
+ return;
+ }
+
+ switch (e.KeyCode)
+ {
+ case Keys.A:
+ AddNewElement();
+ break;
+ case Keys.U:
+ UpdateElement();
+ break;
+ case Keys.D:
+ DeleteElement();
+ break;
+ case Keys.S:
+ CreateWord();
+ break;
+ case Keys.T:
+ CreatePdf();
+ break;
+ case Keys.C:
+ CreateExcel();
+ break;
+ }
+ }
+
+ private void AddNewElement()
+ {
+ var form = _plugins[_selectedPlugin].GetForm(null);
+ if (form != null && form.ShowDialog() == DialogResult.OK)
+ {
+ _plugins[_selectedPlugin].ReloadData();
+ }
+ }
+
+ private void UpdateElement()
+ {
+ var element = _plugins[_selectedPlugin].GetElement;
+ if (element == null)
+ {
+ MessageBox.Show("Нет выбранного элемента", "Ошибка",
+ MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+ var form = _plugins[_selectedPlugin].GetForm(element);
+ if (form != null && form.ShowDialog() == DialogResult.OK)
+ {
+ _plugins[_selectedPlugin].ReloadData();
+ }
+ }
+
+ private void DeleteElement()
+ {
+ if (MessageBox.Show("Удалить выбранный элемент", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) { return; }
+ var element = _plugins[_selectedPlugin].GetElement;
+ if (element == null)
+ {
+ MessageBox.Show("Нет выбранного элемента", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+ if (_plugins[_selectedPlugin].DeleteElement(element))
+ {
+ _plugins[_selectedPlugin].ReloadData();
+ }
+ }
+
+ private void CreateWord()
+ {
+ using (var dialog = new SaveFileDialog { Filter = "docx|*.docx" })
+ {
+ if (_plugins[_selectedPlugin].CreateWord(new PluginsConventionSaveDocument { FileName = dialog.FileName }))
+ {
+ //MessageBox.Show("Документ сохранен", "Создание документа", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+ else
+ {
+ MessageBox.Show("Ошибка при создании документа", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ }
+
+
+ private void CreateExcel()
+ {
+ using (var dialog = new SaveFileDialog { Filter = "xlsx|*.xlsx" })
+ {
+ if (_plugins[_selectedPlugin].CreateExcel(new PluginsConventionSaveDocument { FileName = dialog.FileName }))
+ {
+ //MessageBox.Show("Документ сохранен", "Создание документа", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+ else
+ {
+ MessageBox.Show("Ошибка при создании документа", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ }
+
+ private void CreatePdf()
+ {
+ using (var dialog = new SaveFileDialog { Filter = "pdf|*.pdf" })
+ {
+ if (_plugins[_selectedPlugin].CreatePdf(new PluginsConventionSaveDocument { FileName = dialog.FileName }))
+ {
+ //MessageBox.Show("Документ сохранен", "Создание документа", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+ else
+ {
+ MessageBox.Show("Ошибка при создании документа", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ }
+
+ private void AddElementToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ AddNewElement();
+ }
+
+ private void UpdElementToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ UpdateElement();
+ }
+
+ private void DelElementToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ DeleteElement();
+ }
+
+ private void WordDocToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ CreateWord();
+ }
+
+ private void TableDocToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ CreateExcel();
+ }
+
+ private void ChartDocToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ CreatePdf();
+ }
+ }
+}
diff --git a/Laba3/ProductForm.resx b/Laba3/FormMain.resx
similarity index 93%
rename from Laba3/ProductForm.resx
rename to Laba3/FormMain.resx
index af32865..1af7de1 100644
--- a/Laba3/ProductForm.resx
+++ b/Laba3/FormMain.resx
@@ -1,17 +1,17 @@
-
diff --git a/Laba3/MainForm.Designer.cs b/Laba3/MainForm.Designer.cs
deleted file mode 100644
index 3533038..0000000
--- a/Laba3/MainForm.Designer.cs
+++ /dev/null
@@ -1,178 +0,0 @@
-namespace View
-{
- partial class MainForm
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- components = new System.ComponentModel.Container();
- menuStrip1 = new MenuStrip();
- createToolStripMenuItem = new ToolStripMenuItem();
- updateToolStripMenuItem = new ToolStripMenuItem();
- deleteToolStripMenuItem = new ToolStripMenuItem();
- manufacturerToolStripMenuItem = new ToolStripMenuItem();
- documentsToolStripMenuItem = new ToolStripMenuItem();
- pdfImageToolStripMenuItem = new ToolStripMenuItem();
- exelTableToolStripMenuItem = new ToolStripMenuItem();
- wordGistToolStripMenuItem = new ToolStripMenuItem();
- outputTableResults = new Library15Gerimovich.OutputTableResults();
- pdfImg = new Library14Petrushin.PdfImg(components);
- wordDiagramComponent = new Library15Gerimovich.WordDiagramComponent(components);
- componentTable = new WinFormsLibrary1.ComponentTable(components);
- saveFileDialogPdf = new SaveFileDialog();
- saveFileDialogWord = new SaveFileDialog();
- saveFileDialogExel = new SaveFileDialog();
- menuStrip1.SuspendLayout();
- SuspendLayout();
- //
- // menuStrip1
- //
- menuStrip1.ImageScalingSize = new Size(20, 20);
- menuStrip1.Items.AddRange(new ToolStripItem[] { createToolStripMenuItem, updateToolStripMenuItem, deleteToolStripMenuItem, manufacturerToolStripMenuItem, documentsToolStripMenuItem });
- menuStrip1.Location = new Point(0, 0);
- menuStrip1.Name = "menuStrip1";
- menuStrip1.Size = new Size(480, 28);
- menuStrip1.TabIndex = 0;
- menuStrip1.Text = "menuStrip1";
- //
- // createToolStripMenuItem
- //
- createToolStripMenuItem.Name = "createToolStripMenuItem";
- createToolStripMenuItem.Size = new Size(66, 24);
- createToolStripMenuItem.Text = "Create";
- createToolStripMenuItem.Click += addToolStripMenuItem_Click;
- //
- // updateToolStripMenuItem
- //
- updateToolStripMenuItem.Name = "updateToolStripMenuItem";
- updateToolStripMenuItem.Size = new Size(72, 24);
- updateToolStripMenuItem.Text = "Update";
- updateToolStripMenuItem.Click += editToolStripMenuItem_Click;
- //
- // deleteToolStripMenuItem
- //
- deleteToolStripMenuItem.Name = "deleteToolStripMenuItem";
- deleteToolStripMenuItem.Size = new Size(67, 24);
- deleteToolStripMenuItem.Text = "Delete";
- deleteToolStripMenuItem.Click += deleteToolStripMenuItem_Click;
- //
- // manufacturerToolStripMenuItem
- //
- manufacturerToolStripMenuItem.Name = "manufacturerToolStripMenuItem";
- manufacturerToolStripMenuItem.Size = new Size(111, 24);
- manufacturerToolStripMenuItem.Text = "Manufacturer";
- manufacturerToolStripMenuItem.Click += manufacturersToolStripMenuItem_Click;
- //
- // documentsToolStripMenuItem
- //
- documentsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { pdfImageToolStripMenuItem, exelTableToolStripMenuItem, wordGistToolStripMenuItem });
- documentsToolStripMenuItem.Name = "documentsToolStripMenuItem";
- documentsToolStripMenuItem.Size = new Size(98, 24);
- documentsToolStripMenuItem.Text = "Documents";
- //
- // pdfImageToolStripMenuItem
- //
- pdfImageToolStripMenuItem.Name = "pdfImageToolStripMenuItem";
- pdfImageToolStripMenuItem.Size = new Size(159, 26);
- pdfImageToolStripMenuItem.Text = "Pdf Image";
- pdfImageToolStripMenuItem.Click += createSimpleDocumentToolStripMenuItem_Click;
- //
- // exelTableToolStripMenuItem
- //
- exelTableToolStripMenuItem.Name = "exelTableToolStripMenuItem";
- exelTableToolStripMenuItem.Size = new Size(159, 26);
- exelTableToolStripMenuItem.Text = "Exel table";
- exelTableToolStripMenuItem.Click += createCustomTableDocumentToolStripMenuItem_Click;
- //
- // wordGistToolStripMenuItem
- //
- wordGistToolStripMenuItem.Name = "wordGistToolStripMenuItem";
- wordGistToolStripMenuItem.Size = new Size(159, 26);
- wordGistToolStripMenuItem.Text = "Word gist";
- wordGistToolStripMenuItem.Click += createChartDocumentToolStripMenuItem_Click;
- //
- // outputTableResults
- //
- outputTableResults.Location = new Point(12, 32);
- outputTableResults.Margin = new Padding(3, 4, 3, 4);
- outputTableResults.Name = "outputTableResults";
- outputTableResults.SelectedRow = -1;
- outputTableResults.Size = new Size(467, 308);
- outputTableResults.TabIndex = 1;
- //
- // saveFileDialogPdf
- //
- saveFileDialogPdf.FileName = "Products.pdf";
- saveFileDialogPdf.Filter = "PDF Files (*.pdf)|*.pdf";
- saveFileDialogPdf.Title = "Save PDF Document";
- //
- // saveFileDialogWord
- //
- saveFileDialogWord.FileName = "Diagram.docx";
- saveFileDialogWord.Filter = "Word Files (*.docx)|*.docx";
- saveFileDialogWord.Title = "Save Word Document";
- //
- // saveFileDialogExel
- //
- saveFileDialogExel.FileName = "ProductReport.xlsx";
- saveFileDialogExel.Filter = "Excel Files (*.xlsx)|*.xlsx";
- saveFileDialogExel.Title = "Save Excel Document";
- //
- // MainForm
- //
- AutoScaleDimensions = new SizeF(8F, 20F);
- AutoScaleMode = AutoScaleMode.Font;
- ClientSize = new Size(480, 351);
- Controls.Add(outputTableResults);
- Controls.Add(menuStrip1);
- KeyPreview = true;
- MainMenuStrip = menuStrip1;
- Name = "MainForm";
- Text = "Form1";
- KeyDown += MainForm_KeyDown;
- menuStrip1.ResumeLayout(false);
- menuStrip1.PerformLayout();
- ResumeLayout(false);
- PerformLayout();
- }
-
- #endregion
-
- private MenuStrip menuStrip1;
- private ToolStripMenuItem createToolStripMenuItem;
- private ToolStripMenuItem updateToolStripMenuItem;
- private Library15Gerimovich.OutputTableResults outputTableResults;
- private ToolStripMenuItem deleteToolStripMenuItem;
- private ToolStripMenuItem manufacturerToolStripMenuItem;
- private ToolStripMenuItem documentsToolStripMenuItem;
- private ToolStripMenuItem pdfImageToolStripMenuItem;
- private ToolStripMenuItem exelTableToolStripMenuItem;
- private ToolStripMenuItem wordGistToolStripMenuItem;
- private Library14Petrushin.PdfImg pdfImg;
- private Library15Gerimovich.WordDiagramComponent wordDiagramComponent;
- private WinFormsLibrary1.ComponentTable componentTable;
- }
-}
diff --git a/Laba3/MainForm.cs b/Laba3/MainForm.cs
deleted file mode 100644
index 0c27a46..0000000
--- a/Laba3/MainForm.cs
+++ /dev/null
@@ -1,284 +0,0 @@
-using Data;
-using Data.Repositories;
-using View;
-using System.Windows.Forms;
-using Data.Models;
-using Library14Petrushin;
-using Library15Gerimovich.OfficePackage.HelperModels;
-using Library15Gerimovich;
-using WinFormsLibrary1;
-using WinFormsLibrary1.Models;
-using View.ViewModels;
-
-namespace View
-{
- public partial class MainForm : Form
- {
- private readonly IProductRepository _productRepository;
- private readonly IManufacturerRepository _manufacturerRepository;
- private SaveFileDialog saveFileDialogPdf;
- private SaveFileDialog saveFileDialogWord;
- private SaveFileDialog saveFileDialogExel;
-
- public MainForm(IProductRepository productRepository, IManufacturerRepository manufacturerRepository)
- {
- InitializeComponent();
- _productRepository = productRepository;
- _manufacturerRepository = manufacturerRepository;
- InitializeOutputTableResults();
- LoadProducts();
- }
-
- private void InitializeOutputTableResults()
- {
- outputTableResults.ConfigureColumns(new List
- {
- new ColumnInfo("", 0, false, "Id"),
- new ColumnInfo("Name", 150, true, "Name"),
- new ColumnInfo("ManufacturerNameManufacturerName", 150, true, "ManufacturerName"),
- new ColumnInfo("DeliveryDate", 50, true, "DeliveryDate"),
- });
-
- }
-
- private void LoadProducts()
- {
- var products = _productRepository.GetAllProducts();
- outputTableResults.ClearGrid();
- foreach (var product in products)
- {
- outputTableResults.InsertValue(product);
- }
- }
-
- private void addToolStripMenuItem_Click(object sender, EventArgs e)
- {
- var productForm = new ProductForm(_productRepository, _manufacturerRepository);
- if (productForm.ShowDialog() == DialogResult.OK)
- {
- LoadProducts();
- }
- }
-
- private void editToolStripMenuItem_Click(object sender, EventArgs e)
- {
- try
- {
- var selectedProductId = outputTableResults.GetSelectedObject().Id;
- var selectedProduct = _productRepository.GetProductById(selectedProductId);
- var productForm = new ProductForm(_productRepository, _manufacturerRepository, selectedProduct);
- if (productForm.ShowDialog() == DialogResult.OK)
- {
- LoadProducts();
- }
- }
- catch (Exception ex) {
- MessageBox.Show(ex.ToString());
- }
- }
-
- private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
- {
- var selectedProductId = outputTableResults.GetSelectedObject().Id;
- if (MessageBox.Show("Are you sure you want to delete this product?", "Confirm", MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- _productRepository.DeleteProduct(selectedProductId);
- LoadProducts();
- }
- }
-
- private void manufacturersToolStripMenuItem_Click(object sender, EventArgs e)
- {
- var manufacturerForm = new ManufacturerForm(_manufacturerRepository);
- manufacturerForm.ShowDialog();
- }
-
- private void createSimpleDocumentToolStripMenuItem_Click(object sender, EventArgs e)
- {
- // Получаем изображения из базы данных
- var images = GetImagesFromDatabase();
-
- if (images.Count > 0)
- {
- // Показываем диалоговое окно для выбора пути сохранения
- if (saveFileDialogPdf.ShowDialog() == DialogResult.OK)
- {
- // Создаем компонент PdfImg
- var pdfImg = new Library14Petrushin.PdfImg();
-
- // Путь для сохранения PDF-документа
- string fileName = saveFileDialogPdf.FileName;
-
- // Заголовок документа
- string documentTitle = "Product Images";
-
- // Создаем PDF-документ
- pdfImg.CreatePdfDocument(fileName, documentTitle, images);
-
- // Уведомление об успешной загрузке
- MessageBox.Show("PDF document created successfully!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- }
- else
- {
- MessageBox.Show("No images found in the database.");
- }
- }
-
- private void createCustomTableDocumentToolStripMenuItem_Click(object sender, EventArgs e)
- {
- // Получаем все продукты из базы данных
- var products = GetAllProducts();
-
- if (products.Count > 0)
- {
- // Показываем диалоговое окно для выбора пути сохранения
- if (saveFileDialogExel.ShowDialog() == DialogResult.OK)
- {
- // Создаем объекты MergeCell и Column
- var mergeCells = new List
- {
- new MergeCell("Product", new int[] {1, 2})
- };
-
- var columns = new List
- {
- new Column("Id", "Id", 10),
- new Column("Name", "Name", 20),
- new Column("ManufacturerName", "ManufacturerName", 20),
- new Column("DeliveryDate", "DeliveryDate", 20)
- };
-
- // Создаем компонент ComponentTable
- var componentTable = new ComponentTable();
-
- // Конвертируем продукты в представление для таблицы
- var tableItems = ProductTableItem.ConvertProductsToTableItems(products);
-
- // Создаем документ Excel
- componentTable.CreateDocument(saveFileDialogExel.FileName, "Product Report", mergeCells, columns, tableItems);
-
- // Уведомление об успешной загрузке
- MessageBox.Show("Excel document created successfully!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- }
- else
- {
- MessageBox.Show("No products found in the database.");
- }
- }
-
- private void createChartDocumentToolStripMenuItem_Click(object sender, EventArgs e)
- {
- // Получаем данные о количестве продукции каждого производителя
- var productCounts = GetProductCountsByManufacturer();
-
- if (productCounts.Count > 0)
- {
- // Показываем диалоговое окно для выбора пути сохранения
- if (saveFileDialogWord.ShowDialog() == DialogResult.OK)
- {
- // Создаем объект WordDiagramInfo
- var diagramInfo = new WordDiagramInfo
- {
- FileName = saveFileDialogWord.FileName,
- Title = "Product Count by Manufacturer",
- ChartTitle = "Product Count",
- LegendLocation = Library15Gerimovich.OfficePackage.HelperEnums.WordDiagramLegendLocation.Top,
- Series = new WordDiagramSeries
- {
- SeriesName = "Product Count",
- Data = productCounts
- }
- };
-
- // Создаем диаграмму в Word
- wordDiagramComponent.CreateDiagram(diagramInfo);
-
- // Уведомление об успешной загрузке
- MessageBox.Show("Word document with chart created successfully!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- }
- else
- {
- MessageBox.Show("No products found in the database.");
- }
- }
-
- // бизнес логика
-
- private void MainForm_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.Control)
- {
- switch (e.KeyCode)
- {
- case Keys.A:
- addToolStripMenuItem_Click(null, EventArgs.Empty);
- break;
- case Keys.U:
- editToolStripMenuItem_Click(null, EventArgs.Empty);
- break;
- case Keys.D:
- deleteToolStripMenuItem_Click(null, EventArgs.Empty);
- break;
- case Keys.S:
- createSimpleDocumentToolStripMenuItem_Click(null, EventArgs.Empty);
- break;
- case Keys.T:
- createCustomTableDocumentToolStripMenuItem_Click(null, EventArgs.Empty);
- break;
- case Keys.C:
- createChartDocumentToolStripMenuItem_Click(null, EventArgs.Empty);
- break;
- }
- }
- }
-
- private List GetImagesFromDatabase()
- {
- var images = new List();
- var products = _productRepository.GetAllProducts();
-
- foreach (var product in products)
- {
- if (product.Image != null)
- {
- // Создаем временный файл для сохранения изображения
- string tempFilePath = Path.GetTempFileName();
- File.WriteAllBytes(tempFilePath, product.Image);
-
- // Добавляем путь к временному файлу в список
- images.Add(new ImageData { ImagePath = tempFilePath });
- }
- }
-
- return images;
- }
-
- private Dictionary GetProductCountsByManufacturer()
- {
- var productCounts = new Dictionary();
- var products = _productRepository.GetAllProducts();
-
- foreach (var product in products)
- {
- if (productCounts.ContainsKey(product.ManufacturerName))
- {
- productCounts[product.ManufacturerName]++;
- }
- else
- {
- productCounts[product.ManufacturerName] = 1;
- }
- }
-
- return productCounts;
- }
-
- private List GetAllProducts()
- {
- return _productRepository.GetAllProducts().ToList();
- }
- }
-}
diff --git a/Laba3/MainForm.resx b/Laba3/MainForm.resx
deleted file mode 100644
index 6ce8bc4..0000000
--- a/Laba3/MainForm.resx
+++ /dev/null
@@ -1,141 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- 572, 17
-
-
- 708, 17
-
-
- 813, 17
-
-
- 1039, 17
-
-
- 17, 17
-
-
- 195, 17
-
-
- 388, 17
-
-
\ No newline at end of file
diff --git a/Laba3/MainPluginConvention.cs b/Laba3/MainPluginConvention.cs
new file mode 100644
index 0000000..3062662
--- /dev/null
+++ b/Laba3/MainPluginConvention.cs
@@ -0,0 +1,304 @@
+using Data;
+using Data.Models;
+using Data.Repositories;
+using Library15Gerimovich;
+using Library15Gerimovich.OfficePackage.HelperModels;
+using PluginsConventionLibrary.Plugins;
+using PluginsConvention14;
+using PluginsConvention14.MyPlugin;
+using System.Composition;
+using WinFormsLibrary1;
+
+namespace View
+{
+ [Export(typeof(IPluginsConvention))]
+ public class MainPluginConvention : IPluginsConvention
+ {
+
+ private OutputTableResults оutputTableResults;
+ private readonly IProductRepository _productRepository;
+ private readonly IManufacturerRepository _manufacturerRepository;
+ public string PluginName { get; set; } = "Products";
+
+ public MainPluginConvention()
+ {
+ var dbContext = new ApplicationDbContext();
+ _productRepository = new ProductRepository(dbContext);
+ _manufacturerRepository = new ManufacturerRepository(dbContext);
+
+ оutputTableResults = new OutputTableResults();
+ var menu = new ContextMenuStrip();
+ var skillMenuItem = new ToolStripMenuItem("Forms");
+ menu.Items.Add(skillMenuItem);
+ skillMenuItem.Click += (sender, e) =>
+ {
+ var formSkill = new ManufacturerForm(_manufacturerRepository);
+ formSkill.ShowDialog();
+ };
+ оutputTableResults.ContextMenuStrip = menu;
+ ReloadData();
+ }
+
+ /// Название плагина
+ /*string IPluginsConvention.PluginName => PluginName();
+ public string PluginName()
+ {
+ return "Products";
+ }*/
+
+ public UserControl GetControl => оutputTableResults;
+
+ PluginsConventionElement IPluginsConvention.GetElement => GetElement();
+
+ public PluginsConventionElement GetElement()
+ {
+ var product = оutputTableResults.GetSelectedObject(); ;
+ MainPluginConventionElement element = null;
+ if (оutputTableResults != null)
+ {
+ element = new MainPluginConventionElement
+ {
+ Id = product.Id,
+ Name = product.Name,
+ ManufacturerName = product.ManufacturerName,
+ DeliveryDate = product.DeliveryDate,
+ };
+ }
+ return (new PluginsConventionElement { Id = element.Id });
+ }
+
+ public Form GetForm(PluginsConventionElement element)
+ {
+ if (element != null)
+ {
+ var formOrder = new ProductForm(_productRepository, _manufacturerRepository, _productRepository.GetProductById(Convert.ToInt32(element.Id)));
+ return formOrder;
+ }
+ else
+ {
+ var formOrder = new ProductForm(_productRepository, _manufacturerRepository);
+ return formOrder;
+ }
+ }
+
+ public bool DeleteElement(PluginsConventionElement element)
+ {
+ try
+ {
+ _productRepository.DeleteProduct(Convert.ToInt32(element.Id));
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return false;
+ }
+ return true;
+ }
+
+ public void ReloadData()
+ {
+ var products = _productRepository.GetAllProducts();
+
+ оutputTableResults.ClearGrid();
+ foreach (var product in products)
+ {
+ оutputTableResults.InsertValue(product);
+ }
+ }
+ public bool CreatePdf(PluginsConventionSaveDocument saveDocument)
+ {
+ try
+ {
+ // Получаем изображения из базы данных
+ var images = GetImagesFromDatabase();
+
+ if (images.Count > 0)
+ {
+ string fileName = "";
+ using (var dialog = new SaveFileDialog { Filter = "pdf|*.pdf" })
+ {
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ fileName = dialog.FileName.ToString();
+ }
+ }
+ // Создаем компонент PdfImg
+ var pdfImg = new Library14Petrushin.PdfImg();
+
+ // Заголовок документа
+ string documentTitle = "Product Images";
+
+ // Создаем PDF-документ
+ pdfImg.CreatePdfDocument(fileName, documentTitle, images);
+
+ // Уведомление об успешной загрузке
+ MessageBox.Show("PDF document created successfully!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
+
+ }
+ }
+ catch (Exception)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ private List GetImagesFromDatabase()
+ {
+ var images = new List();
+ var products = _productRepository.GetAllProducts();
+
+ foreach (var product in products)
+ {
+ if (product.Image != null)
+ {
+ // Создаем временный файл для сохранения изображения
+ string tempFilePath = Path.GetTempFileName();
+ File.WriteAllBytes(tempFilePath, product.Image);
+
+ // Добавляем путь к временному файлу в список
+ images.Add(new Library14Petrushin.ImageData { ImagePath = tempFilePath });
+ }
+ }
+
+ return images;
+ }
+
+ public bool CreateExcel(PluginsConventionSaveDocument saveDocument)
+ {
+ try
+ {
+
+
+ // Получаем все продукты из базы данных
+ var products = GetAllProducts();
+
+ if (products.Count > 0)
+ {
+ string fileName = "";
+ using (var dialog = new SaveFileDialog { Filter = "xlsx|*.xlsx" })
+ {
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ fileName = dialog.FileName.ToString();
+ }
+ }
+ // Создаем объекты MergeCell и Column
+ var mergeCells = new List
+ {
+ new WinFormsLibrary1.Models.MergeCell("Product", new int[] {1, 2})
+ };
+
+ var columns = new List
+ {
+ new WinFormsLibrary1.Models.Column("Id", "Id", 10),
+ new WinFormsLibrary1.Models.Column("Name", "Name", 20),
+ new WinFormsLibrary1.Models.Column("ManufacturerName", "ManufacturerName", 20),
+ new WinFormsLibrary1.Models.Column("DeliveryDate", "DeliveryDate", 20)
+ };
+
+ // Создаем компонент ComponentTable
+ var componentTable = new ComponentTable();
+
+ // Конвертируем продукты в представление для таблицы
+ var tableItems = MainPluginConventionElement.ConvertProductsToTableItems(products);
+
+ // Создаем документ Excel
+ componentTable.CreateDocument(fileName, "Product Report", mergeCells, columns, tableItems);
+
+ // Уведомление об успешной загрузке
+ MessageBox.Show("Excel document created successfully!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+ else
+ {
+ MessageBox.Show("No products found in the database.");
+ }
+ }
+
+ catch (Exception)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ private List GetAllProducts()
+ {
+ return _productRepository.GetAllProducts().ToList();
+ }
+
+ public bool CreateWord(PluginsConventionSaveDocument saveDocument)
+ {
+ try
+ {
+
+ string fileName = "";
+ using (var dialog = new SaveFileDialog { Filter = "docx|*.docx" })
+ {
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ fileName = dialog.FileName.ToString();
+ }
+ }
+
+ // Получаем данные о количестве продукции каждого производителя
+ var productCounts = GetProductCountsByManufacturer();
+
+ if (productCounts.Count > 0)
+ {
+ // Создаем объект WordDiagramInfo
+ var diagramInfo = new WordDiagramInfo
+ {
+ FileName = fileName,
+ Title = "Product Count by Manufacturer",
+ ChartTitle = "Product Count",
+ LegendLocation = Library15Gerimovich.OfficePackage.HelperEnums.WordDiagramLegendLocation.Top,
+ Series = new WordDiagramSeries
+ {
+ SeriesName = "Product Count",
+ Data = productCounts
+ }
+ };
+
+ var wordDiagramComponent = new WordDiagramComponent();
+
+ // Создаем диаграмму в Word
+ wordDiagramComponent.CreateDiagram(diagramInfo);
+
+ // Уведомление об успешной загрузке
+ MessageBox.Show("Word document with chart created successfully!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+ else
+ {
+ MessageBox.Show("No products found in the database.");
+ }
+
+ }
+ catch (Exception)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ private Dictionary GetProductCountsByManufacturer()
+ {
+ var productCounts = new Dictionary();
+ var products = _productRepository.GetAllProducts();
+
+ foreach (var product in products)
+ {
+ if (productCounts.ContainsKey(product.ManufacturerName))
+ {
+ productCounts[product.ManufacturerName]++;
+ }
+ else
+ {
+ productCounts[product.ManufacturerName] = 1;
+ }
+ }
+
+ return productCounts;
+ }
+ }
+}
diff --git a/Laba3/ManufacturerForm.Designer.cs b/Laba3/ManufacturerForm.Designer.cs
deleted file mode 100644
index 89fec90..0000000
--- a/Laba3/ManufacturerForm.Designer.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-namespace View
-{
- partial class ManufacturerForm
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- dataGridView = new DataGridView();
- ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
- SuspendLayout();
- //
- // dataGridView
- //
- dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
- dataGridView.Location = new Point(12, 12);
- dataGridView.Name = "dataGridView";
- dataGridView.RowHeadersWidth = 51;
- dataGridView.Size = new Size(711, 426);
- dataGridView.TabIndex = 0;
- dataGridView.CellValueChanged += dataGridView_CellValueChanged;
- dataGridView.UserAddedRow += dataGridView_UserAddedRow;
- dataGridView.UserDeletingRow += dataGridView_UserDeletingRow;
- dataGridView.KeyDown += dataGridView_KeyDown;
- //
- // ManufacturerForm
- //
- AutoScaleDimensions = new SizeF(8F, 20F);
- AutoScaleMode = AutoScaleMode.Font;
- ClientSize = new Size(731, 450);
- Controls.Add(dataGridView);
- Name = "ManufacturerForm";
- Text = "ManufacturerForm";
- ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
- ResumeLayout(false);
- }
-
- #endregion
-
- private DataGridView dataGridView;
- }
-}
\ No newline at end of file
diff --git a/Laba3/ManufacturerForm.cs b/Laba3/ManufacturerForm.cs
deleted file mode 100644
index 23638fb..0000000
--- a/Laba3/ManufacturerForm.cs
+++ /dev/null
@@ -1,95 +0,0 @@
-using Data.Models;
-using Data.Repositories;
-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 View
-{
- public partial class ManufacturerForm : Form
- {
- private readonly IManufacturerRepository _manufacturerRepository;
-
- public ManufacturerForm(IManufacturerRepository manufacturerRepository)
- {
- InitializeComponent();
- _manufacturerRepository = manufacturerRepository;
- LoadManufacturers();
- }
-
- private void LoadManufacturers()
- {
- var manufacturers = _manufacturerRepository.GetAllManufacturers().ToList();
- dataGridView.DataSource = manufacturers;
- }
-
- private void dataGridView_CellValueChanged(object sender, DataGridViewCellEventArgs e)
- {
- if (e.RowIndex >= 0)
- {
- var manufacturer = dataGridView.Rows[e.RowIndex].DataBoundItem as Manufacturer;
- if (manufacturer != null)
- {
- _manufacturerRepository.UpdateManufacturer(manufacturer);
- }
- }
- }
-
- private void dataGridView_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
- {
- var manufacturer = e.Row.DataBoundItem as Manufacturer;
- if (manufacturer != null)
- {
- if (MessageBox.Show("Are you sure you want to delete this manufacturer?", "Confirm", MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- _manufacturerRepository.DeleteManufacturer(manufacturer.Id);
- }
- else
- {
- e.Cancel = true;
- }
- }
- }
-
- private void dataGridView_UserAddedRow(object sender, DataGridViewRowEventArgs e)
- {
- var manufacturer = new Manufacturer { Name = "" };
- _manufacturerRepository.AddManufacturer(manufacturer);
- LoadManufacturers();
- }
-
-
- // реализация через нажатие клавишь
-
- private void dataGridView_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyCode == Keys.Insert)
- {
- var manufacturer = new Manufacturer { Name = "" };
- _manufacturerRepository.AddManufacturer(manufacturer);
- LoadManufacturers();
- }
- else if (e.KeyCode == Keys.Delete)
- {
- if (dataGridView.SelectedRows.Count > 0)
- {
- var selectedManufacturer = dataGridView.SelectedRows[0].DataBoundItem as Manufacturer;
- if (selectedManufacturer != null)
- {
- if (MessageBox.Show("Are you sure you want to delete this manufacturer?", "Confirm", MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- _manufacturerRepository.DeleteManufacturer(selectedManufacturer.Id);
- LoadManufacturers();
- }
- }
- }
- }
- }
- }
-}
diff --git a/Laba3/ManufacturerForm.resx b/Laba3/ManufacturerForm.resx
deleted file mode 100644
index af32865..0000000
--- a/Laba3/ManufacturerForm.resx
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
\ No newline at end of file
diff --git a/Laba3/PluginsManager.cs b/Laba3/PluginsManager.cs
new file mode 100644
index 0000000..c8f9274
--- /dev/null
+++ b/Laba3/PluginsManager.cs
@@ -0,0 +1,50 @@
+using PluginsConventionLibrary.Plugins;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.Composition;
+using System.ComponentModel.Composition.Hosting;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace View
+{
+ public class PluginsManager
+ {
+ //Тег, указывающий, что plugins должны быть заполнены CompositionContainer
+ [ImportMany(typeof(IPluginsConvention))]
+ IEnumerable Plugins { get; set; }
+
+ public readonly Dictionary plugins_dictionary = new Dictionary();
+
+ public PluginsManager()
+ {
+ AggregateCatalog catalog = new AggregateCatalog();
+ catalog.Catalogs.Add(new DirectoryCatalog(AppDomain.CurrentDomain.BaseDirectory));
+ catalog.Catalogs.Add(new DirectoryCatalog(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Plugins")));
+
+
+ //Контейнер композиции
+
+ CompositionContainer container = new CompositionContainer(catalog);
+ try
+ {
+ container.ComposeParts(this);
+ }
+ catch (CompositionException compositionException)
+ {
+ MessageBox.Show(compositionException.ToString());
+ }
+ if (Plugins.Any())
+ {
+ Plugins
+ .ToList()
+ .ForEach(p =>
+ {
+ if (!plugins_dictionary.Keys.Contains(p.PluginName))
+ plugins_dictionary.Add(p.PluginName, p);
+ });
+ }
+ }
+ }
+}
diff --git a/Laba3/ProductForm.Designer.cs b/Laba3/ProductForm.Designer.cs
deleted file mode 100644
index 247f34f..0000000
--- a/Laba3/ProductForm.Designer.cs
+++ /dev/null
@@ -1,121 +0,0 @@
-namespace PluginsConvention14
-{
- partial class ProductForm
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- dtpDeliveryDate = new WinFormsLibrary1.DateInputControl();
- cmbManufacturer = new WinFormsLibrary1.ComboBoxUserControl();
- txtName = new Library14Petrushin.TextBoxRange();
- pbImage = new PictureBox();
- button1 = new Button();
- button2 = new Button();
- ((System.ComponentModel.ISupportInitialize)pbImage).BeginInit();
- SuspendLayout();
- //
- // dtpDeliveryDate
- //
- dtpDeliveryDate.DateFormat = null;
- dtpDeliveryDate.Location = new Point(13, 137);
- dtpDeliveryDate.Margin = new Padding(4, 5, 4, 5);
- dtpDeliveryDate.Name = "dtpDeliveryDate";
- dtpDeliveryDate.Size = new Size(186, 110);
- dtpDeliveryDate.TabIndex = 0;
- //
- // cmbManufacturer
- //
- cmbManufacturer.Location = new Point(12, 218);
- cmbManufacturer.Margin = new Padding(4, 5, 4, 5);
- cmbManufacturer.Name = "cmbManufacturer";
- cmbManufacturer.SelectedValue = "";
- cmbManufacturer.Size = new Size(201, 40);
- cmbManufacturer.TabIndex = 1;
- //
- // txtName
- //
- txtName.Location = new Point(12, 12);
- txtName.MaxLength = null;
- txtName.MinLength = null;
- txtName.Name = "txtName";
- txtName.Size = new Size(315, 108);
- txtName.TabIndex = 2;
- //
- // pbImage
- //
- pbImage.Location = new Point(320, 32);
- pbImage.Name = "pbImage";
- pbImage.Size = new Size(451, 344);
- pbImage.TabIndex = 3;
- pbImage.TabStop = false;
- //
- // button1
- //
- button1.Location = new Point(320, 399);
- button1.Name = "button1";
- button1.Size = new Size(110, 29);
- button1.TabIndex = 4;
- button1.Text = "Choose img";
- button1.UseVisualStyleBackColor = true;
- button1.Click += btnBrowse_Click;
- //
- // button2
- //
- button2.Location = new Point(12, 326);
- button2.Name = "button2";
- button2.Size = new Size(94, 29);
- button2.TabIndex = 5;
- button2.Text = "Save";
- button2.UseVisualStyleBackColor = true;
- button2.Click += btnSave_Click;
- //
- // ProductForm
- //
- AutoScaleDimensions = new SizeF(8F, 20F);
- AutoScaleMode = AutoScaleMode.Font;
- ClientSize = new Size(800, 450);
- Controls.Add(button2);
- Controls.Add(button1);
- Controls.Add(pbImage);
- Controls.Add(txtName);
- Controls.Add(cmbManufacturer);
- Controls.Add(dtpDeliveryDate);
- Name = "ProductForm";
- Text = "ProductForm";
- ((System.ComponentModel.ISupportInitialize)pbImage).EndInit();
- ResumeLayout(false);
- }
-
- #endregion
-
- private WinFormsLibrary1.DateInputControl dtpDeliveryDate;
- private WinFormsLibrary1.ComboBoxUserControl cmbManufacturer;
- private Library14Petrushin.TextBoxRange txtName;
- private PictureBox pbImage;
- private Button button1;
- private Button button2;
- }
-}
\ No newline at end of file
diff --git a/Laba3/ProductForm.cs b/Laba3/ProductForm.cs
deleted file mode 100644
index 63fac49..0000000
--- a/Laba3/ProductForm.cs
+++ /dev/null
@@ -1,116 +0,0 @@
-using Data;
-using Data.Models;
-using Data.Repositories;
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Globalization;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
-namespace View
-{
- public partial class ProductForm : Form
- {
- private readonly IProductRepository _productRepository;
- private readonly IManufacturerRepository _manufacturerRepository;
- private Product _product;
- private bool _isNewProduct;
- private const int MINL = 3;
- private const int MAXL= 10;
-
- public ProductForm(IProductRepository productRepository, IManufacturerRepository manufacturerRepository, Product product = null)
- {
- InitializeComponent();
- Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
-
- _productRepository = productRepository;
- _manufacturerRepository = manufacturerRepository;
-
-
- var manufacturers = _manufacturerRepository.GetAllManufacturers().Select(m => m.Name).ToList();
- // cmbManufacturer.Data = manufacturers;
- foreach (var manufacturer in manufacturers)
- {
- cmbManufacturer.AddItem(manufacturer);
- }
-
- _product = product;
- _isNewProduct = product == null;
- txtName.MinLength = MINL;
- txtName.MaxLength = MAXL;
- dtpDeliveryDate.DateFormat = "dd MMMM yyyy";
-
- if (!_isNewProduct)
- {
- txtName.InputValue = _product.Name;
- cmbManufacturer.SelectedValue = _product.ManufacturerName;
- dtpDeliveryDate.Date = _product.DeliveryDate;
-
- if (_product.Image != null)
- {
- using (var ms = new MemoryStream(_product.Image))
- {
- pbImage.Image = Image.FromStream(ms);
- }
- }
- }
- }
-
- private void btnBrowse_Click(object sender, EventArgs e)
- {
- using (var openFileDialog = new OpenFileDialog())
- {
- openFileDialog.Filter = "Image Files|*.jpg;*.jpeg;*.png;*.bmp";
- if (openFileDialog.ShowDialog() == DialogResult.OK)
- {
- pbImage.Image = Image.FromFile(openFileDialog.FileName);
- }
- }
- }
-
- private void btnSave_Click(object sender, EventArgs e)
- {
- if (string.IsNullOrEmpty(txtName.InputValue))
- {
- MessageBox.Show("Name is required.");
- return;
- }
-
- if (_isNewProduct)
- {
- _product = new Product();
- }
-
- _product.Name = txtName.InputValue;
- _product.ManufacturerName = cmbManufacturer.SelectedValue.ToString();
- _product.DeliveryDate = dtpDeliveryDate.Date;
-
- if (pbImage.Image != null)
- {
- using (var ms = new MemoryStream())
- {
- pbImage.Image.Save(ms, pbImage.Image.RawFormat);
- _product.Image = ms.ToArray();
- }
- }
-
- if (_isNewProduct)
- {
- _productRepository.AddProduct(_product);
- }
- else
- {
- _productRepository.UpdateProduct(_product);
- }
-
-
- DialogResult = DialogResult.OK;
- Close();
- }
- }
-}
diff --git a/Laba3/Program.cs b/Laba3/Program.cs
index 242e123..2d79bdd 100644
--- a/Laba3/Program.cs
+++ b/Laba3/Program.cs
@@ -11,15 +11,9 @@ namespace View
[STAThread]
static void Main()
{
- // To customize application configuration such as set high DPI settings or default font,
- // see https://aka.ms/applicationconfiguration.
- //
- var dbContext = new ApplicationDbContext();
- var productRepository = new ProductRepository(dbContext);
- var manufacturerRepository = new ManufacturerRepository(dbContext);
// MainForm
- Application.Run(new MainForm(productRepository, manufacturerRepository));
+ Application.Run(new FormMain());
}
}
}
\ No newline at end of file
diff --git a/Laba3/View.csproj b/Laba3/View.csproj
index 4b844d1..84d890f 100644
--- a/Laba3/View.csproj
+++ b/Laba3/View.csproj
@@ -17,11 +17,13 @@
runtime; build; native; contentfiles; analyzers; buildtransitive
+
-
+
+
diff --git a/Library14Petrushin/Library14Petrushin.sln b/Library14Petrushin/Library14Petrushin.sln
index 5985868..faf51a8 100644
--- a/Library14Petrushin/Library14Petrushin.sln
+++ b/Library14Petrushin/Library14Petrushin.sln
@@ -9,7 +9,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "View", "..\Laba3\View.cspro
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Data", "..\Models\Data.csproj", "{DC70937E-903F-4BAA-A774-80D01EC5B75A}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PluginsConvention14", "..\PluginsConvention14\PluginsConvention14.csproj", "{C6CB6D7F-9DCF-414B-8544-1AE4FDE373CD}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PluginsConvention14", "..\PluginsConvention14\PluginsConvention14.csproj", "{C6CB6D7F-9DCF-414B-8544-1AE4FDE373CD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
diff --git a/Plugins/PluginsConvention14.dll b/Plugins/PluginsConvention14.dll
new file mode 100644
index 0000000..49bac5b
Binary files /dev/null and b/Plugins/PluginsConvention14.dll differ
diff --git a/PluginsConvention14/Forms/MainForm.Designer.cs b/PluginsConvention14/Forms/MainForm.Designer.cs
deleted file mode 100644
index 53728bf..0000000
--- a/PluginsConvention14/Forms/MainForm.Designer.cs
+++ /dev/null
@@ -1,178 +0,0 @@
-namespace PluginsConvention14
-{
- partial class MainForm
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- components = new System.ComponentModel.Container();
- menuStrip1 = new MenuStrip();
- createToolStripMenuItem = new ToolStripMenuItem();
- updateToolStripMenuItem = new ToolStripMenuItem();
- deleteToolStripMenuItem = new ToolStripMenuItem();
- manufacturerToolStripMenuItem = new ToolStripMenuItem();
- documentsToolStripMenuItem = new ToolStripMenuItem();
- pdfImageToolStripMenuItem = new ToolStripMenuItem();
- exelTableToolStripMenuItem = new ToolStripMenuItem();
- wordGistToolStripMenuItem = new ToolStripMenuItem();
- outputTableResults = new Library15Gerimovich.OutputTableResults();
- pdfImg = new Library14Petrushin.PdfImg(components);
- wordDiagramComponent = new Library15Gerimovich.WordDiagramComponent(components);
- componentTable = new WinFormsLibrary1.ComponentTable(components);
- saveFileDialogPdf = new SaveFileDialog();
- saveFileDialogWord = new SaveFileDialog();
- saveFileDialogExel = new SaveFileDialog();
- menuStrip1.SuspendLayout();
- SuspendLayout();
- //
- // menuStrip1
- //
- menuStrip1.ImageScalingSize = new Size(20, 20);
- menuStrip1.Items.AddRange(new ToolStripItem[] { createToolStripMenuItem, updateToolStripMenuItem, deleteToolStripMenuItem, manufacturerToolStripMenuItem, documentsToolStripMenuItem });
- menuStrip1.Location = new Point(0, 0);
- menuStrip1.Name = "menuStrip1";
- menuStrip1.Size = new Size(480, 28);
- menuStrip1.TabIndex = 0;
- menuStrip1.Text = "menuStrip1";
- //
- // createToolStripMenuItem
- //
- createToolStripMenuItem.Name = "createToolStripMenuItem";
- createToolStripMenuItem.Size = new Size(66, 24);
- createToolStripMenuItem.Text = "Create";
- createToolStripMenuItem.Click += addToolStripMenuItem_Click;
- //
- // updateToolStripMenuItem
- //
- updateToolStripMenuItem.Name = "updateToolStripMenuItem";
- updateToolStripMenuItem.Size = new Size(72, 24);
- updateToolStripMenuItem.Text = "Update";
- updateToolStripMenuItem.Click += editToolStripMenuItem_Click;
- //
- // deleteToolStripMenuItem
- //
- deleteToolStripMenuItem.Name = "deleteToolStripMenuItem";
- deleteToolStripMenuItem.Size = new Size(67, 24);
- deleteToolStripMenuItem.Text = "Delete";
- deleteToolStripMenuItem.Click += deleteToolStripMenuItem_Click;
- //
- // manufacturerToolStripMenuItem
- //
- manufacturerToolStripMenuItem.Name = "manufacturerToolStripMenuItem";
- manufacturerToolStripMenuItem.Size = new Size(111, 24);
- manufacturerToolStripMenuItem.Text = "Manufacturer";
- manufacturerToolStripMenuItem.Click += manufacturersToolStripMenuItem_Click;
- //
- // documentsToolStripMenuItem
- //
- documentsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { pdfImageToolStripMenuItem, exelTableToolStripMenuItem, wordGistToolStripMenuItem });
- documentsToolStripMenuItem.Name = "documentsToolStripMenuItem";
- documentsToolStripMenuItem.Size = new Size(98, 24);
- documentsToolStripMenuItem.Text = "Documents";
- //
- // pdfImageToolStripMenuItem
- //
- pdfImageToolStripMenuItem.Name = "pdfImageToolStripMenuItem";
- pdfImageToolStripMenuItem.Size = new Size(159, 26);
- pdfImageToolStripMenuItem.Text = "Pdf Image";
- pdfImageToolStripMenuItem.Click += createSimpleDocumentToolStripMenuItem_Click;
- //
- // exelTableToolStripMenuItem
- //
- exelTableToolStripMenuItem.Name = "exelTableToolStripMenuItem";
- exelTableToolStripMenuItem.Size = new Size(159, 26);
- exelTableToolStripMenuItem.Text = "Exel table";
- exelTableToolStripMenuItem.Click += createCustomTableDocumentToolStripMenuItem_Click;
- //
- // wordGistToolStripMenuItem
- //
- wordGistToolStripMenuItem.Name = "wordGistToolStripMenuItem";
- wordGistToolStripMenuItem.Size = new Size(159, 26);
- wordGistToolStripMenuItem.Text = "Word gist";
- wordGistToolStripMenuItem.Click += createChartDocumentToolStripMenuItem_Click;
- //
- // outputTableResults
- //
- outputTableResults.Location = new Point(12, 32);
- outputTableResults.Margin = new Padding(3, 4, 3, 4);
- outputTableResults.Name = "outputTableResults";
- outputTableResults.SelectedRow = -1;
- outputTableResults.Size = new Size(467, 308);
- outputTableResults.TabIndex = 1;
- //
- // saveFileDialogPdf
- //
- saveFileDialogPdf.FileName = "Products.pdf";
- saveFileDialogPdf.Filter = "PDF Files (*.pdf)|*.pdf";
- saveFileDialogPdf.Title = "Save PDF Document";
- //
- // saveFileDialogWord
- //
- saveFileDialogWord.FileName = "Diagram.docx";
- saveFileDialogWord.Filter = "Word Files (*.docx)|*.docx";
- saveFileDialogWord.Title = "Save Word Document";
- //
- // saveFileDialogExel
- //
- saveFileDialogExel.FileName = "ProductReport.xlsx";
- saveFileDialogExel.Filter = "Excel Files (*.xlsx)|*.xlsx";
- saveFileDialogExel.Title = "Save Excel Document";
- //
- // MainForm
- //
- AutoScaleDimensions = new SizeF(8F, 20F);
- AutoScaleMode = AutoScaleMode.Font;
- ClientSize = new Size(480, 351);
- Controls.Add(outputTableResults);
- Controls.Add(menuStrip1);
- KeyPreview = true;
- MainMenuStrip = menuStrip1;
- Name = "MainForm";
- Text = "Form1";
- KeyDown += MainForm_KeyDown;
- menuStrip1.ResumeLayout(false);
- menuStrip1.PerformLayout();
- ResumeLayout(false);
- PerformLayout();
- }
-
- #endregion
-
- private MenuStrip menuStrip1;
- private ToolStripMenuItem createToolStripMenuItem;
- private ToolStripMenuItem updateToolStripMenuItem;
- private Library15Gerimovich.OutputTableResults outputTableResults;
- private ToolStripMenuItem deleteToolStripMenuItem;
- private ToolStripMenuItem manufacturerToolStripMenuItem;
- private ToolStripMenuItem documentsToolStripMenuItem;
- private ToolStripMenuItem pdfImageToolStripMenuItem;
- private ToolStripMenuItem exelTableToolStripMenuItem;
- private ToolStripMenuItem wordGistToolStripMenuItem;
- private Library14Petrushin.PdfImg pdfImg;
- private Library15Gerimovich.WordDiagramComponent wordDiagramComponent;
- private WinFormsLibrary1.ComponentTable componentTable;
- }
-}
diff --git a/PluginsConvention14/Forms/MainForm.cs b/PluginsConvention14/Forms/MainForm.cs
deleted file mode 100644
index 23c22ac..0000000
--- a/PluginsConvention14/Forms/MainForm.cs
+++ /dev/null
@@ -1,284 +0,0 @@
-using Data;
-using Data.Repositories;
-using View;
-using System.Windows.Forms;
-using Data.Models;
-using Library14Petrushin;
-using Library15Gerimovich.OfficePackage.HelperModels;
-using Library15Gerimovich;
-using WinFormsLibrary1;
-using WinFormsLibrary1.Models;
-using View.ViewModels;
-
-namespace PluginsConvention14
-{
- public partial class MainForm : Form
- {
- private readonly IProductRepository _productRepository;
- private readonly IManufacturerRepository _manufacturerRepository;
- private SaveFileDialog saveFileDialogPdf;
- private SaveFileDialog saveFileDialogWord;
- private SaveFileDialog saveFileDialogExel;
-
- public MainForm(IProductRepository productRepository, IManufacturerRepository manufacturerRepository)
- {
- InitializeComponent();
- _productRepository = productRepository;
- _manufacturerRepository = manufacturerRepository;
- InitializeOutputTableResults();
- LoadProducts();
- }
-
- private void InitializeOutputTableResults()
- {
- outputTableResults.ConfigureColumns(new List
- {
- new ColumnInfo("", 0, false, "Id"),
- new ColumnInfo("Name", 150, true, "Name"),
- new ColumnInfo("ManufacturerNameManufacturerName", 150, true, "ManufacturerName"),
- new ColumnInfo("DeliveryDate", 50, true, "DeliveryDate"),
- });
-
- }
-
- private void LoadProducts()
- {
- var products = _productRepository.GetAllProducts();
- outputTableResults.ClearGrid();
- foreach (var product in products)
- {
- outputTableResults.InsertValue(product);
- }
- }
-
- private void addToolStripMenuItem_Click(object sender, EventArgs e)
- {
- var productForm = new ProductForm(_productRepository, _manufacturerRepository);
- if (productForm.ShowDialog() == DialogResult.OK)
- {
- LoadProducts();
- }
- }
-
- private void editToolStripMenuItem_Click(object sender, EventArgs e)
- {
- try
- {
- var selectedProductId = outputTableResults.GetSelectedObject().Id;
- var selectedProduct = _productRepository.GetProductById(selectedProductId);
- var productForm = new ProductForm(_productRepository, _manufacturerRepository, selectedProduct);
- if (productForm.ShowDialog() == DialogResult.OK)
- {
- LoadProducts();
- }
- }
- catch (Exception ex) {
- MessageBox.Show(ex.ToString());
- }
- }
-
- private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
- {
- var selectedProductId = outputTableResults.GetSelectedObject().Id;
- if (MessageBox.Show("Are you sure you want to delete this product?", "Confirm", MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- _productRepository.DeleteProduct(selectedProductId);
- LoadProducts();
- }
- }
-
- private void manufacturersToolStripMenuItem_Click(object sender, EventArgs e)
- {
- var manufacturerForm = new ManufacturerForm(_manufacturerRepository);
- manufacturerForm.ShowDialog();
- }
-
- private void createSimpleDocumentToolStripMenuItem_Click(object sender, EventArgs e)
- {
- // Получаем изображения из базы данных
- var images = GetImagesFromDatabase();
-
- if (images.Count > 0)
- {
- // Показываем диалоговое окно для выбора пути сохранения
- if (saveFileDialogPdf.ShowDialog() == DialogResult.OK)
- {
- // Создаем компонент PdfImg
- var pdfImg = new Library14Petrushin.PdfImg();
-
- // Путь для сохранения PDF-документа
- string fileName = saveFileDialogPdf.FileName;
-
- // Заголовок документа
- string documentTitle = "Product Images";
-
- // Создаем PDF-документ
- pdfImg.CreatePdfDocument(fileName, documentTitle, images);
-
- // Уведомление об успешной загрузке
- MessageBox.Show("PDF document created successfully!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- }
- else
- {
- MessageBox.Show("No images found in the database.");
- }
- }
-
- private void createCustomTableDocumentToolStripMenuItem_Click(object sender, EventArgs e)
- {
- // Получаем все продукты из базы данных
- var products = GetAllProducts();
-
- if (products.Count > 0)
- {
- // Показываем диалоговое окно для выбора пути сохранения
- if (saveFileDialogExel.ShowDialog() == DialogResult.OK)
- {
- // Создаем объекты MergeCell и Column
- var mergeCells = new List
- {
- new MergeCell("Product", new int[] {1, 2})
- };
-
- var columns = new List
- {
- new Column("Id", "Id", 10),
- new Column("Name", "Name", 20),
- new Column("ManufacturerName", "ManufacturerName", 20),
- new Column("DeliveryDate", "DeliveryDate", 20)
- };
-
- // Создаем компонент ComponentTable
- var componentTable = new ComponentTable();
-
- // Конвертируем продукты в представление для таблицы
- var tableItems = ProductTableItem.ConvertProductsToTableItems(products);
-
- // Создаем документ Excel
- componentTable.CreateDocument(saveFileDialogExel.FileName, "Product Report", mergeCells, columns, tableItems);
-
- // Уведомление об успешной загрузке
- MessageBox.Show("Excel document created successfully!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- }
- else
- {
- MessageBox.Show("No products found in the database.");
- }
- }
-
- private void createChartDocumentToolStripMenuItem_Click(object sender, EventArgs e)
- {
- // Получаем данные о количестве продукции каждого производителя
- var productCounts = GetProductCountsByManufacturer();
-
- if (productCounts.Count > 0)
- {
- // Показываем диалоговое окно для выбора пути сохранения
- if (saveFileDialogWord.ShowDialog() == DialogResult.OK)
- {
- // Создаем объект WordDiagramInfo
- var diagramInfo = new WordDiagramInfo
- {
- FileName = saveFileDialogWord.FileName,
- Title = "Product Count by Manufacturer",
- ChartTitle = "Product Count",
- LegendLocation = Library15Gerimovich.OfficePackage.HelperEnums.WordDiagramLegendLocation.Top,
- Series = new WordDiagramSeries
- {
- SeriesName = "Product Count",
- Data = productCounts
- }
- };
-
- // Создаем диаграмму в Word
- wordDiagramComponent.CreateDiagram(diagramInfo);
-
- // Уведомление об успешной загрузке
- MessageBox.Show("Word document with chart created successfully!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- }
- else
- {
- MessageBox.Show("No products found in the database.");
- }
- }
-
- // бизнес логика
-
- private void MainForm_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.Control)
- {
- switch (e.KeyCode)
- {
- case Keys.A:
- addToolStripMenuItem_Click(null, EventArgs.Empty);
- break;
- case Keys.U:
- editToolStripMenuItem_Click(null, EventArgs.Empty);
- break;
- case Keys.D:
- deleteToolStripMenuItem_Click(null, EventArgs.Empty);
- break;
- case Keys.S:
- createSimpleDocumentToolStripMenuItem_Click(null, EventArgs.Empty);
- break;
- case Keys.T:
- createCustomTableDocumentToolStripMenuItem_Click(null, EventArgs.Empty);
- break;
- case Keys.C:
- createChartDocumentToolStripMenuItem_Click(null, EventArgs.Empty);
- break;
- }
- }
- }
-
- private List GetImagesFromDatabase()
- {
- var images = new List();
- var products = _productRepository.GetAllProducts();
-
- foreach (var product in products)
- {
- if (product.Image != null)
- {
- // Создаем временный файл для сохранения изображения
- string tempFilePath = Path.GetTempFileName();
- File.WriteAllBytes(tempFilePath, product.Image);
-
- // Добавляем путь к временному файлу в список
- images.Add(new ImageData { ImagePath = tempFilePath });
- }
- }
-
- return images;
- }
-
- private Dictionary GetProductCountsByManufacturer()
- {
- var productCounts = new Dictionary();
- var products = _productRepository.GetAllProducts();
-
- foreach (var product in products)
- {
- if (productCounts.ContainsKey(product.ManufacturerName))
- {
- productCounts[product.ManufacturerName]++;
- }
- else
- {
- productCounts[product.ManufacturerName] = 1;
- }
- }
-
- return productCounts;
- }
-
- private List GetAllProducts()
- {
- return _productRepository.GetAllProducts().ToList();
- }
- }
-}
diff --git a/PluginsConvention14/Forms/MainForm.resx b/PluginsConvention14/Forms/MainForm.resx
deleted file mode 100644
index 6ce8bc4..0000000
--- a/PluginsConvention14/Forms/MainForm.resx
+++ /dev/null
@@ -1,141 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- 572, 17
-
-
- 708, 17
-
-
- 813, 17
-
-
- 1039, 17
-
-
- 17, 17
-
-
- 195, 17
-
-
- 388, 17
-
-
\ No newline at end of file
diff --git a/PluginsConvention14/Forms/ManufacturerForm.Designer.cs b/PluginsConvention14/Forms/ManufacturerForm.Designer.cs
index fdb5cae..d34b7c9 100644
--- a/PluginsConvention14/Forms/ManufacturerForm.Designer.cs
+++ b/PluginsConvention14/Forms/ManufacturerForm.Designer.cs
@@ -1,4 +1,4 @@
-namespace ViewPluginsConvention14
+namespace PluginsConvention14
{
partial class ManufacturerForm
{
diff --git a/PluginsConvention14/Forms/ManufacturerForm.cs b/PluginsConvention14/Forms/ManufacturerForm.cs
index cf22e6f..af1e794 100644
--- a/PluginsConvention14/Forms/ManufacturerForm.cs
+++ b/PluginsConvention14/Forms/ManufacturerForm.cs
@@ -1,14 +1,5 @@
using Data.Models;
using Data.Repositories;
-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 PluginsConvention14
{
@@ -63,7 +54,7 @@ namespace PluginsConvention14
_manufacturerRepository.AddManufacturer(manufacturer);
LoadManufacturers();
}
-
+
// реализация через нажатие клавишь
diff --git a/PluginsConvention14/Forms/ProductForm.cs b/PluginsConvention14/Forms/ProductForm.cs
index f73451f..9c612cb 100644
--- a/PluginsConvention14/Forms/ProductForm.cs
+++ b/PluginsConvention14/Forms/ProductForm.cs
@@ -1,16 +1,7 @@
-using Data;
-using Data.Models;
+using Data.Models;
using Data.Repositories;
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
using System.Data;
-using System.Drawing;
using System.Globalization;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
namespace PluginsConvention14
{
@@ -21,7 +12,7 @@ namespace PluginsConvention14
private Product _product;
private bool _isNewProduct;
private const int MINL = 3;
- private const int MAXL= 10;
+ private const int MAXL = 10;
public ProductForm(IProductRepository productRepository, IManufacturerRepository manufacturerRepository, Product product = null)
{
@@ -108,7 +99,7 @@ namespace PluginsConvention14
_productRepository.UpdateProduct(_product);
}
-
+
DialogResult = DialogResult.OK;
Close();
}
diff --git a/PluginsConvention14/MyPlugin/MainPluginConvention.cs b/PluginsConvention14/MyPlugin/MainPluginConvention.cs
index 9ca425c..2144152 100644
--- a/PluginsConvention14/MyPlugin/MainPluginConvention.cs
+++ b/PluginsConvention14/MyPlugin/MainPluginConvention.cs
@@ -1,17 +1,11 @@
-using PluginsConventionLibrary.Plugins;
-using System.Composition;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Library15Gerimovich;
-using Data.Repositories;
+using Data;
using Data.Models;
-using Data;
-using View.ViewModels;
-using WinFormsLibrary1;
+using Data.Repositories;
+using Library15Gerimovich;
using Library15Gerimovich.OfficePackage.HelperModels;
+using PluginsConventionLibrary.Plugins;
+using System.Composition;
+using WinFormsLibrary1;
namespace PluginsConvention14.MyPlugin
{
@@ -22,6 +16,7 @@ namespace PluginsConvention14.MyPlugin
private OutputTableResults оutputTableResults;
private readonly IProductRepository _productRepository;
private readonly IManufacturerRepository _manufacturerRepository;
+ public string PluginName { get; set; } = "Products";
public MainPluginConvention()
{
@@ -31,7 +26,7 @@ namespace PluginsConvention14.MyPlugin
оutputTableResults = new OutputTableResults();
var menu = new ContextMenuStrip();
- var skillMenuItem = new ToolStripMenuItem("Формы");
+ var skillMenuItem = new ToolStripMenuItem("Forms");
menu.Items.Add(skillMenuItem);
skillMenuItem.Click += (sender, e) =>
{
@@ -39,15 +34,29 @@ namespace PluginsConvention14.MyPlugin
formSkill.ShowDialog();
};
оutputTableResults.ContextMenuStrip = menu;
+
+ InitializeOutputTableResults();
ReloadData();
}
+ private void InitializeOutputTableResults()
+ {
+ оutputTableResults.ConfigureColumns(new List
+ {
+ new ColumnInfo("", 0, false, "Id"),
+ new ColumnInfo("Name", 150, true, "Name"),
+ new ColumnInfo("ManufacturerNameManufacturerName", 150, true, "ManufacturerName"),
+ new ColumnInfo("DeliveryDate", 50, true, "DeliveryDate"),
+ });
+
+ }
+
/// Название плагина
- string IPluginsConvention.PluginName => PluginName();
+ /*string IPluginsConvention.PluginName => PluginName();
public string PluginName()
{
return "Products";
- }
+ }*/
public UserControl GetControl => оutputTableResults;
@@ -74,7 +83,7 @@ namespace PluginsConvention14.MyPlugin
{
if (element != null)
{
- var formOrder = new ProductForm(_productRepository, _manufacturerRepository, _productRepository.GetProductById(element.Id));
+ var formOrder = new ProductForm(_productRepository, _manufacturerRepository, _productRepository.GetProductById(Convert.ToInt32(element.Id)));
return formOrder;
}
else
@@ -88,7 +97,7 @@ namespace PluginsConvention14.MyPlugin
{
try
{
- _productRepository.DeleteProduct(element.Id);
+ _productRepository.DeleteProduct(Convert.ToInt32(element.Id));
}
catch (Exception ex)
{
@@ -125,18 +134,18 @@ namespace PluginsConvention14.MyPlugin
fileName = dialog.FileName.ToString();
}
}
- // Создаем компонент PdfImg
- var pdfImg = new Library14Petrushin.PdfImg();
+ // Создаем компонент PdfImg
+ var pdfImg = new Library14Petrushin.PdfImg();
- // Заголовок документа
- string documentTitle = "Product Images";
+ // Заголовок документа
+ string documentTitle = "Product Images";
- // Создаем PDF-документ
- pdfImg.CreatePdfDocument(fileName, documentTitle, images);
+ // Создаем PDF-документ
+ pdfImg.CreatePdfDocument(fileName, documentTitle, images);
+
+ // Уведомление об успешной загрузке
+ MessageBox.Show("PDF document created successfully!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
- // Уведомление об успешной загрузке
- MessageBox.Show("PDF document created successfully!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
-
}
}
catch (Exception)
@@ -171,7 +180,7 @@ namespace PluginsConvention14.MyPlugin
{
try
{
-
+
// Получаем все продукты из базы данных
var products = GetAllProducts();
@@ -192,7 +201,7 @@ namespace PluginsConvention14.MyPlugin
new WinFormsLibrary1.Models.MergeCell("Product", new int[] {1, 2})
};
- var columns = new List
+ var columns = new List
{
new WinFormsLibrary1.Models.Column("Id", "Id", 10),
new WinFormsLibrary1.Models.Column("Name", "Name", 20),
@@ -200,23 +209,24 @@ namespace PluginsConvention14.MyPlugin
new WinFormsLibrary1.Models.Column("DeliveryDate", "DeliveryDate", 20)
};
- // Создаем компонент ComponentTable
- var componentTable = new ComponentTable();
+ // Создаем компонент ComponentTable
+ var componentTable = new ComponentTable();
- // Конвертируем продукты в представление для таблицы
- var tableItems = ProductTableItem.ConvertProductsToTableItems(products);
+ // Конвертируем продукты в представление для таблицы
+ var tableItems = MainPluginConventionElement.ConvertProductsToTableItems(products);
- // Создаем документ Excel
- componentTable.CreateDocument(fileName, "Product Report", mergeCells, columns, tableItems);
+ // Создаем документ Excel
+ componentTable.CreateDocument(fileName, "Product Report", mergeCells, columns, tableItems);
- // Уведомление об успешной загрузке
- MessageBox.Show("Excel document created successfully!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }else
+ // Уведомление об успешной загрузке
+ MessageBox.Show("Excel document created successfully!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+ else
{
MessageBox.Show("No products found in the database.");
}
- }
-
+ }
+
catch (Exception)
{
return false;
@@ -248,27 +258,27 @@ namespace PluginsConvention14.MyPlugin
if (productCounts.Count > 0)
{
- // Создаем объект WordDiagramInfo
- var diagramInfo = new WordDiagramInfo
+ // Создаем объект WordDiagramInfo
+ var diagramInfo = new WordDiagramInfo
+ {
+ FileName = fileName,
+ Title = "Product Count by Manufacturer",
+ ChartTitle = "Product Count",
+ LegendLocation = Library15Gerimovich.OfficePackage.HelperEnums.WordDiagramLegendLocation.Top,
+ Series = new WordDiagramSeries
{
- FileName = fileName,
- Title = "Product Count by Manufacturer",
- ChartTitle = "Product Count",
- LegendLocation = Library15Gerimovich.OfficePackage.HelperEnums.WordDiagramLegendLocation.Top,
- Series = new WordDiagramSeries
- {
- SeriesName = "Product Count",
- Data = productCounts
- }
- };
+ SeriesName = "Product Count",
+ Data = productCounts
+ }
+ };
var wordDiagramComponent = new WordDiagramComponent();
- // Создаем диаграмму в Word
- wordDiagramComponent.CreateDiagram(diagramInfo);
+ // Создаем диаграмму в Word
+ wordDiagramComponent.CreateDiagram(diagramInfo);
- // Уведомление об успешной загрузке
- MessageBox.Show("Word document with chart created successfully!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ // Уведомление об успешной загрузке
+ MessageBox.Show("Word document with chart created successfully!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
diff --git a/PluginsConvention14/MyPlugin/MainPluginsConventionElement.cs b/PluginsConvention14/MyPlugin/MainPluginsConventionElement.cs
index e3ae721..39263c4 100644
--- a/PluginsConvention14/MyPlugin/MainPluginsConventionElement.cs
+++ b/PluginsConvention14/MyPlugin/MainPluginsConventionElement.cs
@@ -1,11 +1,5 @@
using Data.Models;
using PluginsConventionLibrary.Plugins;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using View.ViewModels;
namespace PluginsConvention14.MyPlugin
{
@@ -14,11 +8,11 @@ namespace PluginsConvention14.MyPlugin
public string Name { get; set; }
public string ManufacturerName { get; set; }
public string DeliveryDate { get; set; }
- public static List ConvertProductsToTableItems(List products)
+ public static List ConvertProductsToTableItems(List products)
{
- return products.Select(p => new ProductTableItem
+ return products.Select(p => new MainPluginConventionElement
{
- Id = p.Id.ToString(),
+ Id = p.Id,
Name = p.Name,
ManufacturerName = p.ManufacturerName,
DeliveryDate = p.DeliveryDate.ToShortDateString()
diff --git a/PluginsConvention14/Plugins/IPluginsConvention.cs b/PluginsConvention14/Plugins/IPluginsConvention.cs
index 664ebc4..c055a6f 100644
--- a/PluginsConvention14/Plugins/IPluginsConvention.cs
+++ b/PluginsConvention14/Plugins/IPluginsConvention.cs
@@ -1,10 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace PluginsConventionLibrary.Plugins
+namespace PluginsConventionLibrary.Plugins
{
public interface IPluginsConvention
{
diff --git a/PluginsConvention14/Plugins/PluginsConventionElement.cs b/PluginsConvention14/Plugins/PluginsConventionElement.cs
index 1dea201..99f7ef9 100644
--- a/PluginsConvention14/Plugins/PluginsConventionElement.cs
+++ b/PluginsConvention14/Plugins/PluginsConventionElement.cs
@@ -1,10 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace PluginsConventionLibrary.Plugins
+namespace PluginsConventionLibrary.Plugins
{
public class PluginsConventionElement
{
diff --git a/PluginsConvention14/Plugins/PluginsConventionSaveDocument.cs b/PluginsConvention14/Plugins/PluginsConventionSaveDocument.cs
index 614962e..a0a7ce1 100644
--- a/PluginsConvention14/Plugins/PluginsConventionSaveDocument.cs
+++ b/PluginsConvention14/Plugins/PluginsConventionSaveDocument.cs
@@ -1,10 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace PluginsConventionLibrary.Plugins
+namespace PluginsConventionLibrary.Plugins
{
public class PluginsConventionSaveDocument
{
diff --git a/PluginsConvention14/PluginsConvention14.csproj b/PluginsConvention14/PluginsConvention14.csproj
index 1cd0837..2c85b89 100644
--- a/PluginsConvention14/PluginsConvention14.csproj
+++ b/PluginsConvention14/PluginsConvention14.csproj
@@ -9,20 +9,17 @@
+
-
-
- Form
-
Form
diff --git a/PluginsConventionLibrary/Forms/MainForm.Designer.cs b/PluginsConventionLibrary/Forms/MainForm.Designer.cs
deleted file mode 100644
index 30b9dc5..0000000
--- a/PluginsConventionLibrary/Forms/MainForm.Designer.cs
+++ /dev/null
@@ -1,178 +0,0 @@
-namespace Laba3
-{
- partial class MainForm
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- components = new System.ComponentModel.Container();
- menuStrip1 = new MenuStrip();
- createToolStripMenuItem = new ToolStripMenuItem();
- updateToolStripMenuItem = new ToolStripMenuItem();
- deleteToolStripMenuItem = new ToolStripMenuItem();
- manufacturerToolStripMenuItem = new ToolStripMenuItem();
- documentsToolStripMenuItem = new ToolStripMenuItem();
- pdfImageToolStripMenuItem = new ToolStripMenuItem();
- exelTableToolStripMenuItem = new ToolStripMenuItem();
- wordGistToolStripMenuItem = new ToolStripMenuItem();
- outputTableResults = new Library15Gerimovich.OutputTableResults();
- pdfImg = new Library14Petrushin.PdfImg(components);
- wordDiagramComponent = new Library15Gerimovich.WordDiagramComponent(components);
- componentTable = new WinFormsLibrary1.ComponentTable(components);
- saveFileDialogPdf = new SaveFileDialog();
- saveFileDialogWord = new SaveFileDialog();
- saveFileDialogExel = new SaveFileDialog();
- menuStrip1.SuspendLayout();
- SuspendLayout();
- //
- // menuStrip1
- //
- menuStrip1.ImageScalingSize = new Size(20, 20);
- menuStrip1.Items.AddRange(new ToolStripItem[] { createToolStripMenuItem, updateToolStripMenuItem, deleteToolStripMenuItem, manufacturerToolStripMenuItem, documentsToolStripMenuItem });
- menuStrip1.Location = new Point(0, 0);
- menuStrip1.Name = "menuStrip1";
- menuStrip1.Size = new Size(480, 28);
- menuStrip1.TabIndex = 0;
- menuStrip1.Text = "menuStrip1";
- //
- // createToolStripMenuItem
- //
- createToolStripMenuItem.Name = "createToolStripMenuItem";
- createToolStripMenuItem.Size = new Size(66, 24);
- createToolStripMenuItem.Text = "Create";
- createToolStripMenuItem.Click += addToolStripMenuItem_Click;
- //
- // updateToolStripMenuItem
- //
- updateToolStripMenuItem.Name = "updateToolStripMenuItem";
- updateToolStripMenuItem.Size = new Size(72, 24);
- updateToolStripMenuItem.Text = "Update";
- updateToolStripMenuItem.Click += editToolStripMenuItem_Click;
- //
- // deleteToolStripMenuItem
- //
- deleteToolStripMenuItem.Name = "deleteToolStripMenuItem";
- deleteToolStripMenuItem.Size = new Size(67, 24);
- deleteToolStripMenuItem.Text = "Delete";
- deleteToolStripMenuItem.Click += deleteToolStripMenuItem_Click;
- //
- // manufacturerToolStripMenuItem
- //
- manufacturerToolStripMenuItem.Name = "manufacturerToolStripMenuItem";
- manufacturerToolStripMenuItem.Size = new Size(111, 24);
- manufacturerToolStripMenuItem.Text = "Manufacturer";
- manufacturerToolStripMenuItem.Click += manufacturersToolStripMenuItem_Click;
- //
- // documentsToolStripMenuItem
- //
- documentsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { pdfImageToolStripMenuItem, exelTableToolStripMenuItem, wordGistToolStripMenuItem });
- documentsToolStripMenuItem.Name = "documentsToolStripMenuItem";
- documentsToolStripMenuItem.Size = new Size(98, 24);
- documentsToolStripMenuItem.Text = "Documents";
- //
- // pdfImageToolStripMenuItem
- //
- pdfImageToolStripMenuItem.Name = "pdfImageToolStripMenuItem";
- pdfImageToolStripMenuItem.Size = new Size(159, 26);
- pdfImageToolStripMenuItem.Text = "Pdf Image";
- pdfImageToolStripMenuItem.Click += createSimpleDocumentToolStripMenuItem_Click;
- //
- // exelTableToolStripMenuItem
- //
- exelTableToolStripMenuItem.Name = "exelTableToolStripMenuItem";
- exelTableToolStripMenuItem.Size = new Size(159, 26);
- exelTableToolStripMenuItem.Text = "Exel table";
- exelTableToolStripMenuItem.Click += createCustomTableDocumentToolStripMenuItem_Click;
- //
- // wordGistToolStripMenuItem
- //
- wordGistToolStripMenuItem.Name = "wordGistToolStripMenuItem";
- wordGistToolStripMenuItem.Size = new Size(159, 26);
- wordGistToolStripMenuItem.Text = "Word gist";
- wordGistToolStripMenuItem.Click += createChartDocumentToolStripMenuItem_Click;
- //
- // outputTableResults
- //
- outputTableResults.Location = new Point(12, 32);
- outputTableResults.Margin = new Padding(3, 4, 3, 4);
- outputTableResults.Name = "outputTableResults";
- outputTableResults.SelectedRow = -1;
- outputTableResults.Size = new Size(467, 308);
- outputTableResults.TabIndex = 1;
- //
- // saveFileDialogPdf
- //
- saveFileDialogPdf.FileName = "Products.pdf";
- saveFileDialogPdf.Filter = "PDF Files (*.pdf)|*.pdf";
- saveFileDialogPdf.Title = "Save PDF Document";
- //
- // saveFileDialogWord
- //
- saveFileDialogWord.FileName = "Diagram.docx";
- saveFileDialogWord.Filter = "Word Files (*.docx)|*.docx";
- saveFileDialogWord.Title = "Save Word Document";
- //
- // saveFileDialogExel
- //
- saveFileDialogExel.FileName = "ProductReport.xlsx";
- saveFileDialogExel.Filter = "Excel Files (*.xlsx)|*.xlsx";
- saveFileDialogExel.Title = "Save Excel Document";
- //
- // MainForm
- //
- AutoScaleDimensions = new SizeF(8F, 20F);
- AutoScaleMode = AutoScaleMode.Font;
- ClientSize = new Size(480, 351);
- Controls.Add(outputTableResults);
- Controls.Add(menuStrip1);
- KeyPreview = true;
- MainMenuStrip = menuStrip1;
- Name = "MainForm";
- Text = "Form1";
- KeyDown += MainForm_KeyDown;
- menuStrip1.ResumeLayout(false);
- menuStrip1.PerformLayout();
- ResumeLayout(false);
- PerformLayout();
- }
-
- #endregion
-
- private MenuStrip menuStrip1;
- private ToolStripMenuItem createToolStripMenuItem;
- private ToolStripMenuItem updateToolStripMenuItem;
- private Library15Gerimovich.OutputTableResults outputTableResults;
- private ToolStripMenuItem deleteToolStripMenuItem;
- private ToolStripMenuItem manufacturerToolStripMenuItem;
- private ToolStripMenuItem documentsToolStripMenuItem;
- private ToolStripMenuItem pdfImageToolStripMenuItem;
- private ToolStripMenuItem exelTableToolStripMenuItem;
- private ToolStripMenuItem wordGistToolStripMenuItem;
- private Library14Petrushin.PdfImg pdfImg;
- private Library15Gerimovich.WordDiagramComponent wordDiagramComponent;
- private WinFormsLibrary1.ComponentTable componentTable;
- }
-}
diff --git a/PluginsConventionLibrary/Forms/MainForm.cs b/PluginsConventionLibrary/Forms/MainForm.cs
deleted file mode 100644
index c0e33f2..0000000
--- a/PluginsConventionLibrary/Forms/MainForm.cs
+++ /dev/null
@@ -1,284 +0,0 @@
-using Data;
-using Data.Repositories;
-using View;
-using System.Windows.Forms;
-using Data.Models;
-using Library14Petrushin;
-using Library15Gerimovich.OfficePackage.HelperModels;
-using Library15Gerimovich;
-using WinFormsLibrary1;
-using WinFormsLibrary1.Models;
-using View.ViewModels;
-
-namespace Laba3
-{
- public partial class MainForm : Form
- {
- private readonly IProductRepository _productRepository;
- private readonly IManufacturerRepository _manufacturerRepository;
- private SaveFileDialog saveFileDialogPdf;
- private SaveFileDialog saveFileDialogWord;
- private SaveFileDialog saveFileDialogExel;
-
- public MainForm(IProductRepository productRepository, IManufacturerRepository manufacturerRepository)
- {
- InitializeComponent();
- _productRepository = productRepository;
- _manufacturerRepository = manufacturerRepository;
- InitializeOutputTableResults();
- LoadProducts();
- }
-
- private void InitializeOutputTableResults()
- {
- outputTableResults.ConfigureColumns(new List
- {
- new ColumnInfo("", 0, false, "Id"),
- new ColumnInfo("Name", 150, true, "Name"),
- new ColumnInfo("ManufacturerNameManufacturerName", 150, true, "ManufacturerName"),
- new ColumnInfo("DeliveryDate", 50, true, "DeliveryDate"),
- });
-
- }
-
- private void LoadProducts()
- {
- var products = _productRepository.GetAllProducts();
- outputTableResults.ClearGrid();
- foreach (var product in products)
- {
- outputTableResults.InsertValue(product);
- }
- }
-
- private void addToolStripMenuItem_Click(object sender, EventArgs e)
- {
- var productForm = new ProductForm(_productRepository, _manufacturerRepository);
- if (productForm.ShowDialog() == DialogResult.OK)
- {
- LoadProducts();
- }
- }
-
- private void editToolStripMenuItem_Click(object sender, EventArgs e)
- {
- try
- {
- var selectedProductId = outputTableResults.GetSelectedObject().Id;
- var selectedProduct = _productRepository.GetProductById(selectedProductId);
- var productForm = new ProductForm(_productRepository, _manufacturerRepository, selectedProduct);
- if (productForm.ShowDialog() == DialogResult.OK)
- {
- LoadProducts();
- }
- }
- catch (Exception ex) {
- MessageBox.Show(ex.ToString());
- }
- }
-
- private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
- {
- var selectedProductId = outputTableResults.GetSelectedObject().Id;
- if (MessageBox.Show("Are you sure you want to delete this product?", "Confirm", MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- _productRepository.DeleteProduct(selectedProductId);
- LoadProducts();
- }
- }
-
- private void manufacturersToolStripMenuItem_Click(object sender, EventArgs e)
- {
- var manufacturerForm = new ManufacturerForm(_manufacturerRepository);
- manufacturerForm.ShowDialog();
- }
-
- private void createSimpleDocumentToolStripMenuItem_Click(object sender, EventArgs e)
- {
- // Получаем изображения из базы данных
- var images = GetImagesFromDatabase();
-
- if (images.Count > 0)
- {
- // Показываем диалоговое окно для выбора пути сохранения
- if (saveFileDialogPdf.ShowDialog() == DialogResult.OK)
- {
- // Создаем компонент PdfImg
- var pdfImg = new Library14Petrushin.PdfImg();
-
- // Путь для сохранения PDF-документа
- string fileName = saveFileDialogPdf.FileName;
-
- // Заголовок документа
- string documentTitle = "Product Images";
-
- // Создаем PDF-документ
- pdfImg.CreatePdfDocument(fileName, documentTitle, images);
-
- // Уведомление об успешной загрузке
- MessageBox.Show("PDF document created successfully!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- }
- else
- {
- MessageBox.Show("No images found in the database.");
- }
- }
-
- private void createCustomTableDocumentToolStripMenuItem_Click(object sender, EventArgs e)
- {
- // Получаем все продукты из базы данных
- var products = GetAllProducts();
-
- if (products.Count > 0)
- {
- // Показываем диалоговое окно для выбора пути сохранения
- if (saveFileDialogExel.ShowDialog() == DialogResult.OK)
- {
- // Создаем объекты MergeCell и Column
- var mergeCells = new List
- {
- new MergeCell("Product", new int[] {1, 2})
- };
-
- var columns = new List
- {
- new Column("Id", "Id", 10),
- new Column("Name", "Name", 20),
- new Column("ManufacturerName", "ManufacturerName", 20),
- new Column("DeliveryDate", "DeliveryDate", 20)
- };
-
- // Создаем компонент ComponentTable
- var componentTable = new ComponentTable();
-
- // Конвертируем продукты в представление для таблицы
- var tableItems = ProductTableItem.ConvertProductsToTableItems(products);
-
- // Создаем документ Excel
- componentTable.CreateDocument(saveFileDialogExel.FileName, "Product Report", mergeCells, columns, tableItems);
-
- // Уведомление об успешной загрузке
- MessageBox.Show("Excel document created successfully!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- }
- else
- {
- MessageBox.Show("No products found in the database.");
- }
- }
-
- private void createChartDocumentToolStripMenuItem_Click(object sender, EventArgs e)
- {
- // Получаем данные о количестве продукции каждого производителя
- var productCounts = GetProductCountsByManufacturer();
-
- if (productCounts.Count > 0)
- {
- // Показываем диалоговое окно для выбора пути сохранения
- if (saveFileDialogWord.ShowDialog() == DialogResult.OK)
- {
- // Создаем объект WordDiagramInfo
- var diagramInfo = new WordDiagramInfo
- {
- FileName = saveFileDialogWord.FileName,
- Title = "Product Count by Manufacturer",
- ChartTitle = "Product Count",
- LegendLocation = Library15Gerimovich.OfficePackage.HelperEnums.WordDiagramLegendLocation.Top,
- Series = new WordDiagramSeries
- {
- SeriesName = "Product Count",
- Data = productCounts
- }
- };
-
- // Создаем диаграмму в Word
- wordDiagramComponent.CreateDiagram(diagramInfo);
-
- // Уведомление об успешной загрузке
- MessageBox.Show("Word document with chart created successfully!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- }
- else
- {
- MessageBox.Show("No products found in the database.");
- }
- }
-
- // бизнес логика
-
- private void MainForm_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.Control)
- {
- switch (e.KeyCode)
- {
- case Keys.A:
- addToolStripMenuItem_Click(null, EventArgs.Empty);
- break;
- case Keys.U:
- editToolStripMenuItem_Click(null, EventArgs.Empty);
- break;
- case Keys.D:
- deleteToolStripMenuItem_Click(null, EventArgs.Empty);
- break;
- case Keys.S:
- createSimpleDocumentToolStripMenuItem_Click(null, EventArgs.Empty);
- break;
- case Keys.T:
- createCustomTableDocumentToolStripMenuItem_Click(null, EventArgs.Empty);
- break;
- case Keys.C:
- createChartDocumentToolStripMenuItem_Click(null, EventArgs.Empty);
- break;
- }
- }
- }
-
- private List GetImagesFromDatabase()
- {
- var images = new List();
- var products = _productRepository.GetAllProducts();
-
- foreach (var product in products)
- {
- if (product.Image != null)
- {
- // Создаем временный файл для сохранения изображения
- string tempFilePath = Path.GetTempFileName();
- File.WriteAllBytes(tempFilePath, product.Image);
-
- // Добавляем путь к временному файлу в список
- images.Add(new ImageData { ImagePath = tempFilePath });
- }
- }
-
- return images;
- }
-
- private Dictionary GetProductCountsByManufacturer()
- {
- var productCounts = new Dictionary();
- var products = _productRepository.GetAllProducts();
-
- foreach (var product in products)
- {
- if (productCounts.ContainsKey(product.ManufacturerName))
- {
- productCounts[product.ManufacturerName]++;
- }
- else
- {
- productCounts[product.ManufacturerName] = 1;
- }
- }
-
- return productCounts;
- }
-
- private List GetAllProducts()
- {
- return _productRepository.GetAllProducts().ToList();
- }
- }
-}
diff --git a/PluginsConventionLibrary/Forms/MainForm.resx b/PluginsConventionLibrary/Forms/MainForm.resx
deleted file mode 100644
index 6ce8bc4..0000000
--- a/PluginsConventionLibrary/Forms/MainForm.resx
+++ /dev/null
@@ -1,141 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- 572, 17
-
-
- 708, 17
-
-
- 813, 17
-
-
- 1039, 17
-
-
- 17, 17
-
-
- 195, 17
-
-
- 388, 17
-
-
\ No newline at end of file
diff --git a/PluginsConventionLibrary/Forms/ManufacturerForm.Designer.cs b/PluginsConventionLibrary/Forms/ManufacturerForm.Designer.cs
deleted file mode 100644
index 89fec90..0000000
--- a/PluginsConventionLibrary/Forms/ManufacturerForm.Designer.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-namespace View
-{
- partial class ManufacturerForm
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- dataGridView = new DataGridView();
- ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
- SuspendLayout();
- //
- // dataGridView
- //
- dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
- dataGridView.Location = new Point(12, 12);
- dataGridView.Name = "dataGridView";
- dataGridView.RowHeadersWidth = 51;
- dataGridView.Size = new Size(711, 426);
- dataGridView.TabIndex = 0;
- dataGridView.CellValueChanged += dataGridView_CellValueChanged;
- dataGridView.UserAddedRow += dataGridView_UserAddedRow;
- dataGridView.UserDeletingRow += dataGridView_UserDeletingRow;
- dataGridView.KeyDown += dataGridView_KeyDown;
- //
- // ManufacturerForm
- //
- AutoScaleDimensions = new SizeF(8F, 20F);
- AutoScaleMode = AutoScaleMode.Font;
- ClientSize = new Size(731, 450);
- Controls.Add(dataGridView);
- Name = "ManufacturerForm";
- Text = "ManufacturerForm";
- ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
- ResumeLayout(false);
- }
-
- #endregion
-
- private DataGridView dataGridView;
- }
-}
\ No newline at end of file
diff --git a/PluginsConventionLibrary/Forms/ManufacturerForm.cs b/PluginsConventionLibrary/Forms/ManufacturerForm.cs
deleted file mode 100644
index 23638fb..0000000
--- a/PluginsConventionLibrary/Forms/ManufacturerForm.cs
+++ /dev/null
@@ -1,95 +0,0 @@
-using Data.Models;
-using Data.Repositories;
-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 View
-{
- public partial class ManufacturerForm : Form
- {
- private readonly IManufacturerRepository _manufacturerRepository;
-
- public ManufacturerForm(IManufacturerRepository manufacturerRepository)
- {
- InitializeComponent();
- _manufacturerRepository = manufacturerRepository;
- LoadManufacturers();
- }
-
- private void LoadManufacturers()
- {
- var manufacturers = _manufacturerRepository.GetAllManufacturers().ToList();
- dataGridView.DataSource = manufacturers;
- }
-
- private void dataGridView_CellValueChanged(object sender, DataGridViewCellEventArgs e)
- {
- if (e.RowIndex >= 0)
- {
- var manufacturer = dataGridView.Rows[e.RowIndex].DataBoundItem as Manufacturer;
- if (manufacturer != null)
- {
- _manufacturerRepository.UpdateManufacturer(manufacturer);
- }
- }
- }
-
- private void dataGridView_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
- {
- var manufacturer = e.Row.DataBoundItem as Manufacturer;
- if (manufacturer != null)
- {
- if (MessageBox.Show("Are you sure you want to delete this manufacturer?", "Confirm", MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- _manufacturerRepository.DeleteManufacturer(manufacturer.Id);
- }
- else
- {
- e.Cancel = true;
- }
- }
- }
-
- private void dataGridView_UserAddedRow(object sender, DataGridViewRowEventArgs e)
- {
- var manufacturer = new Manufacturer { Name = "" };
- _manufacturerRepository.AddManufacturer(manufacturer);
- LoadManufacturers();
- }
-
-
- // реализация через нажатие клавишь
-
- private void dataGridView_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyCode == Keys.Insert)
- {
- var manufacturer = new Manufacturer { Name = "" };
- _manufacturerRepository.AddManufacturer(manufacturer);
- LoadManufacturers();
- }
- else if (e.KeyCode == Keys.Delete)
- {
- if (dataGridView.SelectedRows.Count > 0)
- {
- var selectedManufacturer = dataGridView.SelectedRows[0].DataBoundItem as Manufacturer;
- if (selectedManufacturer != null)
- {
- if (MessageBox.Show("Are you sure you want to delete this manufacturer?", "Confirm", MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- _manufacturerRepository.DeleteManufacturer(selectedManufacturer.Id);
- LoadManufacturers();
- }
- }
- }
- }
- }
- }
-}
diff --git a/PluginsConventionLibrary/Forms/ManufacturerForm.resx b/PluginsConventionLibrary/Forms/ManufacturerForm.resx
deleted file mode 100644
index af32865..0000000
--- a/PluginsConventionLibrary/Forms/ManufacturerForm.resx
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
\ No newline at end of file
diff --git a/PluginsConventionLibrary/Forms/ProductForm.Designer.cs b/PluginsConventionLibrary/Forms/ProductForm.Designer.cs
deleted file mode 100644
index c64b5a8..0000000
--- a/PluginsConventionLibrary/Forms/ProductForm.Designer.cs
+++ /dev/null
@@ -1,121 +0,0 @@
-namespace Laba3
-{
- partial class ProductForm
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- dtpDeliveryDate = new WinFormsLibrary1.DateInputControl();
- cmbManufacturer = new WinFormsLibrary1.ComboBoxUserControl();
- txtName = new Library14Petrushin.TextBoxRange();
- pbImage = new PictureBox();
- button1 = new Button();
- button2 = new Button();
- ((System.ComponentModel.ISupportInitialize)pbImage).BeginInit();
- SuspendLayout();
- //
- // dtpDeliveryDate
- //
- dtpDeliveryDate.DateFormat = null;
- dtpDeliveryDate.Location = new Point(13, 137);
- dtpDeliveryDate.Margin = new Padding(4, 5, 4, 5);
- dtpDeliveryDate.Name = "dtpDeliveryDate";
- dtpDeliveryDate.Size = new Size(186, 110);
- dtpDeliveryDate.TabIndex = 0;
- //
- // cmbManufacturer
- //
- cmbManufacturer.Location = new Point(12, 218);
- cmbManufacturer.Margin = new Padding(4, 5, 4, 5);
- cmbManufacturer.Name = "cmbManufacturer";
- cmbManufacturer.SelectedValue = "";
- cmbManufacturer.Size = new Size(201, 40);
- cmbManufacturer.TabIndex = 1;
- //
- // txtName
- //
- txtName.Location = new Point(12, 12);
- txtName.MaxLength = null;
- txtName.MinLength = null;
- txtName.Name = "txtName";
- txtName.Size = new Size(315, 108);
- txtName.TabIndex = 2;
- //
- // pbImage
- //
- pbImage.Location = new Point(320, 32);
- pbImage.Name = "pbImage";
- pbImage.Size = new Size(451, 344);
- pbImage.TabIndex = 3;
- pbImage.TabStop = false;
- //
- // button1
- //
- button1.Location = new Point(320, 399);
- button1.Name = "button1";
- button1.Size = new Size(110, 29);
- button1.TabIndex = 4;
- button1.Text = "Choose img";
- button1.UseVisualStyleBackColor = true;
- button1.Click += btnBrowse_Click;
- //
- // button2
- //
- button2.Location = new Point(12, 326);
- button2.Name = "button2";
- button2.Size = new Size(94, 29);
- button2.TabIndex = 5;
- button2.Text = "Save";
- button2.UseVisualStyleBackColor = true;
- button2.Click += btnSave_Click;
- //
- // ProductForm
- //
- AutoScaleDimensions = new SizeF(8F, 20F);
- AutoScaleMode = AutoScaleMode.Font;
- ClientSize = new Size(800, 450);
- Controls.Add(button2);
- Controls.Add(button1);
- Controls.Add(pbImage);
- Controls.Add(txtName);
- Controls.Add(cmbManufacturer);
- Controls.Add(dtpDeliveryDate);
- Name = "ProductForm";
- Text = "ProductForm";
- ((System.ComponentModel.ISupportInitialize)pbImage).EndInit();
- ResumeLayout(false);
- }
-
- #endregion
-
- private WinFormsLibrary1.DateInputControl dtpDeliveryDate;
- private WinFormsLibrary1.ComboBoxUserControl cmbManufacturer;
- private Library14Petrushin.TextBoxRange txtName;
- private PictureBox pbImage;
- private Button button1;
- private Button button2;
- }
-}
\ No newline at end of file
diff --git a/PluginsConventionLibrary/Forms/ProductForm.cs b/PluginsConventionLibrary/Forms/ProductForm.cs
deleted file mode 100644
index 3e88d28..0000000
--- a/PluginsConventionLibrary/Forms/ProductForm.cs
+++ /dev/null
@@ -1,116 +0,0 @@
-using Data;
-using Data.Models;
-using Data.Repositories;
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Globalization;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
-namespace Laba3
-{
- public partial class ProductForm : Form
- {
- private readonly IProductRepository _productRepository;
- private readonly IManufacturerRepository _manufacturerRepository;
- private Product _product;
- private bool _isNewProduct;
- private const int MINL = 3;
- private const int MAXL= 10;
-
- public ProductForm(IProductRepository productRepository, IManufacturerRepository manufacturerRepository, Product product = null)
- {
- InitializeComponent();
- Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
-
- _productRepository = productRepository;
- _manufacturerRepository = manufacturerRepository;
-
-
- var manufacturers = _manufacturerRepository.GetAllManufacturers().Select(m => m.Name).ToList();
- // cmbManufacturer.Data = manufacturers;
- foreach (var manufacturer in manufacturers)
- {
- cmbManufacturer.AddItem(manufacturer);
- }
-
- _product = product;
- _isNewProduct = product == null;
- txtName.MinLength = MINL;
- txtName.MaxLength = MAXL;
- dtpDeliveryDate.DateFormat = "dd MMMM yyyy";
-
- if (!_isNewProduct)
- {
- txtName.InputValue = _product.Name;
- cmbManufacturer.SelectedValue = _product.ManufacturerName;
- dtpDeliveryDate.Date = _product.DeliveryDate;
-
- if (_product.Image != null)
- {
- using (var ms = new MemoryStream(_product.Image))
- {
- pbImage.Image = Image.FromStream(ms);
- }
- }
- }
- }
-
- private void btnBrowse_Click(object sender, EventArgs e)
- {
- using (var openFileDialog = new OpenFileDialog())
- {
- openFileDialog.Filter = "Image Files|*.jpg;*.jpeg;*.png;*.bmp";
- if (openFileDialog.ShowDialog() == DialogResult.OK)
- {
- pbImage.Image = Image.FromFile(openFileDialog.FileName);
- }
- }
- }
-
- private void btnSave_Click(object sender, EventArgs e)
- {
- if (string.IsNullOrEmpty(txtName.InputValue))
- {
- MessageBox.Show("Name is required.");
- return;
- }
-
- if (_isNewProduct)
- {
- _product = new Product();
- }
-
- _product.Name = txtName.InputValue;
- _product.ManufacturerName = cmbManufacturer.SelectedValue.ToString();
- _product.DeliveryDate = dtpDeliveryDate.Date;
-
- if (pbImage.Image != null)
- {
- using (var ms = new MemoryStream())
- {
- pbImage.Image.Save(ms, pbImage.Image.RawFormat);
- _product.Image = ms.ToArray();
- }
- }
-
- if (_isNewProduct)
- {
- _productRepository.AddProduct(_product);
- }
- else
- {
- _productRepository.UpdateProduct(_product);
- }
-
-
- DialogResult = DialogResult.OK;
- Close();
- }
- }
-}
diff --git a/PluginsConventionLibrary/Forms/ProductForm.resx b/PluginsConventionLibrary/Forms/ProductForm.resx
deleted file mode 100644
index af32865..0000000
--- a/PluginsConventionLibrary/Forms/ProductForm.resx
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
\ No newline at end of file
diff --git a/PluginsConventionLibrary/Plugins/IPluginsConvention.cs b/PluginsConventionLibrary/Plugins/IPluginsConvention.cs
deleted file mode 100644
index 664ebc4..0000000
--- a/PluginsConventionLibrary/Plugins/IPluginsConvention.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace PluginsConventionLibrary.Plugins
-{
- public interface IPluginsConvention
- {
- ///
- /// Название плагина
- ///
- string PluginName { get; }
-
- ///
- /// Получение контрола для вывода набора данных
- ///
- UserControl GetControl { get; }
-
- ///
- /// Получение элемента, выбранного в контроле
- ///
- PluginsConventionElement GetElement { get; }
-
- ///
- /// Получение формы для создания/редактирования объекта
- ///
- ///
- ///
- Form GetForm(PluginsConventionElement element);
-
- ///
- /// Удаление элемента
- ///
- ///
- ///
- bool DeleteElement(PluginsConventionElement element);
-
- ///
- /// Обновление набора данных в контроле
- ///
- void ReloadData();
-
- ///
- /// Создание простого документа
- ///
- ///
- ///
- bool CreateWord(PluginsConventionSaveDocument saveDocument);
-
- ///
- /// Создание простого документа
- ///
- ///
- ///
- bool CreateExcel(PluginsConventionSaveDocument saveDocument);
-
- ///
- /// Создание документа с диаграммой
- ///
- ///
- ///
- bool CreatePdf(PluginsConventionSaveDocument saveDocument);
- }
-}
diff --git a/PluginsConventionLibrary/Plugins/PluginsConventionElement.cs b/PluginsConventionLibrary/Plugins/PluginsConventionElement.cs
deleted file mode 100644
index 1dea201..0000000
--- a/PluginsConventionLibrary/Plugins/PluginsConventionElement.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace PluginsConventionLibrary.Plugins
-{
- public class PluginsConventionElement
- {
- public int Id { get; set; }
- }
-}
diff --git a/PluginsConventionLibrary/Plugins/PluginsConventionSaveDocument.cs b/PluginsConventionLibrary/Plugins/PluginsConventionSaveDocument.cs
deleted file mode 100644
index 614962e..0000000
--- a/PluginsConventionLibrary/Plugins/PluginsConventionSaveDocument.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace PluginsConventionLibrary.Plugins
-{
- public class PluginsConventionSaveDocument
- {
- public string FileName { get; set; }
- }
-}
diff --git a/PluginsConventionLibrary/PluginsConventionLibrary.csproj b/PluginsConventionLibrary/PluginsConventionLibrary.csproj
deleted file mode 100644
index 5fe0d97..0000000
--- a/PluginsConventionLibrary/PluginsConventionLibrary.csproj
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
- net8.0
- enable
- enable
-
-
-
-
-
-
-
-
-
-
-
-
-
- Form
-
-
- Form
-
-
- Form
-
-
-
-