10 Commits

Author SHA1 Message Date
ElEgEv
9517896ece Lab work 4. 2023-11-08 12:01:13 +04:00
ElEgEv
85be301862 All working! :) :) :) 2023-11-03 00:22:31 +04:00
ElEgEv
105b576311 Итоговые правки. 2023-11-03 00:07:27 +04:00
ElEgEv
52f2fd6b15 Промежуточный. 2023-11-02 23:54:11 +04:00
ElEgEv
8c80db4df3 Saves. 2023-11-02 23:12:21 +04:00
ElEgEv
e073e19639 Something was created. 2023-11-02 21:46:57 +04:00
ElEgEv
e9733d991b First common. 2023-11-02 21:27:47 +04:00
ElEgEv
695eca91b9 Small commit. 2023-11-02 17:27:46 +04:00
ElEgEv
b9162ffb1a Slowly adding the code. 2023-11-02 16:54:48 +04:00
ElEgEv
b97be5168a Start working. 2023-11-02 16:30:00 +04:00
20 changed files with 1279 additions and 5 deletions

View File

@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\VisualComponentsLib\VisualComponentsLib.csproj" />
<ProjectReference Include="..\Contracts\Contracts.csproj" />
<ProjectReference Include="..\DatabaseImplement\DatabaseImplement.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,2 @@
*
!.gitignore

View File

