Вроде сделал

This commit is contained in:
Артём Алейкин 2023-12-14 01:22:20 +04:00
parent 0261fdc093
commit 34d262287b
80 changed files with 866 additions and 0 deletions

View File

@ -21,7 +21,16 @@
<ItemGroup>
<ProjectReference Include="..\DateBaseImplement\DateBaseImplement.csproj" />
<ProjectReference Include="..\PluginsConventionLibrary\PluginsConventionLibrary.csproj" />
<ProjectReference Include="..\WinFormsLibrary\WinFormsLibraryAA.csproj" />
</ItemGroup>
<Target Name="CreatePluginsFolder" BeforeTargets="PreBuildEvent" Condition="!Exists('$(SolutionDir)Plugins')">
<MakeDir Directories="$(SolutionDir)Plugins" />
</Target>
<Target Name="CopyPlugins" AfterTargets="PostBuildEvent">
<Exec Command="copy /Y &quot;$(TargetDir)*.dll&quot; &quot;$(SolutionDir)Plugins\*.dll&quot;" />
</Target>
</Project>

View File

@ -0,0 +1,220 @@
using Contracts.StorageContracts;
using Contracts.ViewModels;
using ControlsLibraryNet60.Data;
using ControlsLibraryNet60.Models;
using DateBaseImplement.Implements;
using PdfFormsLibrary;
using PluginsConventionLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using WinFormsLibrary;
using WinFormsLibrary.not_visual;
using WinFormsLibrary.SupportClasses;
namespace AppView
{
public class PluginsConvention : IPluginsConvention
{
private readonly IProviderStorage _providerStorage;
private readonly ITypeStorage _typeStorage;
private readonly DocumentWithImage documentWithImage1;
private readonly Table2column table2column1;
private readonly Gistograma gistograma1;
private readonly ControlDataTableTable DataTable = new ControlDataTableTable();
public string PluginName { get; set; } = "LabWork_03_plugin";
public UserControl GetControl
{
get
{
ReloadData();
return DataTable;
}
}
public PluginsConventionElement GetElement
{
get
{
var provider = DataTable.GetSelectedObject<ProviderViewModel>();
int id = -1;
if (provider != null)
{
id = Convert.ToInt32(provider.Id);
}
byte[] bytes = new byte[16];
BitConverter.GetBytes(id).CopyTo(bytes, 0);
return new()
{
Id = new Guid(bytes)
};
}
}
public PluginsConvention()
{
_providerStorage = new ProviderStorage();
_typeStorage = new TypeStorage();
documentWithImage1 = new();
table2column1 = new();
gistograma1 = new();
List<DataTableColumnConfig> columns = new List<DataTableColumnConfig>
{
new DataTableColumnConfig
{
ColumnHeader = "Id",
PropertyName = "Id",
Visible = false
},
new DataTableColumnConfig
{
ColumnHeader = "Название",
PropertyName = "Name",
Visible = true
},
new DataTableColumnConfig
{
ColumnHeader = "Тип изделий",
PropertyName = "Type",
Visible = true
},
new DataTableColumnConfig
{
ColumnHeader = "Телефон",
PropertyName = "Number",
Visible = true
}
};
DataTable.LoadColumns(columns);
}
public Form GetForm(PluginsConventionElement element)
{
if (element == null)
{
return new FormProvider(_providerStorage, _typeStorage);
}
else
{
FormProvider form = new FormProvider(_providerStorage, _typeStorage);
form.Id = element.Id.GetHashCode();
return form;
}
}
public Form GetThesaurus()
{
return new FormType(_typeStorage);
}
public bool DeleteElement(PluginsConventionElement element)
{
_providerStorage.Delete(
new(element.Id.GetHashCode())
);
return true;
}
public void ReloadData()
{
try
{
var list = _providerStorage.GetFullList();
DataTable.Clear();
DataTable.AddTable(list);
}
catch (Exception ex)
{
MessageBox.Show(
ex.Message,
"Ошибка",
MessageBoxButtons.OK,
MessageBoxIcon.Error
);
}
}
public bool CreateWordDocument(PluginsConventionSaveDocument saveDocument)
{
ImageClass info = new ImageClass();
var images = _providerStorage.GetFullList().Select(x => x.Logo).ToList();
info.Title = "Images";
info.Path = saveDocument.FileName;
info.Files = images;
documentWithImage1.CreateDocument(info);
return true;
}
public bool CreateTableDocument(PluginsConventionSaveDocument saveDocument)
{
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
List<ColumnDefinition> columnDefinitionsUp = new List<ColumnDefinition> {
new ColumnDefinition{Header = "#", PropertyName = "Id", Weight = 30},
new ColumnDefinition{Header = "Информация", PropertyName = "NumberType", Weight = 30},
new ColumnDefinition{Header = "", PropertyName = "NumberType", Weight = 30},
new ColumnDefinition{Header = "Номер телефона", PropertyName = "Number", Weight = 30},
};
List<ColumnDefinition> columnDefinitionsDown = new List<ColumnDefinition> {
new ColumnDefinition{Header = "#", PropertyName = "Id", Weight = 30},
new ColumnDefinition{Header = "Название", PropertyName = "Name", Weight = 30},
new ColumnDefinition{Header = "Тип изделия", PropertyName = "Type", Weight = 30},
new ColumnDefinition{Header = "-", PropertyName = "Number", Weight = 30},
};
var providers = _providerStorage.GetFullList();
List<int[]> mergedColums = new() { new int[] { 1, 2 } };
BigTable<ProviderViewModel> info = new(saveDocument.FileName, "Table", columnDefinitionsUp, columnDefinitionsDown, providers, mergedColums);
table2column1.CreateTable(info);
MessageBox.Show("Готово");
return true;
}
public bool CreateChartDocument(PluginsConventionSaveDocument saveDocument)
{
var providers = _providerStorage.GetFullList();
var uniqueTypes = providers.Select(p => p.Type).Distinct();
List<ChartData> data = new List<ChartData>();
foreach (var uniqueType in uniqueTypes)
{
var typeProviders = providers.Where(p => p.Type == uniqueType).ToList();
var dataList = new List<double>();
// Используем Count() для подсчета общего количества поставщиков каждого типа
int totalCount = typeProviders.Count();
ChartData chData = new ChartData();
chData.SeriesName = uniqueType;
chData.Data = new double[] { totalCount };
data.Add(chData);
}
gistograma1.GenerateExcelChartDocument(saveDocument.FileName, "Сводка по типам изделия.", "Количество поставщиков для товаров каждого типа", WinFormsLibrary.not_visual.LegendPosition.Bottom, data);
return true;
}
}
}

