diff --git a/KopLab1/Lab3Form/FormMain.Designer.cs b/KopLab1/InternetShopOrdersAppPlugins/FormMain.Designer.cs similarity index 61% rename from KopLab1/Lab3Form/FormMain.Designer.cs rename to KopLab1/InternetShopOrdersAppPlugins/FormMain.Designer.cs index 3973da6..2c7bcb4 100644 --- a/KopLab1/Lab3Form/FormMain.Designer.cs +++ b/KopLab1/InternetShopOrdersAppPlugins/FormMain.Designer.cs @@ -1,4 +1,7 @@ -namespace Lab3Form +using static System.Net.Mime.MediaTypeNames; +using System.Windows.Forms; + +namespace InternetShopOrdersAppPlugins { partial class FormMain { @@ -28,9 +31,10 @@ /// private void InitializeComponent() { - this.panelControl = new System.Windows.Forms.Panel(); + this.menuStrip = new System.Windows.Forms.MenuStrip(); this.ControlsStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.ActionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.ThesaurusToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.AddElementToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.UpdElementToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.DelElementToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -38,60 +42,72 @@ this.SimpleDocToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.TableDocToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.ChartDocToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.menuStrip = new System.Windows.Forms.MenuStrip(); + this.panelControl = new System.Windows.Forms.Panel(); this.menuStrip.SuspendLayout(); this.SuspendLayout(); // - // panelControl + // menuStrip // - this.panelControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.panelControl.BackColor = System.Drawing.SystemColors.Info; - this.panelControl.Location = new System.Drawing.Point(12, 27); - this.panelControl.Name = "panelControl"; - this.panelControl.Size = new System.Drawing.Size(896, 177); - this.panelControl.TabIndex = 2; + this.menuStrip.ImageScalingSize = new System.Drawing.Size(20, 20); + this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.ControlsStripMenuItem, + this.ActionsToolStripMenuItem, + this.DocsToolStripMenuItem}); + this.menuStrip.Location = new System.Drawing.Point(0, 0); + this.menuStrip.Name = "menuStrip"; + this.menuStrip.Padding = new System.Windows.Forms.Padding(7, 3, 0, 3); + this.menuStrip.Size = new System.Drawing.Size(914, 30); + this.menuStrip.TabIndex = 0; + this.menuStrip.Text = "Меню"; // // ControlsStripMenuItem // this.ControlsStripMenuItem.Name = "ControlsStripMenuItem"; - this.ControlsStripMenuItem.Size = new System.Drawing.Size(94, 20); - this.ControlsStripMenuItem.Text = "Directories"; + this.ControlsStripMenuItem.Size = new System.Drawing.Size(113, 24); + this.ControlsStripMenuItem.Text = "Компоненты"; // // ActionsToolStripMenuItem // this.ActionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.ThesaurusToolStripMenuItem, this.AddElementToolStripMenuItem, this.UpdElementToolStripMenuItem, this.DelElementToolStripMenuItem}); this.ActionsToolStripMenuItem.Name = "ActionsToolStripMenuItem"; - this.ActionsToolStripMenuItem.Size = new System.Drawing.Size(70, 20); - this.ActionsToolStripMenuItem.Text = "Actions"; + this.ActionsToolStripMenuItem.Size = new System.Drawing.Size(88, 24); + this.ActionsToolStripMenuItem.Text = "Действия"; + // + // ThesaurusToolStripMenuItem + // + this.ThesaurusToolStripMenuItem.Name = "ThesaurusToolStripMenuItem"; + this.ThesaurusToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.I))); + this.ThesaurusToolStripMenuItem.Size = new System.Drawing.Size(223, 26); + this.ThesaurusToolStripMenuItem.Text = "Справочник"; + this.ThesaurusToolStripMenuItem.Click += ThesaurusToolStripMenuItem_Click; // // AddElementToolStripMenuItem // this.AddElementToolStripMenuItem.Name = "AddElementToolStripMenuItem"; this.AddElementToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.A))); - this.AddElementToolStripMenuItem.Size = new System.Drawing.Size(170, 22); - this.AddElementToolStripMenuItem.Text = "Add"; - this.AddElementToolStripMenuItem.Click += new System.EventHandler(this.AddElementToolStripMenuItem_Click); + this.AddElementToolStripMenuItem.Size = new System.Drawing.Size(223, 26); + this.AddElementToolStripMenuItem.Text = "Добавить"; + this.AddElementToolStripMenuItem.Click += AddElementToolStripMenuItem_Click; // // UpdElementToolStripMenuItem // this.UpdElementToolStripMenuItem.Name = "UpdElementToolStripMenuItem"; this.UpdElementToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.U))); - this.UpdElementToolStripMenuItem.Size = new System.Drawing.Size(170, 22); - this.UpdElementToolStripMenuItem.Text = "Edit"; - this.UpdElementToolStripMenuItem.Click += new System.EventHandler(this.UpdElementToolStripMenuItem_Click); + this.UpdElementToolStripMenuItem.Size = new System.Drawing.Size(223, 26); + this.UpdElementToolStripMenuItem.Text = "Изменить"; + this.UpdElementToolStripMenuItem.Click += UpdElementToolStripMenuItem_Click; // // DelElementToolStripMenuItem // this.DelElementToolStripMenuItem.Name = "DelElementToolStripMenuItem"; this.DelElementToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.D))); - this.DelElementToolStripMenuItem.Size = new System.Drawing.Size(170, 22); - this.DelElementToolStripMenuItem.Text = "Delete"; - this.DelElementToolStripMenuItem.Click += new System.EventHandler(this.DelElementToolStripMenuItem_Click); + this.DelElementToolStripMenuItem.Size = new System.Drawing.Size(223, 26); + this.DelElementToolStripMenuItem.Text = "Удалить"; + this.DelElementToolStripMenuItem.Click += DelElementToolStripMenuItem_Click; // // DocsToolStripMenuItem // @@ -100,75 +116,76 @@ this.TableDocToolStripMenuItem, this.ChartDocToolStripMenuItem}); this.DocsToolStripMenuItem.Name = "DocsToolStripMenuItem"; - this.DocsToolStripMenuItem.Size = new System.Drawing.Size(82, 20); - this.DocsToolStripMenuItem.Text = "Documnets"; + this.DocsToolStripMenuItem.Size = new System.Drawing.Size(101, 24); + this.DocsToolStripMenuItem.Text = "Документы"; // // SimpleDocToolStripMenuItem // this.SimpleDocToolStripMenuItem.Name = "SimpleDocToolStripMenuItem"; this.SimpleDocToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S))); - this.SimpleDocToolStripMenuItem.Size = new System.Drawing.Size(233, 22); - this.SimpleDocToolStripMenuItem.Text = "Excel"; - this.SimpleDocToolStripMenuItem.Click += new System.EventHandler(this.WordDocToolStripMenuItem_Click); + this.SimpleDocToolStripMenuItem.Size = new System.Drawing.Size(313, 26); + this.SimpleDocToolStripMenuItem.Text = "Простой документ"; + this.SimpleDocToolStripMenuItem.Click += SimpleDocToolStripMenuItem_Click; // // TableDocToolStripMenuItem // this.TableDocToolStripMenuItem.Name = "TableDocToolStripMenuItem"; this.TableDocToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.T))); - this.TableDocToolStripMenuItem.Size = new System.Drawing.Size(233, 22); - this.TableDocToolStripMenuItem.Text = "Word"; - this.TableDocToolStripMenuItem.Click += new System.EventHandler(this.PdfDocToolStripMenuItem_Click); + this.TableDocToolStripMenuItem.Size = new System.Drawing.Size(313, 26); + this.TableDocToolStripMenuItem.Text = "Документ с таблицей"; + this.TableDocToolStripMenuItem.Click += TableDocToolStripMenuItem_Click; // // ChartDocToolStripMenuItem // this.ChartDocToolStripMenuItem.Name = "ChartDocToolStripMenuItem"; this.ChartDocToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C))); - this.ChartDocToolStripMenuItem.Size = new System.Drawing.Size(233, 22); - this.ChartDocToolStripMenuItem.Text = "Pdf"; - this.ChartDocToolStripMenuItem.Click += new System.EventHandler(this.ExcelDocToolStripMenuItem_Click); + this.ChartDocToolStripMenuItem.Size = new System.Drawing.Size(313, 26); + this.ChartDocToolStripMenuItem.Text = "Документ с диаграммой"; + this.ChartDocToolStripMenuItem.Click += ChartDocToolStripMenuItem_Click; // - // menuStrip + // panelControl // - this.menuStrip.AutoSize = false; - this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.ControlsStripMenuItem, - this.ActionsToolStripMenuItem, - this.DocsToolStripMenuItem}); - this.menuStrip.Location = new System.Drawing.Point(0, 0); - this.menuStrip.Name = "menuStrip"; - this.menuStrip.Size = new System.Drawing.Size(920, 24); - this.menuStrip.TabIndex = 0; - this.menuStrip.Text = "Menu"; + this.panelControl.Dock = System.Windows.Forms.DockStyle.Fill; + this.panelControl.Location = new System.Drawing.Point(0, 30); + this.panelControl.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.panelControl.Name = "panelControl"; + this.panelControl.Size = new System.Drawing.Size(914, 570); + this.panelControl.TabIndex = 1; // // FormMain // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(920, 216); + this.ClientSize = new System.Drawing.Size(914, 600); this.Controls.Add(this.panelControl); this.Controls.Add(this.menuStrip); this.MainMenuStrip = this.menuStrip; + this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.Name = "FormMain"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "Main Form"; - this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FormMain_KeyDown); + this.Text = "Главная форма"; + this.WindowState = System.Windows.Forms.FormWindowState.Maximized; + this.Load += new System.EventHandler(this.FormMain_Load); this.menuStrip.ResumeLayout(false); this.menuStrip.PerformLayout(); this.ResumeLayout(false); + this.PerformLayout(); } #endregion - private Panel panelControl; - private ToolStripMenuItem ControlsStripMenuItem; - private ToolStripMenuItem ActionsToolStripMenuItem; - private ToolStripMenuItem AddElementToolStripMenuItem; - private ToolStripMenuItem UpdElementToolStripMenuItem; - private ToolStripMenuItem DelElementToolStripMenuItem; - private ToolStripMenuItem DocsToolStripMenuItem; - private ToolStripMenuItem SimpleDocToolStripMenuItem; - private ToolStripMenuItem TableDocToolStripMenuItem; - private ToolStripMenuItem ChartDocToolStripMenuItem; - private MenuStrip menuStrip; + + private System.Windows.Forms.MenuStrip menuStrip; + private System.Windows.Forms.ToolStripMenuItem ControlsStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem DocsToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem SimpleDocToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem TableDocToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem ChartDocToolStripMenuItem; + private System.Windows.Forms.Panel panelControl; + private System.Windows.Forms.ToolStripMenuItem ActionsToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem ThesaurusToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem AddElementToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem UpdElementToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem DelElementToolStripMenuItem; } } \ No newline at end of file diff --git a/KopLab1/InternetShopOrdersAppPlugins/FormMain.cs b/KopLab1/InternetShopOrdersAppPlugins/FormMain.cs new file mode 100644 index 0000000..bfbd26a --- /dev/null +++ b/KopLab1/InternetShopOrdersAppPlugins/FormMain.cs @@ -0,0 +1,242 @@ +using PluginsConventionLibrary; +using PluginsConventionLibrary.Plugins; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace InternetShopOrdersAppPlugins +{ + public partial class FormMain : Form + { + private readonly Dictionary _plugins; + private string _selectedPlugin; + + public FormMain() + { + InitializeComponent(); + _plugins = new(); + LoadPlugins(); + _selectedPlugin = string.Empty; + } + + private void LoadPlugins() + { + List pluginsList = GetPlugins(); + + foreach (var plugin in pluginsList) + { + _plugins[plugin.PluginName] = plugin; + CreateMenuItem(plugin.PluginName); + } + } + + private List GetPlugins() + { + string currentDir = Environment.CurrentDirectory; + string pluginsDir = Directory.GetParent(currentDir).Parent.Parent.Parent.FullName + "\\Plugins"; + string[] dllFiles = Directory.GetFiles( + pluginsDir, + "*.dll", + SearchOption.AllDirectories + ); + List plugins = new(); + foreach (string dllFile in dllFiles) + { + try + { + Assembly assembly = Assembly.LoadFrom(dllFile); + Type[] types = assembly.GetTypes(); + foreach (Type type in types) + { + if (typeof(IPluginsConvention).IsAssignableFrom(type) && !type.IsInterface) + { + if (Activator.CreateInstance(type) is IPluginsConvention plugin) + { + plugins.Add(plugin); + } + } + } + } + catch (Exception ex) + { + MessageBox.Show( + 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 (string.IsNullOrEmpty(_selectedPlugin) || + !_plugins.ContainsKey(_selectedPlugin)) + { + return; + } + if (!e.Control) + { + return; + } + switch (e.KeyCode) + { + case Keys.I: + ShowThesaurus(); + break; + case Keys.A: + AddNewElement(); + break; + case Keys.U: + UpdateElement(); + break; + case Keys.D: + DeleteElement(); + break; + case Keys.S: + CreateSimpleDoc(); + break; + case Keys.T: + CreateTableDoc(); + break; + case Keys.C: + CreateChartDoc(); + break; + } + } + + private void ShowThesaurus() + { + _plugins[_selectedPlugin].GetThesaurus()?.Show(); + } + + 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 CreateSimpleDoc() + { + SaveFileDialog saveFileDialog = new() + { + Filter = "PDF Files|*.pdf" + }; + if (saveFileDialog.ShowDialog() == DialogResult.OK) + { + _plugins[_selectedPlugin].CreateSimpleDocument(new PluginsConventionSaveDocument() { FileName = saveFileDialog.FileName }); + + } + } + private void CreateTableDoc() + { + SaveFileDialog saveFileDialog = new() + { + Filter = "Excel Files|*.xlsx" + }; + if (saveFileDialog.ShowDialog() == DialogResult.OK) + { + _plugins[_selectedPlugin].CreateTableDocument(new PluginsConventionSaveDocument() { FileName = saveFileDialog.FileName }); + + } + } + private void CreateChartDoc() + { + SaveFileDialog saveFileDialog = new() + { + Filter = "Word Files|*.docx" + }; + if (saveFileDialog.ShowDialog() == DialogResult.OK) + { + _plugins[_selectedPlugin].CreateChartDocument(new PluginsConventionSaveDocument() { FileName = saveFileDialog.FileName }); + } + } + + private void ThesaurusToolStripMenuItem_Click(object sender, EventArgs e) => ShowThesaurus(); + 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 SimpleDocToolStripMenuItem_Click(object sender, EventArgs e) => CreateSimpleDoc(); + private void TableDocToolStripMenuItem_Click(object sender, EventArgs e) => CreateTableDoc(); + private void ChartDocToolStripMenuItem_Click(object sender, EventArgs e) => CreateChartDoc(); + + private void FormMain_Load(object sender, EventArgs e) + { + + } + } +} diff --git a/KopLab1/Lab3Form/FormMain.resx b/KopLab1/InternetShopOrdersAppPlugins/FormMain.resx similarity index 50% rename from KopLab1/Lab3Form/FormMain.resx rename to KopLab1/InternetShopOrdersAppPlugins/FormMain.resx index 31084d5..81a9e3d 100644 --- a/KopLab1/Lab3Form/FormMain.resx +++ b/KopLab1/InternetShopOrdersAppPlugins/FormMain.resx @@ -1,64 +1,4 @@ - - - + diff --git a/KopLab1/InternetShopOrdersAppPlugins/InternetShopOrdersAppPlugins.csproj b/KopLab1/InternetShopOrdersAppPlugins/InternetShopOrdersAppPlugins.csproj new file mode 100644 index 0000000..775c9c1 --- /dev/null +++ b/KopLab1/InternetShopOrdersAppPlugins/InternetShopOrdersAppPlugins.csproj @@ -0,0 +1,22 @@ + + + + WinExe + net8.0-windows + enable + true + enable + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + \ No newline at end of file diff --git a/KopLab1/InternetShopOrdersAppPlugins/Program.cs b/KopLab1/InternetShopOrdersAppPlugins/Program.cs new file mode 100644 index 0000000..3c38c7d --- /dev/null +++ b/KopLab1/InternetShopOrdersAppPlugins/Program.cs @@ -0,0 +1,17 @@ +namespace InternetShopOrdersAppPlugins +{ + 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 FormMain()); + } + } +} \ No newline at end of file diff --git a/KopLab1/KopLab1.sln b/KopLab1/KopLab1.sln index 44ff65d..15b7ad0 100644 --- a/KopLab1/KopLab1.sln +++ b/KopLab1/KopLab1.sln @@ -13,7 +13,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InternetShopOrdersBusinessL EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lab3Form", "Lab3Form\Lab3Form.csproj", "{3329D6FC-A78D-46A7-9EA3-C0ECD21143CB}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PluginsConventionLibrary", "PluginsConventionLibrary\PluginsConventionLibrary.csproj", "{B8173741-064A-41C8-83C1-1E2A5B91B0D3}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PluginsConventionLibrary", "PluginsConventionLibrary\PluginsConventionLibrary.csproj", "{B8173741-064A-41C8-83C1-1E2A5B91B0D3}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InternetShopOrdersAppPlugins", "InternetShopOrdersAppPlugins\InternetShopOrdersAppPlugins.csproj", "{31FB221A-F7F3-4F2D-99C8-2C50B97B2EF2}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -45,6 +47,10 @@ Global {B8173741-064A-41C8-83C1-1E2A5B91B0D3}.Debug|Any CPU.Build.0 = Debug|Any CPU {B8173741-064A-41C8-83C1-1E2A5B91B0D3}.Release|Any CPU.ActiveCfg = Release|Any CPU {B8173741-064A-41C8-83C1-1E2A5B91B0D3}.Release|Any CPU.Build.0 = Release|Any CPU + {31FB221A-F7F3-4F2D-99C8-2C50B97B2EF2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {31FB221A-F7F3-4F2D-99C8-2C50B97B2EF2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {31FB221A-F7F3-4F2D-99C8-2C50B97B2EF2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {31FB221A-F7F3-4F2D-99C8-2C50B97B2EF2}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/KopLab1/Lab3Form/FormMain.cs b/KopLab1/Lab3Form/FormMain.cs deleted file mode 100644 index ec81ce8..0000000 --- a/KopLab1/Lab3Form/FormMain.cs +++ /dev/null @@ -1,156 +0,0 @@ -using PluginsConventionLibrary.Plugins; -using System.Windows.Forms; - -namespace Lab3Form -{ - public partial class FormMain : Form - { - private readonly Dictionary _plugins; - private string _selectedPlugin; - - 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() - { - 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 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() - { - if (_plugins[_selectedPlugin].GetElement == null) return; - using var dialog = new SaveFileDialog { Filter = "docx|*.docx" }; - if (dialog.ShowDialog() != DialogResult.OK) return; - if (!_plugins[_selectedPlugin].CreateSimpleDocument(new PluginsConventionSaveDocument { FileName = dialog.FileName })) - { - MessageBox.Show("Error", "!", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - - private void CreatePdf() - { - using var dialog = new SaveFileDialog { Filter = "pdf|*.pdf" }; - if (dialog.ShowDialog() != DialogResult.OK) return; - if (!_plugins[_selectedPlugin].CreateChartDocument(new PluginsConventionSaveDocument { FileName = dialog.FileName })) - { - MessageBox.Show("Error", "!", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - - private void CreateExcel() - { - using var dialog = new SaveFileDialog { Filter = "xlsx|*.xlsx" }; - if (dialog.ShowDialog() != DialogResult.OK) return; - if (!_plugins[_selectedPlugin].CreateTableDocument(new PluginsConventionSaveDocument { FileName = dialog.FileName })) - { - MessageBox.Show("Error", "!", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - - 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 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) => CreateExcel(); - private void PdfDocToolStripMenuItem_Click(object sender, EventArgs e) => CreateWord(); - private void ExcelDocToolStripMenuItem_Click(object sender, EventArgs e) => CreatePdf(); - } -} \ No newline at end of file diff --git a/KopLab1/Lab3Form/Lab3Form.csproj b/KopLab1/Lab3Form/Lab3Form.csproj index 3bc16c1..cf6bb7e 100644 --- a/KopLab1/Lab3Form/Lab3Form.csproj +++ b/KopLab1/Lab3Form/Lab3Form.csproj @@ -17,6 +17,8 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive + + @@ -28,4 +30,12 @@ + + + + + + + + \ No newline at end of file diff --git a/KopLab1/Lab3Form/PluginsConvention.cs b/KopLab1/Lab3Form/PluginsConvention.cs new file mode 100644 index 0000000..8969af5 --- /dev/null +++ b/KopLab1/Lab3Form/PluginsConvention.cs @@ -0,0 +1,288 @@ +using ControlsLibraryNet60.Data; +using FormLibrary.HelperClasses; +using FormLibrary; +using InternetShopOrdersBusinessLogic.BusinessLogics; +using InternetShopOrdersContracts.BusinessLogicContracts; +using InternetShopOrdersContracts.ViewModels; +using InternetShopOrdersDatabaseImplement.Implements; +using PluginsConventionLibrary.Plugins; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using WinFormsLibraryVolkov.NonVisualComponents; +using ComponentsLibraryNet60.DocumentWithChart; +using ComponentsLibraryNet60.Models; +using ControlsLibraryNet60.Models; +using DocumentFormat.OpenXml.Drawing.Charts; + +namespace Lab3Form +{ + public class PluginsConvention : IPluginsConvention + { + private readonly IOrderLogic _orderLogic; + private readonly ICityLogic _selecteditemLogic; + private readonly ControlDataTableTable _controlDataTableTable; + private readonly ExcelTableComponent _excelComponent; + private readonly ComponentHistogramToPdf _componentHistogramToPdf; + + public string PluginName { get; set; } = "Plugin"; + + public UserControl GetControl + { + get { return _controlDataTableTable; } + } + + public PluginsConvention() + { + _orderLogic = new OrderLogic(new OrderStorage()); + _selecteditemLogic = new CityLogic(new CityStorage()); + _controlDataTableTable = new(); + _excelComponent = new(); + _componentHistogramToPdf = new(); + } + + public PluginsConventionElement GetElement + { + get + { + int Id = _controlDataTableTable.GetSelectedObject()!.Id; + byte[] bytes = new byte[16]; + BitConverter.GetBytes(Id).CopyTo(bytes, 0); + Guid guid = new Guid(bytes); + return new PluginsConventionElement() { Id = guid }; + } + } + + public Form GetForm(PluginsConventionElement element) + { + if (element == null) + { + return new FormOrder(_orderLogic, _selecteditemLogic); + } + else + { + FormOrder form = new FormOrder(_orderLogic, _selecteditemLogic); + form.Id = element.Id.GetHashCode(); + return form; + } + } + + public Form GetThesaurus() + { + return new FormCities(_selecteditemLogic); + } + + public bool DeleteElement(PluginsConventionElement element) + { + _orderLogic.Delete(new InternetShopOrdersContracts.BindingModels.OrderBindingModel { Id = element.Id.GetHashCode() }); + return true; + } + + public void ReloadData() + { + try + { + var orders = _orderLogic.ReadList(null); + if (_orderLogic != null) + { + _controlDataTableTable.Clear(); + + _controlDataTableTable.LoadColumns(new List + { + new DataTableColumnConfig { ColumnHeader = "Идентификатор", PropertyName = "Id", Visible = true, Width = 100 }, + new DataTableColumnConfig { ColumnHeader = "ФИО заказчика", PropertyName = "Fullname", Visible = true, Width = 200 }, + new DataTableColumnConfig { ColumnHeader = "Город назначения", PropertyName = "DestinationCityName", Visible = true, Width = 150 }, + new DataTableColumnConfig { ColumnHeader = "История передвижения", PropertyName = "OrderStatusHistory", Visible = true, Width = 250 }, + new DataTableColumnConfig { ColumnHeader = "Дата выдачи", PropertyName = "ExpectedDeliveryDate", Visible = true, Width = 125 }, + }); + _controlDataTableTable.AddTable(orders); + } + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + public bool CreateSimpleDocument(PluginsConventionSaveDocument saveDocument) + { + try + { + + var orders = _orderLogic.ReadList(null); + + + var orderTables = new List(); + + foreach (var order in orders) + { + + int rowCount = order.OrderStatusHistory.Count; + + + string[,] orderTable = new string[rowCount + 1, 4]; + + + orderTable[0, 0] = "Статус"; + orderTable[0, 1] = "Идентификатор заказа"; + orderTable[0, 2] = "Город назначения"; + orderTable[0, 3] = "Дата доставки"; + + + for (int i = 0; i < rowCount; i++) + { + orderTable[i + 1, 0] = order.OrderStatusHistory[i]; + orderTable[i + 1, 1] = order.Id.ToString(); + orderTable[i + 1, 2] = order.DestinationCityName; + orderTable[i + 1, 3] = order.ExpectedDeliveryDate.ToString("yyyy-MM-dd"); + } + + + orderTables.Add(orderTable); + } + + + var pdfData = new PdfDocumentData( + saveDocument.FileName, + "Отчет по заказам", + orderTables + ); + + var documentGenerator = new PDFTable(); + documentGenerator.GeneratePdf(pdfData); + + MessageBox.Show("PDF-документ успешно создан!", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information); + return true; + } + catch (Exception ex) + { + MessageBox.Show($"Произошла ошибка: {ex.Message}", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + return false; + } + + public bool CreateTableDocument(PluginsConventionSaveDocument saveDocument) + { + var orders = _orderLogic.ReadList(null); + if (orders == null || orders.Count == 0) + { + MessageBox.Show("Нет заказов для отчета.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; + } + + + var tableData = new List(); + foreach (var order in orders) + { + if (order != null) + { + tableData.Add(new OrderExcelViewModel( + order.Id, + order.Fullname, + order.DestinationCityName, + order.ExpectedDeliveryDate + )); + } + } + string path = saveDocument.FileName; + + + + List<(int, int)> merges = new List<(int, int)> + { + (0,1), + (2, 3) + }; + + List heights = Enumerable.Repeat(20, 4).ToList(); + + + List<(string, string)> headers = new List<(string, string)> + { + + ("","Данные"), + ("Id", "Идентификатор"), + ("Fullname", "ФИО заказчика"), + ("", "Заказ"), + ("DestinationCityName", "Город назначения"), + ("ExpectedDeliveryDate", "Дата получения заказа") + }; + + if (merges.Count == 0 || heights.Count == 0 || headers.Count == 0 || tableData.Count == 0) + { + MessageBox.Show("Недостаточно данных для создания отчета.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; + } + Console.WriteLine($"Merges Count: {merges.Count}"); + Console.WriteLine($"Heights Count: {heights.Count}"); + Console.WriteLine($"Headers Count: {headers.Count}"); + Console.WriteLine($"TableData Count: {tableData.Count}"); + if (_excelComponent.createWithTable(path, "Отчет по заказам", merges, heights, headers, tableData)) + { + MessageBox.Show("Отчет успешно создан!"); + } + else + { + MessageBox.Show("Ошибка при создании отчета.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + return true; + } + + public bool CreateChartDocument(PluginsConventionSaveDocument saveDocument) + { + var orders = _orderLogic.ReadList(null).Cast().ToList(); + + + var chartData = new Dictionary>(); + + foreach (var order in orders) + { + if (!chartData.ContainsKey(order.DestinationCityName)) + { + chartData[order.DestinationCityName] = new List<(DateTime Date, int Count)>(); + } + + + var existingData = chartData[order.DestinationCityName] + .FirstOrDefault(d => d.Date.Date == order.ExpectedDeliveryDate.Date); + + if (existingData.Date == default) + { + chartData[order.DestinationCityName].Add((order.ExpectedDeliveryDate.Date, 1)); + } + else + { + + int index = chartData[order.DestinationCityName].FindIndex(d => d.Date.Date == order.ExpectedDeliveryDate.Date); + var updatedValue = chartData[order.DestinationCityName][index]; + chartData[order.DestinationCityName][index] = (updatedValue.Date, updatedValue.Count + 1); + } + } + + string filePath = saveDocument.FileName; + + var config = new ComponentDocumentWithChartConfig + { + ChartTitle = "Отчет по заказам", + LegendLocation = ComponentsLibraryNet60.Models.Location.Bottom, + Data = chartData.ToDictionary( + entry => entry.Key, + entry => entry.Value.Select(d => ((d.Date.Day), (double)d.Count)).ToList()), + FilePath = filePath, + Header = "Заголовок отчета" + + }; + + + var documentComponent = new ComponentDocumentWithChartLineWord(); + + + documentComponent.CreateDoc(config); + + MessageBox.Show("Документ создан успешно!"); + return false; + } + } +} diff --git a/KopLab1/Lab3Form/PluginsManager.cs b/KopLab1/Lab3Form/PluginsManager.cs deleted file mode 100644 index cec9f83..0000000 --- a/KopLab1/Lab3Form/PluginsManager.cs +++ /dev/null @@ -1,47 +0,0 @@ -using PluginsConventionLibrary.Plugins; -using System; -using System.Collections.Generic; -using System.ComponentModel.Composition.Hosting; -using System.ComponentModel.Composition; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Lab3Form -{ - public class PluginsManager - { - [ImportMany(typeof(IPluginsConvention))] - IEnumerable Plugins { get; set; } - - public readonly Dictionary plugins_dictionary = new(); - - 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/KopLab1/Lab3Form/Program.cs b/KopLab1/Lab3Form/Program.cs index f9dad60..e522136 100644 --- a/KopLab1/Lab3Form/Program.cs +++ b/KopLab1/Lab3Form/Program.cs @@ -24,7 +24,7 @@ namespace Lab3Form var services = new ServiceCollection(); ConfigureServices(services); _serviceProvider = services.BuildServiceProvider(); - Application.Run(_serviceProvider.GetRequiredService()); + Application.Run(_serviceProvider.GetRequiredService()); } private static void ConfigureServices(ServiceCollection services) @@ -33,7 +33,7 @@ namespace Lab3Form services.AddTransient(); services.AddTransient(); services.AddTransient(); - services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); } diff --git a/KopLab1/Plugins/ComponentsLibraryNet60.dll b/KopLab1/Plugins/ComponentsLibraryNet60.dll new file mode 100644 index 0000000..9807306 Binary files /dev/null and b/KopLab1/Plugins/ComponentsLibraryNet60.dll differ diff --git a/KopLab1/Plugins/ControlsLibraryNet60.dll b/KopLab1/Plugins/ControlsLibraryNet60.dll new file mode 100644 index 0000000..3d14013 Binary files /dev/null and b/KopLab1/Plugins/ControlsLibraryNet60.dll differ diff --git a/KopLab1/Plugins/DocumentFormat.OpenXml.dll b/KopLab1/Plugins/DocumentFormat.OpenXml.dll new file mode 100644 index 0000000..846973a Binary files /dev/null and b/KopLab1/Plugins/DocumentFormat.OpenXml.dll differ diff --git a/KopLab1/Plugins/FormLibrary.dll b/KopLab1/Plugins/FormLibrary.dll new file mode 100644 index 0000000..3491629 Binary files /dev/null and b/KopLab1/Plugins/FormLibrary.dll differ diff --git a/KopLab1/Plugins/FormLibraryTikhonenkov.dll b/KopLab1/Plugins/FormLibraryTikhonenkov.dll new file mode 100644 index 0000000..354eb11 Binary files /dev/null and b/KopLab1/Plugins/FormLibraryTikhonenkov.dll differ diff --git a/KopLab1/Plugins/Humanizer.dll b/KopLab1/Plugins/Humanizer.dll new file mode 100644 index 0000000..c9a7ef8 Binary files /dev/null and b/KopLab1/Plugins/Humanizer.dll differ diff --git a/KopLab1/Plugins/InternetShopOrdersBusinessLogic.dll b/KopLab1/Plugins/InternetShopOrdersBusinessLogic.dll new file mode 100644 index 0000000..6dd832e Binary files /dev/null and b/KopLab1/Plugins/InternetShopOrdersBusinessLogic.dll differ diff --git a/KopLab1/Plugins/InternetShopOrdersContracts.dll b/KopLab1/Plugins/InternetShopOrdersContracts.dll new file mode 100644 index 0000000..ff93921 Binary files /dev/null and b/KopLab1/Plugins/InternetShopOrdersContracts.dll differ diff --git a/KopLab1/Plugins/InternetShopOrdersDataModels.dll b/KopLab1/Plugins/InternetShopOrdersDataModels.dll new file mode 100644 index 0000000..1366b3b Binary files /dev/null and b/KopLab1/Plugins/InternetShopOrdersDataModels.dll differ diff --git a/KopLab1/Plugins/InternetShopOrdersDatabaseImplement.dll b/KopLab1/Plugins/InternetShopOrdersDatabaseImplement.dll new file mode 100644 index 0000000..f36f733 Binary files /dev/null and b/KopLab1/Plugins/InternetShopOrdersDatabaseImplement.dll differ diff --git a/KopLab1/Plugins/Lab3Form.dll b/KopLab1/Plugins/Lab3Form.dll new file mode 100644 index 0000000..b91e0f2 Binary files /dev/null and b/KopLab1/Plugins/Lab3Form.dll differ diff --git a/KopLab1/Plugins/Microsoft.Bcl.AsyncInterfaces.dll b/KopLab1/Plugins/Microsoft.Bcl.AsyncInterfaces.dll new file mode 100644 index 0000000..fe6ba4c Binary files /dev/null and b/KopLab1/Plugins/Microsoft.Bcl.AsyncInterfaces.dll differ diff --git a/KopLab1/Plugins/Microsoft.CodeAnalysis.CSharp.Workspaces.dll b/KopLab1/Plugins/Microsoft.CodeAnalysis.CSharp.Workspaces.dll new file mode 100644 index 0000000..dc218f9 Binary files /dev/null and b/KopLab1/Plugins/Microsoft.CodeAnalysis.CSharp.Workspaces.dll differ diff --git a/KopLab1/Plugins/Microsoft.CodeAnalysis.CSharp.dll b/KopLab1/Plugins/Microsoft.CodeAnalysis.CSharp.dll new file mode 100644 index 0000000..412e7ed Binary files /dev/null and b/KopLab1/Plugins/Microsoft.CodeAnalysis.CSharp.dll differ diff --git a/KopLab1/Plugins/Microsoft.CodeAnalysis.Workspaces.dll b/KopLab1/Plugins/Microsoft.CodeAnalysis.Workspaces.dll new file mode 100644 index 0000000..8dec441 Binary files /dev/null and b/KopLab1/Plugins/Microsoft.CodeAnalysis.Workspaces.dll differ diff --git a/KopLab1/Plugins/Microsoft.CodeAnalysis.dll b/KopLab1/Plugins/Microsoft.CodeAnalysis.dll new file mode 100644 index 0000000..79e9046 Binary files /dev/null and b/KopLab1/Plugins/Microsoft.CodeAnalysis.dll differ diff --git a/KopLab1/Plugins/Microsoft.EntityFrameworkCore.Abstractions.dll b/KopLab1/Plugins/Microsoft.EntityFrameworkCore.Abstractions.dll new file mode 100644 index 0000000..2169cf8 Binary files /dev/null and b/KopLab1/Plugins/Microsoft.EntityFrameworkCore.Abstractions.dll differ diff --git a/KopLab1/Plugins/Microsoft.EntityFrameworkCore.Design.dll b/KopLab1/Plugins/Microsoft.EntityFrameworkCore.Design.dll new file mode 100644 index 0000000..7ba3d94 Binary files /dev/null and b/KopLab1/Plugins/Microsoft.EntityFrameworkCore.Design.dll differ diff --git a/KopLab1/Plugins/Microsoft.EntityFrameworkCore.Relational.dll b/KopLab1/Plugins/Microsoft.EntityFrameworkCore.Relational.dll new file mode 100644 index 0000000..f8c58d0 Binary files /dev/null and b/KopLab1/Plugins/Microsoft.EntityFrameworkCore.Relational.dll differ diff --git a/KopLab1/Plugins/Microsoft.EntityFrameworkCore.dll b/KopLab1/Plugins/Microsoft.EntityFrameworkCore.dll new file mode 100644 index 0000000..b628ed6 Binary files /dev/null and b/KopLab1/Plugins/Microsoft.EntityFrameworkCore.dll differ diff --git a/KopLab1/Plugins/Microsoft.Extensions.Caching.Abstractions.dll b/KopLab1/Plugins/Microsoft.Extensions.Caching.Abstractions.dll new file mode 100644 index 0000000..99aac98 Binary files /dev/null and b/KopLab1/Plugins/Microsoft.Extensions.Caching.Abstractions.dll differ diff --git a/KopLab1/Plugins/Microsoft.Extensions.Caching.Memory.dll b/KopLab1/Plugins/Microsoft.Extensions.Caching.Memory.dll new file mode 100644 index 0000000..077b1b6 Binary files /dev/null and b/KopLab1/Plugins/Microsoft.Extensions.Caching.Memory.dll differ diff --git a/KopLab1/Plugins/Microsoft.Extensions.Configuration.Abstractions.dll b/KopLab1/Plugins/Microsoft.Extensions.Configuration.Abstractions.dll new file mode 100644 index 0000000..a5ab313 Binary files /dev/null and b/KopLab1/Plugins/Microsoft.Extensions.Configuration.Abstractions.dll differ diff --git a/KopLab1/Plugins/Microsoft.Extensions.DependencyInjection.Abstractions.dll b/KopLab1/Plugins/Microsoft.Extensions.DependencyInjection.Abstractions.dll new file mode 100644 index 0000000..81ed3de Binary files /dev/null and b/KopLab1/Plugins/Microsoft.Extensions.DependencyInjection.Abstractions.dll differ diff --git a/KopLab1/Plugins/Microsoft.Extensions.DependencyInjection.dll b/KopLab1/Plugins/Microsoft.Extensions.DependencyInjection.dll new file mode 100644 index 0000000..bd71a2b Binary files /dev/null and b/KopLab1/Plugins/Microsoft.Extensions.DependencyInjection.dll differ diff --git a/KopLab1/Plugins/Microsoft.Extensions.DependencyModel.dll b/KopLab1/Plugins/Microsoft.Extensions.DependencyModel.dll new file mode 100644 index 0000000..8905537 Binary files /dev/null and b/KopLab1/Plugins/Microsoft.Extensions.DependencyModel.dll differ diff --git a/KopLab1/Plugins/Microsoft.Extensions.Logging.Abstractions.dll b/KopLab1/Plugins/Microsoft.Extensions.Logging.Abstractions.dll new file mode 100644 index 0000000..f9d1dc6 Binary files /dev/null and b/KopLab1/Plugins/Microsoft.Extensions.Logging.Abstractions.dll differ diff --git a/KopLab1/Plugins/Microsoft.Extensions.Logging.dll b/KopLab1/Plugins/Microsoft.Extensions.Logging.dll new file mode 100644 index 0000000..35905b6 Binary files /dev/null and b/KopLab1/Plugins/Microsoft.Extensions.Logging.dll differ diff --git a/KopLab1/Plugins/Microsoft.Extensions.Options.dll b/KopLab1/Plugins/Microsoft.Extensions.Options.dll new file mode 100644 index 0000000..a7b3f21 Binary files /dev/null and b/KopLab1/Plugins/Microsoft.Extensions.Options.dll differ diff --git a/KopLab1/Plugins/Microsoft.Extensions.Primitives.dll b/KopLab1/Plugins/Microsoft.Extensions.Primitives.dll new file mode 100644 index 0000000..c24f2a0 Binary files /dev/null and b/KopLab1/Plugins/Microsoft.Extensions.Primitives.dll differ diff --git a/KopLab1/Plugins/MigraDoc.DocumentObjectModel.dll b/KopLab1/Plugins/MigraDoc.DocumentObjectModel.dll new file mode 100644 index 0000000..2bf457c Binary files /dev/null and b/KopLab1/Plugins/MigraDoc.DocumentObjectModel.dll differ diff --git a/KopLab1/Plugins/MigraDoc.Rendering.dll b/KopLab1/Plugins/MigraDoc.Rendering.dll new file mode 100644 index 0000000..9c14fbe Binary files /dev/null and b/KopLab1/Plugins/MigraDoc.Rendering.dll differ diff --git a/KopLab1/Plugins/Mono.TextTemplating.dll b/KopLab1/Plugins/Mono.TextTemplating.dll new file mode 100644 index 0000000..d5a4b3c Binary files /dev/null and b/KopLab1/Plugins/Mono.TextTemplating.dll differ diff --git a/KopLab1/Plugins/NevaevaLibrary.dll b/KopLab1/Plugins/NevaevaLibrary.dll new file mode 100644 index 0000000..10eaf9c Binary files /dev/null and b/KopLab1/Plugins/NevaevaLibrary.dll differ diff --git a/KopLab1/Plugins/Npgsql.EntityFrameworkCore.PostgreSQL.dll b/KopLab1/Plugins/Npgsql.EntityFrameworkCore.PostgreSQL.dll new file mode 100644 index 0000000..042c1f0 Binary files /dev/null and b/KopLab1/Plugins/Npgsql.EntityFrameworkCore.PostgreSQL.dll differ diff --git a/KopLab1/Plugins/Npgsql.dll b/KopLab1/Plugins/Npgsql.dll new file mode 100644 index 0000000..c0eb4d9 Binary files /dev/null and b/KopLab1/Plugins/Npgsql.dll differ diff --git a/KopLab1/Plugins/OxyPlot.WindowsForms.dll b/KopLab1/Plugins/OxyPlot.WindowsForms.dll new file mode 100644 index 0000000..103acdd Binary files /dev/null and b/KopLab1/Plugins/OxyPlot.WindowsForms.dll differ diff --git a/KopLab1/Plugins/OxyPlot.Wpf.Shared.dll b/KopLab1/Plugins/OxyPlot.Wpf.Shared.dll new file mode 100644 index 0000000..f6012cd Binary files /dev/null and b/KopLab1/Plugins/OxyPlot.Wpf.Shared.dll differ diff --git a/KopLab1/Plugins/OxyPlot.Wpf.dll b/KopLab1/Plugins/OxyPlot.Wpf.dll new file mode 100644 index 0000000..7905954 Binary files /dev/null and b/KopLab1/Plugins/OxyPlot.Wpf.dll differ diff --git a/KopLab1/Plugins/OxyPlot.dll b/KopLab1/Plugins/OxyPlot.dll new file mode 100644 index 0000000..c652fdb Binary files /dev/null and b/KopLab1/Plugins/OxyPlot.dll differ diff --git a/KopLab1/Plugins/PdfSharp.Charting.dll b/KopLab1/Plugins/PdfSharp.Charting.dll new file mode 100644 index 0000000..384a0f0 Binary files /dev/null and b/KopLab1/Plugins/PdfSharp.Charting.dll differ diff --git a/KopLab1/Plugins/PdfSharp.dll b/KopLab1/Plugins/PdfSharp.dll new file mode 100644 index 0000000..aa564e1 Binary files /dev/null and b/KopLab1/Plugins/PdfSharp.dll differ diff --git a/KopLab1/Plugins/PluginsConventionLibrary.dll b/KopLab1/Plugins/PluginsConventionLibrary.dll new file mode 100644 index 0000000..73e9997 Binary files /dev/null and b/KopLab1/Plugins/PluginsConventionLibrary.dll differ diff --git a/KopLab1/Plugins/System.ComponentModel.Composition.dll b/KopLab1/Plugins/System.ComponentModel.Composition.dll new file mode 100644 index 0000000..97c0fc0 Binary files /dev/null and b/KopLab1/Plugins/System.ComponentModel.Composition.dll differ diff --git a/KopLab1/Plugins/System.Composition.AttributedModel.dll b/KopLab1/Plugins/System.Composition.AttributedModel.dll new file mode 100644 index 0000000..d37283b Binary files /dev/null and b/KopLab1/Plugins/System.Composition.AttributedModel.dll differ diff --git a/KopLab1/Plugins/System.Composition.Convention.dll b/KopLab1/Plugins/System.Composition.Convention.dll new file mode 100644 index 0000000..b6fa4ab Binary files /dev/null and b/KopLab1/Plugins/System.Composition.Convention.dll differ diff --git a/KopLab1/Plugins/System.Composition.Hosting.dll b/KopLab1/Plugins/System.Composition.Hosting.dll new file mode 100644 index 0000000..c67f1c0 Binary files /dev/null and b/KopLab1/Plugins/System.Composition.Hosting.dll differ diff --git a/KopLab1/Plugins/System.Composition.Runtime.dll b/KopLab1/Plugins/System.Composition.Runtime.dll new file mode 100644 index 0000000..2a4b38c Binary files /dev/null and b/KopLab1/Plugins/System.Composition.Runtime.dll differ diff --git a/KopLab1/Plugins/System.Composition.TypedParts.dll b/KopLab1/Plugins/System.Composition.TypedParts.dll new file mode 100644 index 0000000..7c0c780 Binary files /dev/null and b/KopLab1/Plugins/System.Composition.TypedParts.dll differ diff --git a/KopLab1/Plugins/System.IO.Pipelines.dll b/KopLab1/Plugins/System.IO.Pipelines.dll new file mode 100644 index 0000000..8ee4dfd Binary files /dev/null and b/KopLab1/Plugins/System.IO.Pipelines.dll differ diff --git a/KopLab1/Plugins/WinFormsLibraryVolkov.dll b/KopLab1/Plugins/WinFormsLibraryVolkov.dll new file mode 100644 index 0000000..5246f3a Binary files /dev/null and b/KopLab1/Plugins/WinFormsLibraryVolkov.dll differ diff --git a/KopLab1/PluginsConventionLibrary/MainPluginConventionElement.cs b/KopLab1/PluginsConventionLibrary/MainPluginConventionElement.cs new file mode 100644 index 0000000..ac57cb5 --- /dev/null +++ b/KopLab1/PluginsConventionLibrary/MainPluginConventionElement.cs @@ -0,0 +1,20 @@ +using PluginsConventionLibrary.Plugins; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace PluginsConventionLibrary +{ + public class MainPluginConventionElement : PluginsConventionElement + { + public string ProductCategoryName { get; set; } + + public string PhotoFilePath { get; set; } + + public string FIO { get; set; } + + public string Email { get; set; } + } +} diff --git a/KopLab1/PluginsConventionLibrary/Plugins/IPluginsConvention.cs b/KopLab1/PluginsConventionLibrary/Plugins/IPluginsConvention.cs index 4809182..cefc8c1 100644 --- a/KopLab1/PluginsConventionLibrary/Plugins/IPluginsConvention.cs +++ b/KopLab1/PluginsConventionLibrary/Plugins/IPluginsConvention.cs @@ -9,59 +9,57 @@ namespace PluginsConventionLibrary.Plugins { public interface IPluginsConvention { - /// - /// Название плагина - /// + /// + /// Название плагина + /// string PluginName { get; } - - /// - /// Получение контрола для вывода набора данных - /// + /// + /// Получение контрола для вывода набора данных + /// UserControl GetControl { get; } - - /// - /// Получение элемента, выбранного в контроле - /// + /// + /// Получение элемента, выбранного в контроле + /// PluginsConventionElement GetElement { get; } - - /// - /// Получение формы для создания/редактирования объекта - /// - /// - /// + /// + /// Получение формы для создания/редактирования объекта + /// + /// + /// Form GetForm(PluginsConventionElement element); - - /// - /// Удаление элемента - /// - /// - /// + /// + /// Получение формы для работы со справочником + /// + /// + Form GetThesaurus(); + /// + /// Удаление элемента + /// + /// + /// bool DeleteElement(PluginsConventionElement element); - - /// - /// Обновление набора данных в контроле - /// + /// + /// Обновление набора данных в контроле + /// void ReloadData(); - - /// - /// Создание простого документа - /// - /// - /// - bool CreateSimpleDocument(PluginsConventionSaveDocument saveDocument); - - /// - /// Создание простого документа - /// - /// - /// + /// + /// Создание простого документа + /// + /// + /// + bool CreateSimpleDocument(PluginsConventionSaveDocument + saveDocument); + /// + /// Создание простого документа + /// + /// + /// bool CreateTableDocument(PluginsConventionSaveDocument saveDocument); - - /// - /// Создание документа с диаграммой - /// - /// - /// + /// + /// Создание документа с диаграммой + /// + /// + /// bool CreateChartDocument(PluginsConventionSaveDocument saveDocument); } } diff --git a/KopLab1/PluginsConventionLibrary/Plugins/PluginsConventionElement.cs b/KopLab1/PluginsConventionLibrary/Plugins/PluginsConventionElement.cs index 99f7ef9..9444eab 100644 --- a/KopLab1/PluginsConventionLibrary/Plugins/PluginsConventionElement.cs +++ b/KopLab1/PluginsConventionLibrary/Plugins/PluginsConventionElement.cs @@ -2,6 +2,6 @@ { public class PluginsConventionElement { - public int Id { get; set; } + public Guid Id { get; set; } } }