@@ -0,0 +1,192 @@
namespace PluginsConventionLibraryNet60
{
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()
{
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();
this.DocsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.SimpleDocToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.TableDocToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ChartDocToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.panelControl = new System.Windows.Forms.Panel();
this.menuStrip.SuspendLayout();
this.SuspendLayout();
//
// menuStrip
//
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(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(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 += new System.EventHandler(this.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(223, 26);
this.AddElementToolStripMenuItem.Text = "Добавить";
this.AddElementToolStripMenuItem.Click += new System.EventHandler(this.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(223, 26);
this.UpdElementToolStripMenuItem.Text = "Изменить";
this.UpdElementToolStripMenuItem.Click += new System.EventHandler(this.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(223, 26);
this.DelElementToolStripMenuItem.Text = "Удалить";
this.DelElementToolStripMenuItem.Click += new System.EventHandler(this.DelElementToolStripMenuItem_Click);
//
// DocsToolStripMenuItem
//
this.DocsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.SimpleDocToolStripMenuItem,
this.TableDocToolStripMenuItem,
this.ChartDocToolStripMenuItem});
this.DocsToolStripMenuItem.Name = "DocsToolStripMenuItem";
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(291, 26);
this.SimpleDocToolStripMenuItem.Text = "Простой документ";
this.SimpleDocToolStripMenuItem.Click += new System.EventHandler(this.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(291, 26);
this.TableDocToolStripMenuItem.Text = "Документ с таблицой";
this.TableDocToolStripMenuItem.Click += new System.EventHandler(this.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(291, 26);
this.ChartDocToolStripMenuItem.Text = "Диаграмма";
this.ChartDocToolStripMenuItem.Click += new System.EventHandler(this.ChartDocToolStripMenuItem_Click);
//
// panelControl
//
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(8F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
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 = "Главная форма";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FormMain_KeyDown);
this.menuStrip.ResumeLayout(false);
this.menuStrip.PerformLayout();
this.ResumeLayout(false);
this.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,286 @@
using PluginsLib;
using System.Reflection;
namespace PluginsConventionLibraryNet60
{
public partial class FormMain : Form
{
private readonly Dictionary<string, IPluginsConvention> _plugins;
private string _selectedPlugin;
public FormMain()
{
InitializeComponent();
_plugins = LoadPlugins();
_selectedPlugin = string.Empty;
}
private Dictionary<string, IPluginsConvention> LoadPlugins()
{
Dictionary<string, IPluginsConvention> plugins = new Dictionary<string, IPluginsConvention>();
List<IPluginsConvention> pluginsList = LoadPl();
foreach (var plugin in pluginsList)
{
plugins[plugin.PluginName] = plugin;
CreateMenuItem(plugin.PluginName);
}
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);
}
public List<IPluginsConvention> LoadPl()
{
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
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Assembly assembly = Assembly.LoadFrom(dllFile);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Type[] types = assembly.GetTypes();
foreach (Type type in types)
{
// "<22><><EFBFBD><EFBFBD> <20><> <20> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>, <20><><EFBFBD> <20><> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>?"
// <20> <20><><EFBFBD> <20><><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (typeof(IPluginsConvention).IsAssignableFrom(type) && !type.IsInterface)
{
// CreateInstance - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
// <20><><EFBFBD> <20><>: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20> IPluginsConvention
if (Activator.CreateInstance(type) is IPluginsConvention plugin)
{
plugins.Add(plugin);
}
}
}
}
catch (Exception ex)
{
Console.WriteLine($"<22><><EFBFBD><EFBFBD> <20> .dll <20> <20><><EFBFBD><EFBFBD><EFBFBD> Plugins - {dllFile}: {ex.Message}");
}
}
return plugins;
}
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();
_plugins[_selectedPlugin].ReloadData();
}
}
private void UpdateElement()
{
try
{
var element = _plugins[_selectedPlugin].GetElement;
var form = _plugins[_selectedPlugin].GetForm(element);
if (form != null)
{
form.ShowDialog();
_plugins[_selectedPlugin].ReloadData();
}
}
catch
{
MessageBox.Show("<22><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
private void DeleteElement()
{
if (MessageBox.Show("<22><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!",
MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
{
return;
}
try
{
var element = _plugins[_selectedPlugin].GetElement;
if (_plugins[_selectedPlugin].DeleteElement(element))
{
_plugins[_selectedPlugin].ReloadData();
}
}
catch
{
MessageBox.Show("<22><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
private void CreateSimpleDoc()
{
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
if (dialog.ShowDialog() == DialogResult.OK)
{
if (_plugins[_selectedPlugin].CreateSimpleDocument(new PluginsConventionSaveDocument()
{
FileName = dialog.FileName
}))
{
MessageBox.Show("<22><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
MessageBox.Show("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
private void CreateTableDoc()
{
using var dialog = new SaveFileDialog { Filter = "pdf|*.pdf" };
if (dialog.ShowDialog() == DialogResult.OK)
{
if (_plugins[_selectedPlugin].CreateTableDocument(new PluginsConventionSaveDocument()
{
FileName = dialog.FileName
}))
{
MessageBox.Show("<22><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
MessageBox.Show("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
private void CreateChartDoc()
{
using var dialog = new SaveFileDialog { Filter = "xlsx|*.xlsx" };
if (dialog.ShowDialog() == DialogResult.OK)
{
if (_plugins[_selectedPlugin].CreateChartDocument(new PluginsConventionSaveDocument()
{
FileName = dialog.FileName
}))
{
MessageBox.Show("<22><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
MessageBox.Show("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
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,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

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

View File

@@ -0,0 +1,17 @@
namespace PluginsConventionLibraryNet60
{
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,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace PluginsLib
{
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 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 PluginsLib
{
public class PluginsConventionElement
{
public Guid Id { get; set; }
}
}

View File

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

View File

@@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MarkNoVisualV2" Version="1.1.0" />
<PackageReference Include="MarkVisual" Version="1.4.0" />
<PackageReference Include="NVGeorgiy" Version="1.1.0" />
<PackageReference Include="VGeorgiy" Version="1.1.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\VisualComponentsLib\VisualComponentsLib.csproj" />
<ProjectReference Include="..\Contracts\Contracts.csproj" />
<ProjectReference Include="..\DatabaseImplement\DatabaseImplement.csproj" />
</ItemGroup>
</Project>

View File

@@ -7,14 +7,18 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VisualComponentsForm", "Vis
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VisualComponentsLib", "..\VisualComponentsLib\VisualComponentsLib.csproj", "{F5B8AE30-4836-44F8-AC47-75D2B05D73EF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataModels", "DataModels\DataModels.csproj", "{D208DBE1-5E90-4611-BAFD-2B021BCE0ADA}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DataModels", "DataModels\DataModels.csproj", "{D208DBE1-5E90-4611-BAFD-2B021BCE0ADA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Contracts", "Contracts\Contracts.csproj", "{E78467E3-3100-4F40-B454-7C44CB49FAB4}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Contracts", "Contracts\Contracts.csproj", "{E78467E3-3100-4F40-B454-7C44CB49FAB4}"
ProjectSection(ProjectDependencies) = postProject
{D208DBE1-5E90-4611-BAFD-2B021BCE0ADA} = {D208DBE1-5E90-4611-BAFD-2B021BCE0ADA}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DatabaseImplement", "DatabaseImplement\DatabaseImplement.csproj", "{2985D756-04FC-485F-BF53-95C02C43E1C2}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DatabaseImplement", "DatabaseImplement\DatabaseImplement.csproj", "{2985D756-04FC-485F-BF53-95C02C43E1C2}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PluginsLib", "PluginsLib\PluginsLib.csproj", "{BB23AF9D-1359-4E2B-9FE4-BA971B3D6F83}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PluginsConventionLibraryNet60", "PluginsConventionLibraryNet60\PluginsConventionLibraryNet60.csproj", "{F6851562-4D46-4348-9FFF-8618390C91BC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -42,6 +46,14 @@ Global
{2985D756-04FC-485F-BF53-95C02C43E1C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2985D756-04FC-485F-BF53-95C02C43E1C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2985D756-04FC-485F-BF53-95C02C43E1C2}.Release|Any CPU.Build.0 = Release|Any CPU
{BB23AF9D-1359-4E2B-9FE4-BA971B3D6F83}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BB23AF9D-1359-4E2B-9FE4-BA971B3D6F83}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BB23AF9D-1359-4E2B-9FE4-BA971B3D6F83}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BB23AF9D-1359-4E2B-9FE4-BA971B3D6F83}.Release|Any CPU.Build.0 = Release|Any CPU
{F6851562-4D46-4348-9FFF-8618390C91BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F6851562-4D46-4348-9FFF-8618390C91BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F6851562-4D46-4348-9FFF-8618390C91BC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F6851562-4D46-4348-9FFF-8618390C91BC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@@ -247,8 +247,6 @@ namespace VisualComponentsForm
LineChartExcel chart = new();
EnumAreaLegend legend = new();
foreach(var elem in list)
{
if(elem.Questions.Length >= 50 && elem.Questions.Length < 100)

View File

@@ -0,0 +1,334 @@
using Contracts.BindingModel;
using Contracts.StorageContracts;
using Contracts.ViewModel;
using DatabaseImplement.Implements;
using DataModels.Models;
using DocumentFormat.OpenXml.EMMA;
using IronPdf;
using NonVisualComponents;
using NonVisualComponents.Classes;
using NonVisualComponents.Enums;
using NonVisualComponents.objects;
using PluginsLib;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using VisualComponentsLib.Components;
using VisualComponentsLib.Components.SupportClasses;
using VisualComponentsLib.CustomListBox;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window;
namespace VisualComponentsForm
{
public class PluginsConvention : IPluginsConvention
{
private readonly LabWorkStorage _labWorkStorage;
private readonly IDisciplineStorage _discipline;
private readonly MyListBox listBox;
private ComponentWord wordTable;
private PdfTable pdfTable;
private ExcelChartInfo excelTable;
public string PluginName { get; set; } = "Список объектов";
public PluginsConvention()
{
_labWorkStorage = new LabWorkStorage();
_discipline = new DisciplineStorage();
wordTable = new ComponentWord();
pdfTable = new PdfTable();
//excelTable = new ExcelChartInfo();
listBox = new MyListBox();
}
public UserControl GetControl
{
get { return listBox; }
}
public PluginsConventionElement GetElement
{
get
{
int Id = GetSelectedId();
byte[] bytes = new byte[16];
BitConverter.GetBytes(Id).CopyTo(bytes, 0);
Guid curId = new Guid(bytes);
return new PluginsConventionElement() { Id = curId };
}
}
//запуск формы с лабораторными из предыдущей лабы
public Form GetForm(PluginsConventionElement element)
{
if (element == null)
{
return new FormCreateLabWork(_labWorkStorage, _discipline);
}
else
{
FormCreateLabWork form = new FormCreateLabWork(_labWorkStorage, _discipline);
form.Id = BitConverter.ToInt32(element.Id.ToByteArray(), 0);
return form;
}
}
//получаем список дисциплин (мои перечисления по заданию)
public Form GetThesaurus()
{
return new FormCreateDiscipline(_discipline);
}
//создание word табилцы
public bool CreateSimpleDocument(PluginsConventionSaveDocument saveDocument)
{
try
{
//сразу группируем списки по дисциплинам
var list = _labWorkStorage.GetFullList().OrderBy(l => l.Discipline).ToList();
var disciplines = _discipline.GetFullList().OrderBy(d => d.Name).ToList();
List<string[,]> totalList = new();
List<LabWorkViewModel> supportList = new();
foreach (var discipline in disciplines)
{
foreach (var elem in list)
{
if (elem.Discipline == discipline.Name)
{
supportList.Add(elem);
}
}
supportList = supportList.OrderBy(sl => sl.Theme).ToList();
totalList.Add(new string[,] { { "Дисциплина", discipline.Name } });
foreach (var elem in supportList)
{
var listFCs = elem.FCs.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList();
string[,] newArray = { { elem.Theme, listFCs[listFCs.Count - 1] } };
totalList.Add(newArray);
}
supportList.Clear();
}
SimpleTable table = new(saveDocument.FileName, "Первое задание", totalList);
wordTable.CreateDoc(table);
return true;
}
catch (Exception ex)
{
return false;
}
}
//создание pdf таблицы
public bool CreateTableDocument(PluginsConventionSaveDocument saveDocument)
{
try
{
//сразу группируем списки по дисциплинам
var list = _labWorkStorage.GetFullList().OrderBy(l => l.Discipline).ToList();
var disciplines = _discipline.GetFullList().OrderBy(d => d.Name).ToList();
List<string[,]> totalList = new();
List<LabWorkViewModel> supportList = new();
string[] headers = new[]
{
"Id", "Theme", "FCs",
"Discipline", "Questions"
};
Dictionary<int, (String, int)> merge = new() { [3] = ("Описание", 2) };
PdfTable pdfTable = new();
CreatePDF(new TableData<LabWorkViewModel>
{
FilePath = saveDocument.FileName,
Title = "Второе задание",
Merge = merge,
Headers = headers,
Data = list.ToArray(),
RowHeight = new double[] { 50, 50, 50, 50, 50, 50, 50, 50, 50, 50 }
});
return true;
}
catch (Exception ex)
{
return false;
}
}
//создание диаграммы
public bool CreateChartDocument(PluginsConventionSaveDocument saveDocument)
{
try
{
//сразу группируем списки по дисциплинам
var list = _labWorkStorage.GetFullList();
List<string[,]> totalList = new();
List<int> supportList = new(4) { 0, 0, 0, 0 };
LineChartExcel chart = new();
foreach (var elem in list)
{
if (elem.Questions.Length >= 50 && elem.Questions.Length < 100)
{
supportList[0]++;
}
if (elem.Questions.Length >= 100 && elem.Questions.Length < 150)
{
supportList[1]++;
}
if (elem.Questions.Length >= 150 && elem.Questions.Length < 200)
{
supportList[2]++;
}
if (elem.Questions.Length >= 200 && elem.Questions.Length < 250)
{
supportList[3]++;
}
}
var data = new List<DataItem>()
{
new DataItem() { Name = "50-100", Value = supportList[0] },
new DataItem() { Name = "100-150", Value = supportList[1] },
new DataItem() { Name = "150-200", Value = supportList[2] },
new DataItem() { Name = "200-250", Value = supportList[3] }
};
excelTable = new(
saveDocument.FileName,
"Третье задание",
"Диаграмма",
EnumAreaLegend.Left,
data
);
chart.GenerateChartExcel(excelTable);
return true;
}
catch (Exception ex)
{
return false;
}
}
public bool DeleteElement(PluginsConventionElement element)
{
_labWorkStorage.Delete(new LabWorkBindingModel
{
Id = element.Id.GetHashCode()
});
return true;
}
public void ReloadData()
{
var labWorks = _labWorkStorage.GetFullList();
listBox.ClearAll();
foreach (var labWork in labWorks)
{
listBox.AddItem(labWork.Discipline + " | " + labWork.Id.ToString() + " | "
+ labWork.Theme + " | " + labWork.Questions);
}
}
//иначе для pdf-ки никак :(((
public void CreatePDF<T>(TableData<T> data)
{
ChromePdfRenderer renderer = new ChromePdfRenderer();
StringBuilder htmlContainer = new StringBuilder();
htmlContainer.AppendLine("<link href=\"https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css\" rel=\"stylesheet\" integrity=\"sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN\" crossorigin=\"anonymous\">");
htmlContainer.AppendLine($"<h1>{data.Title}</h1>");
htmlContainer.AppendLine("<table class=\"table\">");
int counter = 0;
for (int i = 0; i < data.Headers.Length; i++)
{
htmlContainer.Append($"<tr style=\"height: {data.RowHeight[i]}px\">\r\n");
if (data.Merge.Keys.Contains(i))
{
htmlContainer.Append($"<th rowspan=\"{data.Merge[i].Item2}\">{data.Merge[i].Item1}</th>\r\n");
htmlContainer.Append($"<th>{data.Headers[i]}</th>\r\n");
counter = data.Merge[i].Item2 - 1;
}
else if (counter != 0)
{
htmlContainer.Append($"<th>{data.Headers[i]}</th>\r\n");
counter--;
}
else
{
htmlContainer.Append($"<th colspan=\"2\">{data.Headers[i]}</th>\r\n");
}
foreach (var elem in data.Data)
{
Type type = typeof(T);
string value = type
.GetProperty(data.Headers[i])!
.GetValue(elem, null)!.ToString()!;
htmlContainer.Append($"<td>{value}</th>\r\n");
}
htmlContainer.Append("</tr>\r\n");
}
htmlContainer.AppendLine("</table>");
PdfDocument pdf = renderer.RenderHtmlAsPdf(htmlContainer.ToString());
Console.WriteLine(htmlContainer.ToString());
pdf.SaveAs(data.FilePath);
}
//получение Id объекта в выделенной строке
public int GetSelectedId()
{
char dilimiterSimbol = '|';
var _id = listBox.SelectedString.SkipWhile(z => z != dilimiterSimbol).Skip(1).ToList()[1];
return int.Parse(_id.ToString());
}
}
}

View File

@@ -25,6 +25,11 @@
<ProjectReference Include="..\Contracts\Contracts.csproj" />
<ProjectReference Include="..\DatabaseImplement\DatabaseImplement.csproj" />
<ProjectReference Include="..\DataModels\DataModels.csproj" />
<ProjectReference Include="..\PluginsLib\PluginsLib.csproj" />
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="copy /Y &quot;$(TargetDir)*.dll&quot; &quot;$(SolutionDir)Plugins\*.dll&quot;" />
</Target>
</Project>

View File

@@ -0,0 +1,39 @@
namespace WinFormPluginsApp
{
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()
{
components = new System.ComponentModel.Container();
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Text = "Form1";
}
#endregion
}
}

View File

@@ -0,0 +1,10 @@
namespace WinFormPluginsApp
{
public partial class FormMain : Form
{
public FormMain()
{
InitializeComponent();
}
}
}

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,17 @@
namespace WinFormPluginsApp
{
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,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net7.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
</Project>