View File

@ -22,5 +22,10 @@ namespace Contracts.BindingModels
{
Id = provider.Id;
}
public ProviderBindingModel(int id)
{
Id = id;
}
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,23 @@
using ControlsLibraryNet60.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PluginsConventionLibrary
{
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 CreateWordDocument(PluginsConventionSaveDocument saveDocument);
bool CreateTableDocument(PluginsConventionSaveDocument saveDocument);
bool CreateChartDocument(PluginsConventionSaveDocument saveDocument);
}
}

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PluginsConventionLibrary
{
public class PluginsConventionElement
{
public Guid Id { get; set; }
}
}

View File

@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ControlsLibraryNet60" Version="1.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Contracts\Contracts.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PluginsConventionLibrary
{
public class PluginsConventionSaveDocument
{
public string FileName { get; set; }
}
}

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PluginsConventionLibraryNet60
{
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 CreateWordDocument(PluginsConventionSaveDocument saveDocument);
bool CreateTableDocument(PluginsConventionSaveDocument saveDocument);
bool CreateChartDocument(PluginsConventionSaveDocument saveDocument);
}
}

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PluginsConventionLibraryNet60
{
public class PluginsConventionElement
{
public Guid Id { get; set; }
}
}

View File

@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PluginsConventionLibraryNet60
{
public class PluginsConventionSaveDocument
{
public string FileName { get; set; }
}
}

View File

@ -0,0 +1,173 @@
namespace WinFormsAppByPlugins
{
partial class FormMain
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
menuStrip = new MenuStrip();
ControlsStripMenuItem = new ToolStripMenuItem();
ActionsToolStripMenuItem = new ToolStripMenuItem();
ThesaurusToolStripMenuItem = new ToolStripMenuItem();
AddElementToolStripMenuItem = new ToolStripMenuItem();
UpdElementToolStripMenuItem = new ToolStripMenuItem();
DelElementToolStripMenuItem = new ToolStripMenuItem();
DocsToolStripMenuItem = new ToolStripMenuItem();
SimpleDocToolStripMenuItem = new ToolStripMenuItem();
TableDocToolStripMenuItem = new ToolStripMenuItem();
ChartDocToolStripMenuItem = new ToolStripMenuItem();
panelControl = new Panel();
menuStrip.SuspendLayout();
SuspendLayout();
//
// menuStrip
//
menuStrip.Items.AddRange(new ToolStripItem[] { ControlsStripMenuItem, ActionsToolStripMenuItem, DocsToolStripMenuItem });
menuStrip.Location = new Point(0, 0);
menuStrip.Name = "menuStrip";
menuStrip.Size = new Size(800, 24);
menuStrip.TabIndex = 0;
menuStrip.Text = "Меню";
//
// ControlsStripMenuItem
//
ControlsStripMenuItem.Name = "ControlsStripMenuItem";
ControlsStripMenuItem.Size = new Size(90, 20);
ControlsStripMenuItem.Text = "Компоненты";
//
// ActionsToolStripMenuItem
//
ActionsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { ThesaurusToolStripMenuItem, AddElementToolStripMenuItem, UpdElementToolStripMenuItem, DelElementToolStripMenuItem });
ActionsToolStripMenuItem.Name = "ActionsToolStripMenuItem";
ActionsToolStripMenuItem.Size = new Size(70, 20);
ActionsToolStripMenuItem.Text = "Действия";
//
// ThesaurusToolStripMenuItem
//
ThesaurusToolStripMenuItem.Name = "ThesaurusToolStripMenuItem";
ThesaurusToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.I;
ThesaurusToolStripMenuItem.Size = new Size(180, 22);
ThesaurusToolStripMenuItem.Text = "Справочник";
ThesaurusToolStripMenuItem.Click += ThesaurusToolStripMenuItem_Click;
//
// AddElementToolStripMenuItem
//
AddElementToolStripMenuItem.Name = "AddElementToolStripMenuItem";
AddElementToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.A;
AddElementToolStripMenuItem.Size = new Size(180, 22);
AddElementToolStripMenuItem.Text = "Добавить";
AddElementToolStripMenuItem.Click += AddElementToolStripMenuItem_Click;
//
// UpdElementToolStripMenuItem
//
UpdElementToolStripMenuItem.Name = "UpdElementToolStripMenuItem";
UpdElementToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.U;
UpdElementToolStripMenuItem.Size = new Size(180, 22);
UpdElementToolStripMenuItem.Text = "Изменить";
UpdElementToolStripMenuItem.Click += UpdElementToolStripMenuItem_Click;
//
// DelElementToolStripMenuItem
//
DelElementToolStripMenuItem.Name = "DelElementToolStripMenuItem";
DelElementToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.D;
DelElementToolStripMenuItem.Size = new Size(180, 22);
DelElementToolStripMenuItem.Text = "Удалить";
DelElementToolStripMenuItem.Click += DelElementToolStripMenuItem_Click;
//
// DocsToolStripMenuItem
//
DocsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { SimpleDocToolStripMenuItem, TableDocToolStripMenuItem, ChartDocToolStripMenuItem });
DocsToolStripMenuItem.Name = "DocsToolStripMenuItem";
DocsToolStripMenuItem.Size = new Size(82, 20);
DocsToolStripMenuItem.Text = "Документы";
//
// SimpleDocToolStripMenuItem
//
SimpleDocToolStripMenuItem.Name = "SimpleDocToolStripMenuItem";
SimpleDocToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.S;
SimpleDocToolStripMenuItem.Size = new Size(233, 22);
SimpleDocToolStripMenuItem.Text = "Простой документ";
SimpleDocToolStripMenuItem.Click += SimpleDocToolStripMenuItem_Click;
//
// TableDocToolStripMenuItem
//
TableDocToolStripMenuItem.Name = "TableDocToolStripMenuItem";
TableDocToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.T;
TableDocToolStripMenuItem.Size = new Size(233, 22);
TableDocToolStripMenuItem.Text = "Документ с таблицой";
TableDocToolStripMenuItem.Click += TableDocToolStripMenuItem_Click;
//
// ChartDocToolStripMenuItem
//
ChartDocToolStripMenuItem.Name = "ChartDocToolStripMenuItem";
ChartDocToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.C;
ChartDocToolStripMenuItem.Size = new Size(233, 22);
ChartDocToolStripMenuItem.Text = "Круговая диаграмма";
ChartDocToolStripMenuItem.Click += ChartDocToolStripMenuItem_Click;
//
// panelControl
//
panelControl.Dock = DockStyle.Fill;
panelControl.Location = new Point(0, 24);
panelControl.Name = "panelControl";
panelControl.Size = new Size(800, 426);
panelControl.TabIndex = 1;
//
// FormMain
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(panelControl);
Controls.Add(menuStrip);
MainMenuStrip = menuStrip;
Name = "FormMain";
StartPosition = FormStartPosition.CenterScreen;
Text = "Главная форма";
WindowState = FormWindowState.Maximized;
KeyDown += FormMain_KeyDown;
menuStrip.ResumeLayout(false);
menuStrip.PerformLayout();
ResumeLayout(false);
PerformLayout();
}
#endregion
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;
}
}

View File

@ -0,0 +1,229 @@
using Contracts.StorageContracts;
using PluginsConventionLibrary;
using System.Reflection;
namespace WinFormsAppByPlugins
{
public partial class FormMain : Form
{
private readonly Dictionary<string, IPluginsConvention> _plugins;
private string _selectedPlugin;
public FormMain()
{
InitializeComponent();
_plugins = new();
LoadPlugins();
_selectedPlugin = string.Empty;
}
private void LoadPlugins()
{
List<IPluginsConvention> pluginsList = GetPlugins();
foreach (var plugin in pluginsList)
{
_plugins[plugin.PluginName] = plugin;
CreateMenuItem(plugin.PluginName);
}
}
private List<IPluginsConvention> GetPlugins()
{
string currentDir = Environment.CurrentDirectory;
string pluginsDir = Directory.GetParent(currentDir).Parent.Parent.Parent.FullName + "\\Plugins"; //ïóòü äî ïàïêè ñ ïëàãèíàìè
string[] dllFiles = Directory.GetFiles( // õðàíèì ïóòè äî âñåõ äëë-åê
pluginsDir,
"*.dll",
SearchOption.AllDirectories
);
List<IPluginsConvention> plugins = new();
foreach (string dllFile in dllFiles)
{
try
{
Assembly assembly = Assembly.LoadFrom(dllFile); // ïîëó÷àåì ñáîðêó èç dll ôàéëîâ
Type[] types = assembly.GetTypes(); // ïîëó÷àåì âñå òèïû, ò.å. êëàññû, èíòåðôåéñû è ò.ä. èç âñåõ dll
foreach (Type type in types) // ïðîõîäèì ïî íèì
{
if (typeof(IPluginsConvention).IsAssignableFrom(type) && !type.IsInterface) // åñëè òåêóùèé êëàññ ïðèâîäèì ê òèïó IPluginsConvention(ëèáî êëàññ íàñëåäíèê) è îí íå ÿâëÿÿåòñÿ èíòåðôåéñîì
{
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 = "Word Files|*.docx"
};
if (saveFileDialog.ShowDialog() == DialogResult.OK)
{
_plugins[_selectedPlugin].CreateWordDocument(new PluginsConventionSaveDocument() { FileName = saveFileDialog.FileName });
}
}
private void CreateTableDoc()
{
SaveFileDialog saveFileDialog = new()
{
Filter = "PDF Files|*.pdf"
};
if (saveFileDialog.ShowDialog() == DialogResult.OK)
{
_plugins[_selectedPlugin].CreateTableDocument(new PluginsConventionSaveDocument() { FileName = saveFileDialog.FileName });
}
}
private void CreateChartDoc()
{
SaveFileDialog saveFileDialog = new()
{
Filter = "Excel Files|*.xlsx"
};
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();
}
}

View File

@ -0,0 +1,60 @@
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,17 @@
namespace WinFormsAppByPlugins
{
internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[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());
}
}
}

View File

@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\PluginsConventionLibrary\PluginsConventionLibrary.csproj" />
</ItemGroup>
</Project>

View File

@ -15,6 +15,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DateBaseImplement", "DateBa
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppView", "AppView\AppView.csproj", "{294B81DD-546F-40AD-9BCE-0F51F1D17D1A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinFormsAppByPlugins", "WinFormsAppByPlugins\WinFormsAppByPlugins.csproj", "{30A92893-83E6-4BB4-94B4-1C4B63C4D34D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PluginsConventionLibrary", "PluginsConventionLibrary\PluginsConventionLibrary.csproj", "{82A002B5-7103-462D-9415-DC56CB552353}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -45,6 +49,14 @@ Global
{294B81DD-546F-40AD-9BCE-0F51F1D17D1A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{294B81DD-546F-40AD-9BCE-0F51F1D17D1A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{294B81DD-546F-40AD-9BCE-0F51F1D17D1A}.Release|Any CPU.Build.0 = Release|Any CPU
{30A92893-83E6-4BB4-94B4-1C4B63C4D34D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{30A92893-83E6-4BB4-94B4-1C4B63C4D34D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{30A92893-83E6-4BB4-94B4-1C4B63C4D34D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{30A92893-83E6-4BB4-94B4-1C4B63C4D34D}.Release|Any CPU.Build.0 = Release|Any CPU
{82A002B5-7103-462D-9415-DC56CB552353}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{82A002B5-7103-462D-9415-DC56CB552353}.Debug|Any CPU.Build.0 = Debug|Any CPU
{82A002B5-7103-462D-9415-DC56CB552353}.Release|Any CPU.ActiveCfg = Release|Any CPU
{82A002B5-7103-462D-9415-DC56CB552353}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE