Compare commits
No commits in common. "4e45d927588a5246998fcebad0b7bd4041b228d5" and "8a31283d9e8f8b0e5cbaa9465456146997d5cb34" have entirely different histories.
4e45d92758
...
8a31283d9e
@ -26,7 +26,6 @@
|
|||||||
<ProjectReference Include="..\Contracts\Contracts.csproj" />
|
<ProjectReference Include="..\Contracts\Contracts.csproj" />
|
||||||
<ProjectReference Include="..\Controls\Controls.csproj" />
|
<ProjectReference Include="..\Controls\Controls.csproj" />
|
||||||
<ProjectReference Include="..\DatabaseImplement\DatabaseImplement.csproj" />
|
<ProjectReference Include="..\DatabaseImplement\DatabaseImplement.csproj" />
|
||||||
<ProjectReference Include="..\PluginsConventionLibrary\PluginsConventionLibrary.csproj" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -15,10 +15,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BusinessLogic", "BusinessLo
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DatabaseImplement", "DatabaseImplement\DatabaseImplement.csproj", "{D454A67C-F6F6-48AC-9BB5-DCEF7D54AFA6}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DatabaseImplement", "DatabaseImplement\DatabaseImplement.csproj", "{D454A67C-F6F6-48AC-9BB5-DCEF7D54AFA6}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PluginsConventionLibrary", "PluginsConventionLibrary\PluginsConventionLibrary.csproj", "{47D0DE62-FFC5-45EB-B2C6-8A6B7E36D1CC}"
|
|
||||||
EndProject
|
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PluginApp", "PluginApp\PluginApp.csproj", "{548C4056-26BB-4DE3-BB6E-4C0BEF3CBF2C}"
|
|
||||||
EndProject
|
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@ -49,14 +45,6 @@ Global
|
|||||||
{D454A67C-F6F6-48AC-9BB5-DCEF7D54AFA6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{D454A67C-F6F6-48AC-9BB5-DCEF7D54AFA6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{D454A67C-F6F6-48AC-9BB5-DCEF7D54AFA6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{D454A67C-F6F6-48AC-9BB5-DCEF7D54AFA6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{D454A67C-F6F6-48AC-9BB5-DCEF7D54AFA6}.Release|Any CPU.Build.0 = Release|Any CPU
|
{D454A67C-F6F6-48AC-9BB5-DCEF7D54AFA6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{47D0DE62-FFC5-45EB-B2C6-8A6B7E36D1CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{47D0DE62-FFC5-45EB-B2C6-8A6B7E36D1CC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{47D0DE62-FFC5-45EB-B2C6-8A6B7E36D1CC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{47D0DE62-FFC5-45EB-B2C6-8A6B7E36D1CC}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{548C4056-26BB-4DE3-BB6E-4C0BEF3CBF2C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{548C4056-26BB-4DE3-BB6E-4C0BEF3CBF2C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{548C4056-26BB-4DE3-BB6E-4C0BEF3CBF2C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{548C4056-26BB-4DE3-BB6E-4C0BEF3CBF2C}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
12
Cop_25/Forms/FormMain.Designer.cs
generated
12
Cop_25/Forms/FormMain.Designer.cs
generated
@ -41,9 +41,9 @@
|
|||||||
редактироватьtoolStripMenuItem = new ToolStripMenuItem();
|
редактироватьtoolStripMenuItem = new ToolStripMenuItem();
|
||||||
controlDataTreeTable = new ControlsLibraryNet60.Data.ControlDataTreeTable();
|
controlDataTreeTable = new ControlsLibraryNet60.Data.ControlDataTreeTable();
|
||||||
largeTextComponent = new Controls.LargeTextComponent(components);
|
largeTextComponent = new Controls.LargeTextComponent(components);
|
||||||
pieChartWord = new CustomComponents.NonViewComponents.PieChartWord(components);
|
pieChartWord1 = new CustomComponents.NonViewComponents.PieChartWord(components);
|
||||||
componentDocumentWithTableMultiHeaderExcel = new ComponentsLibraryNet60.DocumentWithTable.ComponentDocumentWithTableMultiHeaderExcel(components);
|
componentDocumentWithTableMultiHeaderExcel1 = new ComponentsLibraryNet60.DocumentWithTable.ComponentDocumentWithTableMultiHeaderExcel(components);
|
||||||
excelHardTable = new NotVisualComponent.ExcelHardTable(components);
|
excelHardTable1 = new NotVisualComponent.ExcelHardTable(components);
|
||||||
menuStrip1.SuspendLayout();
|
menuStrip1.SuspendLayout();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
@ -158,8 +158,8 @@
|
|||||||
private ToolStripMenuItem редактироватьtoolStripMenuItem;
|
private ToolStripMenuItem редактироватьtoolStripMenuItem;
|
||||||
private ControlsLibraryNet60.Data.ControlDataTreeTable controlDataTreeTable;
|
private ControlsLibraryNet60.Data.ControlDataTreeTable controlDataTreeTable;
|
||||||
private Controls.LargeTextComponent largeTextComponent;
|
private Controls.LargeTextComponent largeTextComponent;
|
||||||
private CustomComponents.NonViewComponents.PieChartWord pieChartWord;
|
private CustomComponents.NonViewComponents.PieChartWord pieChartWord1;
|
||||||
private ComponentsLibraryNet60.DocumentWithTable.ComponentDocumentWithTableMultiHeaderExcel componentDocumentWithTableMultiHeaderExcel;
|
private ComponentsLibraryNet60.DocumentWithTable.ComponentDocumentWithTableMultiHeaderExcel componentDocumentWithTableMultiHeaderExcel1;
|
||||||
private NotVisualComponent.ExcelHardTable excelHardTable;
|
private NotVisualComponent.ExcelHardTable excelHardTable1;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -162,7 +162,7 @@ namespace Forms
|
|||||||
Color = Color.FromArgb(100, 150, 200)
|
Color = Color.FromArgb(100, 150, 200)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
pieChartWord.CreateDiagramDocument(new PieChartData()
|
pieChartWord1.CreateDiagramDocument(new PieChartData()
|
||||||
{
|
{
|
||||||
FileName = path,
|
FileName = path,
|
||||||
DocumentTitle = "Диаграмма",
|
DocumentTitle = "Диаграмма",
|
||||||
@ -181,7 +181,7 @@ namespace Forms
|
|||||||
string path = saveFileDialog.FileName + ".xlsx";
|
string path = saveFileDialog.FileName + ".xlsx";
|
||||||
var list = _dlogic.ReadList(null);
|
var list = _dlogic.ReadList(null);
|
||||||
|
|
||||||
excelHardTable.CreateDoc(new TableWithHeaderConfig<DeliveryViewModel>
|
excelHardTable1.CreateDoc(new TableWithHeaderConfig<DeliveryViewModel>
|
||||||
{
|
{
|
||||||
FilePath = path,
|
FilePath = path,
|
||||||
Header = "Deliveryies",
|
Header = "Deliveryies",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<root>
|
<root>
|
||||||
<!--
|
<!--
|
||||||
Microsoft ResX Schema
|
Microsoft ResX Schema
|
||||||
|
|
||||||
Version 2.0
|
Version 2.0
|
||||||
|
|
||||||
@ -48,7 +48,7 @@
|
|||||||
value : The object must be serialized with
|
value : The object must be serialized with
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
value : The object must be serialized with
|
value : The object must be serialized with
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
@ -123,13 +123,13 @@
|
|||||||
<metadata name="largeTextComponent.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="largeTextComponent.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>153, 17</value>
|
<value>153, 17</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
<metadata name="pieChartWord.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="pieChartWord1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>348, 17</value>
|
<value>348, 17</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
<metadata name="componentDocumentWithTableMultiHeaderExcel.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="componentDocumentWithTableMultiHeaderExcel1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>504, 17</value>
|
<value>504, 17</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
<metadata name="excelHardTable.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="excelHardTable1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>17, 58</value>
|
<value>17, 58</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
</root>
|
</root>
|
@ -26,7 +26,6 @@
|
|||||||
<ProjectReference Include="..\Contracts\Contracts.csproj" />
|
<ProjectReference Include="..\Contracts\Contracts.csproj" />
|
||||||
<ProjectReference Include="..\Controls\Controls.csproj" />
|
<ProjectReference Include="..\Controls\Controls.csproj" />
|
||||||
<ProjectReference Include="..\DatabaseImplement\DatabaseImplement.csproj" />
|
<ProjectReference Include="..\DatabaseImplement\DatabaseImplement.csproj" />
|
||||||
<ProjectReference Include="..\PluginsConventionLibrary\PluginsConventionLibrary.csproj" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -1,192 +0,0 @@
|
|||||||
using BusinessLogic.BusinessLogic;
|
|
||||||
using ComponentsLibraryNet60.DocumentWithChart;
|
|
||||||
using ComponentsLibraryNet60.DocumentWithTable;
|
|
||||||
using ComponentsLibraryNet60.Models;
|
|
||||||
using Contracts.BindlingModels;
|
|
||||||
using Contracts.BusinessLogicContracts;
|
|
||||||
using Contracts.ViewModels;
|
|
||||||
using Controls;
|
|
||||||
using ControlsLibraryNet60.Data;
|
|
||||||
using ControlsLibraryNet60.Models;
|
|
||||||
using CustomComponents.NonViewComponents;
|
|
||||||
using CustomComponents.NonViewComponents.Enums;
|
|
||||||
using CustomComponents.NonViewComponents.SupportClasses;
|
|
||||||
using DatabaseImplement.Implements;
|
|
||||||
using NotVisualComponent;
|
|
||||||
using NotVisualComponent.Models;
|
|
||||||
using PluginsConventionLibrary;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Forms
|
|
||||||
{
|
|
||||||
public class PluginsConvention : IPluginsConvention
|
|
||||||
{
|
|
||||||
private readonly IDeliveryLogic _dlogic;
|
|
||||||
private readonly IDeliveryTypeLogic _dtlogic;
|
|
||||||
private readonly ControlDataTreeTable _controlDataTreeTable = new();
|
|
||||||
private readonly LargeTextComponent _largeTextComponent = new();
|
|
||||||
private readonly ExcelHardTable excelHardTable = new();
|
|
||||||
private readonly PieChartWord pieChartWord = new();
|
|
||||||
|
|
||||||
public PluginsConvention()
|
|
||||||
{
|
|
||||||
_dtlogic = new DeliveryTypeLogic(new DeliveryTypeStorage());
|
|
||||||
_dlogic = new DeliveryLogic(new DeliveryStorage());
|
|
||||||
ReloadData();
|
|
||||||
}
|
|
||||||
|
|
||||||
public string PluginName => "PluginLab3";
|
|
||||||
|
|
||||||
public UserControl GetControl => _controlDataTreeTable;
|
|
||||||
|
|
||||||
public PluginsConventionElement GetElement
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
var selected = _controlDataTreeTable.GetSelectedObject<DeliveryViewModel>();
|
|
||||||
if (selected == null) throw new Exception("Не удалось получить выбранный элемент");
|
|
||||||
byte[] bytes = new byte[16];
|
|
||||||
BitConverter.GetBytes(selected.Id).CopyTo(bytes, 0);
|
|
||||||
return new PluginsConventionProvider()
|
|
||||||
{
|
|
||||||
Id = new Guid(bytes),
|
|
||||||
FCs = selected.FCs,
|
|
||||||
Wishes = selected.Wishes,
|
|
||||||
DeliveryType = selected.DeliveryType,
|
|
||||||
DeliveryDate = selected.DeliveryDate,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Form GetForm(PluginsConventionElement element)
|
|
||||||
{
|
|
||||||
var deliveryForm = new DeliveryForm(_dlogic, _dtlogic);
|
|
||||||
if (element != null)
|
|
||||||
{
|
|
||||||
deliveryForm = new DeliveryForm(_dlogic, _dtlogic, element.Id.GetHashCode());
|
|
||||||
}
|
|
||||||
return deliveryForm;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Form GetThesaurus()
|
|
||||||
{
|
|
||||||
return new DeliveryTypeForm(_dtlogic);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool DeleteElement(PluginsConventionElement element)
|
|
||||||
{
|
|
||||||
return _dlogic.Delete(new DeliveryBindingModel
|
|
||||||
{
|
|
||||||
Id = element.Id.GetHashCode()
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ReloadData()
|
|
||||||
{
|
|
||||||
DataTreeNodeConfig treeConfig = new();
|
|
||||||
treeConfig.NodeNames = new();
|
|
||||||
treeConfig.NodeNames.Enqueue("Id");
|
|
||||||
treeConfig.NodeNames.Enqueue("FCs");
|
|
||||||
treeConfig.NodeNames.Enqueue("Wishes");
|
|
||||||
treeConfig.NodeNames.Enqueue("DeliveryType");
|
|
||||||
treeConfig.NodeNames.Enqueue("DeliveryDate");
|
|
||||||
|
|
||||||
_controlDataTreeTable.LoadConfig(treeConfig);
|
|
||||||
|
|
||||||
var list = _dlogic.ReadList(null);
|
|
||||||
if (list != null)
|
|
||||||
{
|
|
||||||
_controlDataTreeTable.Clear();
|
|
||||||
_controlDataTreeTable.AddTable(list);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool CreateSimpleDocument(PluginsConventionSaveDocument saveDocument)
|
|
||||||
{
|
|
||||||
var list = _dlogic.ReadList(null);
|
|
||||||
if (list != null)
|
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
foreach (var item in list)
|
|
||||||
{
|
|
||||||
if (item.DeliveryDate == "Даты доставки нет") i++;
|
|
||||||
}
|
|
||||||
string[] strings = new string[i];
|
|
||||||
int j = 0;
|
|
||||||
foreach (var item in list)
|
|
||||||
{
|
|
||||||
if (item.DeliveryDate == "Даты доставки нет") { strings[j] = ($"{item.FCs} : {item.Wishes}"); j++; }
|
|
||||||
}
|
|
||||||
_largeTextComponent.CreateDocument(saveDocument.FileName, $"Отчет по доставкам без даты:", strings);
|
|
||||||
MessageBox.Show("Отчет готов");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool CreateTableDocument(PluginsConventionSaveDocument saveDocument)
|
|
||||||
{
|
|
||||||
var list = _dlogic.ReadList(null);
|
|
||||||
if (list != null)
|
|
||||||
{
|
|
||||||
excelHardTable.CreateDoc(new TableWithHeaderConfig<DeliveryViewModel>
|
|
||||||
{
|
|
||||||
FilePath = saveDocument.FileName,
|
|
||||||
Header = "Deliveryies",
|
|
||||||
ColumnsRowsWidth = new List<(int Column, int Row)> { (5, 5), (20, 5), (10, 0), (15, 0), },
|
|
||||||
Headers = new List<(int ColumnIndex, int RowIndex, string Header, string PropertyName)>
|
|
||||||
{
|
|
||||||
(0, 0, "Id", "Id"),
|
|
||||||
(1, 0, "FCs", "FCs"),
|
|
||||||
(2, 0, "DeliveryType", "DeliveryType"),
|
|
||||||
(3, 0, "DeliveryDate", "DeliveryDate"),
|
|
||||||
},
|
|
||||||
Data = list
|
|
||||||
});
|
|
||||||
MessageBox.Show("Отчет готов");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
public bool CreateChartDocument(PluginsConventionSaveDocument saveDocument)
|
|
||||||
{
|
|
||||||
var list = _dlogic.ReadList(null);
|
|
||||||
var data = list
|
|
||||||
.Where(x => x.DeliveryDate != "Даты доставки нет")
|
|
||||||
.GroupBy(x => x.DeliveryType)
|
|
||||||
.Select(g => (type: g.Key, Value: g.Count()))
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
var categoriesX = data.Select(d => d.type).ToList();
|
|
||||||
var valuesY = data.Select(d => (double)d.Value).ToList();
|
|
||||||
if (list != null)
|
|
||||||
{
|
|
||||||
var series = new List<SeriesData>
|
|
||||||
{
|
|
||||||
new()
|
|
||||||
{
|
|
||||||
SeriesName = "Количество доставок",
|
|
||||||
ValuesY = valuesY,
|
|
||||||
Color = Color.FromArgb(100, 150, 200)
|
|
||||||
}
|
|
||||||
};
|
|
||||||
pieChartWord.CreateDiagramDocument(new PieChartData()
|
|
||||||
{
|
|
||||||
FileName = saveDocument.FileName,
|
|
||||||
DocumentTitle = "Диаграмма",
|
|
||||||
DiagramTitle = "Количество доставок по типам",
|
|
||||||
LegendLayout = PieChartLegendAlign.Bottom,
|
|
||||||
CategoriesX = categoriesX,
|
|
||||||
SeriesData = series
|
|
||||||
});
|
|
||||||
MessageBox.Show("Отчет готов");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
using PluginsConventionLibrary;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Forms
|
|
||||||
{
|
|
||||||
public class PluginsConventionProvider : PluginsConventionElement
|
|
||||||
{
|
|
||||||
public string FCs { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
public string Wishes { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
public string DeliveryType { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
public string? DeliveryDate { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
39
Cop_25/PluginApp/Form1.Designer.cs
generated
39
Cop_25/PluginApp/Form1.Designer.cs
generated
@ -1,39 +0,0 @@
|
|||||||
namespace PluginApp
|
|
||||||
{
|
|
||||||
partial class Form1
|
|
||||||
{
|
|
||||||
/// <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.components = new System.ComponentModel.Container();
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
|
||||||
this.Text = "Form1";
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
namespace PluginApp
|
|
||||||
{
|
|
||||||
public partial class Form1 : Form
|
|
||||||
{
|
|
||||||
public Form1()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,120 +0,0 @@
|
|||||||
<?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>
|
|
173
Cop_25/PluginApp/FormMain.Designer.cs
generated
173
Cop_25/PluginApp/FormMain.Designer.cs
generated
@ -1,173 +0,0 @@
|
|||||||
namespace PluginApp
|
|
||||||
{
|
|
||||||
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.ImageScalingSize = new Size(20, 20);
|
|
||||||
menuStrip.Items.AddRange(new ToolStripItem[] { ControlsStripMenuItem, ActionsToolStripMenuItem, DocsToolStripMenuItem });
|
|
||||||
menuStrip.Location = new Point(0, 0);
|
|
||||||
menuStrip.Name = "menuStrip";
|
|
||||||
menuStrip.Padding = new Padding(7, 3, 0, 3);
|
|
||||||
menuStrip.Size = new Size(914, 30);
|
|
||||||
menuStrip.TabIndex = 0;
|
|
||||||
menuStrip.Text = "menuStrip1";
|
|
||||||
//
|
|
||||||
// ControlsStripMenuItem
|
|
||||||
//
|
|
||||||
ControlsStripMenuItem.Name = "ControlsStripMenuItem";
|
|
||||||
ControlsStripMenuItem.Size = new Size(113, 24);
|
|
||||||
ControlsStripMenuItem.Text = "Компоненты";
|
|
||||||
//
|
|
||||||
// ActionsToolStripMenuItem
|
|
||||||
//
|
|
||||||
ActionsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { ThesaurusToolStripMenuItem, AddElementToolStripMenuItem, UpdElementToolStripMenuItem, DelElementToolStripMenuItem });
|
|
||||||
ActionsToolStripMenuItem.Name = "ActionsToolStripMenuItem";
|
|
||||||
ActionsToolStripMenuItem.Size = new Size(88, 24);
|
|
||||||
ActionsToolStripMenuItem.Text = "Действия";
|
|
||||||
//
|
|
||||||
// ThesaurusToolStripMenuItem
|
|
||||||
//
|
|
||||||
ThesaurusToolStripMenuItem.Name = "ThesaurusToolStripMenuItem";
|
|
||||||
ThesaurusToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.I;
|
|
||||||
ThesaurusToolStripMenuItem.Size = new Size(224, 26);
|
|
||||||
ThesaurusToolStripMenuItem.Text = "Справочник";
|
|
||||||
ThesaurusToolStripMenuItem.Click += ThesaurusToolStripMenuItem_Click;
|
|
||||||
//
|
|
||||||
// AddElementToolStripMenuItem
|
|
||||||
//
|
|
||||||
AddElementToolStripMenuItem.Name = "AddElementToolStripMenuItem";
|
|
||||||
AddElementToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.A;
|
|
||||||
AddElementToolStripMenuItem.Size = new Size(224, 26);
|
|
||||||
AddElementToolStripMenuItem.Text = "Добавить";
|
|
||||||
AddElementToolStripMenuItem.Click += AddElementToolStripMenuItem_Click;
|
|
||||||
//
|
|
||||||
// UpdElementToolStripMenuItem
|
|
||||||
//
|
|
||||||
UpdElementToolStripMenuItem.Name = "UpdElementToolStripMenuItem";
|
|
||||||
UpdElementToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.U;
|
|
||||||
UpdElementToolStripMenuItem.Size = new Size(224, 26);
|
|
||||||
UpdElementToolStripMenuItem.Text = "Изменить";
|
|
||||||
UpdElementToolStripMenuItem.Click += UpdElementToolStripMenuItem_Click;
|
|
||||||
//
|
|
||||||
// DelElementToolStripMenuItem
|
|
||||||
//
|
|
||||||
DelElementToolStripMenuItem.Name = "DelElementToolStripMenuItem";
|
|
||||||
DelElementToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.D;
|
|
||||||
DelElementToolStripMenuItem.Size = new Size(224, 26);
|
|
||||||
DelElementToolStripMenuItem.Text = "Удалить";
|
|
||||||
DelElementToolStripMenuItem.Click += DelElementToolStripMenuItem_Click;
|
|
||||||
//
|
|
||||||
// DocsToolStripMenuItem
|
|
||||||
//
|
|
||||||
DocsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { SimpleDocToolStripMenuItem, TableDocToolStripMenuItem, ChartDocToolStripMenuItem });
|
|
||||||
DocsToolStripMenuItem.Name = "DocsToolStripMenuItem";
|
|
||||||
DocsToolStripMenuItem.Size = new Size(101, 24);
|
|
||||||
DocsToolStripMenuItem.Text = "Документы";
|
|
||||||
//
|
|
||||||
// SimpleDocToolStripMenuItem
|
|
||||||
//
|
|
||||||
SimpleDocToolStripMenuItem.Name = "SimpleDocToolStripMenuItem";
|
|
||||||
SimpleDocToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.S;
|
|
||||||
SimpleDocToolStripMenuItem.Size = new Size(290, 26);
|
|
||||||
SimpleDocToolStripMenuItem.Text = "Простой документ";
|
|
||||||
SimpleDocToolStripMenuItem.Click += SimpleDocToolStripMenuItem_Click;
|
|
||||||
//
|
|
||||||
// TableDocToolStripMenuItem
|
|
||||||
//
|
|
||||||
TableDocToolStripMenuItem.Name = "TableDocToolStripMenuItem";
|
|
||||||
TableDocToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.T;
|
|
||||||
TableDocToolStripMenuItem.Size = new Size(290, 26);
|
|
||||||
TableDocToolStripMenuItem.Text = "Документ с таблицей";
|
|
||||||
TableDocToolStripMenuItem.Click += TableDocToolStripMenuItem_Click;
|
|
||||||
//
|
|
||||||
// ChartDocToolStripMenuItem
|
|
||||||
//
|
|
||||||
ChartDocToolStripMenuItem.Name = "ChartDocToolStripMenuItem";
|
|
||||||
ChartDocToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.C;
|
|
||||||
ChartDocToolStripMenuItem.Size = new Size(290, 26);
|
|
||||||
ChartDocToolStripMenuItem.Text = "Диаграмма";
|
|
||||||
ChartDocToolStripMenuItem.Click += ChartDocToolStripMenuItem_Click;
|
|
||||||
//
|
|
||||||
// panelControl
|
|
||||||
//
|
|
||||||
panelControl.Location = new Point(0, 36);
|
|
||||||
panelControl.Margin = new Padding(3, 4, 3, 4);
|
|
||||||
panelControl.Name = "panelControl";
|
|
||||||
panelControl.Size = new Size(914, 565);
|
|
||||||
panelControl.TabIndex = 1;
|
|
||||||
//
|
|
||||||
// FormMain
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(914, 600);
|
|
||||||
Controls.Add(panelControl);
|
|
||||||
Controls.Add(menuStrip);
|
|
||||||
MainMenuStrip = menuStrip;
|
|
||||||
Margin = new Padding(3, 4, 3, 4);
|
|
||||||
Name = "FormMain";
|
|
||||||
Text = "Основная форма";
|
|
||||||
menuStrip.ResumeLayout(false);
|
|
||||||
menuStrip.PerformLayout();
|
|
||||||
ResumeLayout(false);
|
|
||||||
PerformLayout();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private MenuStrip menuStrip;
|
|
||||||
private ToolStripMenuItem ControlsStripMenuItem;
|
|
||||||
private ToolStripMenuItem ActionsToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem DocsToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem SimpleDocToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem TableDocToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem ChartDocToolStripMenuItem;
|
|
||||||
private Panel panelControl;
|
|
||||||
private ToolStripMenuItem ThesaurusToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem AddElementToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem UpdElementToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem DelElementToolStripMenuItem;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,225 +0,0 @@
|
|||||||
using PluginsConventionLibrary;
|
|
||||||
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 PluginApp
|
|
||||||
{
|
|
||||||
public partial class FormMain : Form
|
|
||||||
{
|
|
||||||
private readonly Dictionary<string, IPluginsConvention> _plugins;
|
|
||||||
private string _selectedPlugin;
|
|
||||||
public FormMain()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_selectedPlugin = string.Empty;
|
|
||||||
_plugins = LoadPlugins();
|
|
||||||
}
|
|
||||||
private Dictionary<string, IPluginsConvention> LoadPlugins()
|
|
||||||
{
|
|
||||||
var plugins = new Dictionary<string, IPluginsConvention>();
|
|
||||||
string pluginsPath = Directory.GetParent(Directory.GetCurrentDirectory())!.Parent!.Parent!.FullName + "\\plugins";
|
|
||||||
string[] dllFiles = Directory.GetFiles(pluginsPath, "*.dll", SearchOption.AllDirectories);
|
|
||||||
if (!Directory.Exists(pluginsPath))
|
|
||||||
{
|
|
||||||
MessageBox.Show($"Ошибка получения плагинов", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return plugins;
|
|
||||||
}
|
|
||||||
foreach (var dll in dllFiles)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Assembly asmbly = Assembly.LoadFrom(dll);
|
|
||||||
Type[] types = asmbly.GetTypes();
|
|
||||||
foreach (var type in types)
|
|
||||||
{
|
|
||||||
if (typeof(IPluginsConvention).IsAssignableFrom(type) && !type.IsInterface && !type.IsAbstract)
|
|
||||||
{
|
|
||||||
var plugin = (IPluginsConvention)Activator.CreateInstance(type)!;
|
|
||||||
plugins.Add(plugin.PluginName, plugin);
|
|
||||||
CreateStripMenuItem(plugin.PluginName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
//MessageBox.Show($"Неудалось загрузить плагины", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return plugins;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CreateStripMenuItem(string pluginName)
|
|
||||||
{
|
|
||||||
var menuItem = new ToolStripMenuItem(pluginName);
|
|
||||||
menuItem.Click += (s, e) =>
|
|
||||||
{
|
|
||||||
_selectedPlugin = pluginName;
|
|
||||||
IPluginsConvention plugin = _plugins![pluginName];
|
|
||||||
if (plugin?.GetControl == null) throw new Exception("Неудалось получить контрол");
|
|
||||||
UserControl userControl = plugin.GetControl;
|
|
||||||
panelControl.Controls.Clear();
|
|
||||||
plugin.ReloadData();
|
|
||||||
userControl.Dock = DockStyle.Fill;
|
|
||||||
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()
|
|
||||||
{
|
|
||||||
using var dialog = new SaveFileDialog
|
|
||||||
{
|
|
||||||
Filter = "PDF Files|*.pdf"
|
|
||||||
};
|
|
||||||
if (dialog.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
if (_plugins[_selectedPlugin].CreateSimpleDocument(new PluginsConventionSaveDocument() { FileName = dialog.FileName }))
|
|
||||||
{
|
|
||||||
MessageBox.Show("Документ сохранен", "Создание документа", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MessageBox.Show("Ошибка при создании документа",
|
|
||||||
"Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void CreateTableDoc()
|
|
||||||
{
|
|
||||||
using var dialog = new SaveFileDialog
|
|
||||||
{
|
|
||||||
Filter = "Excel Files|*.xlsx"
|
|
||||||
};
|
|
||||||
if (dialog.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
if (_plugins[_selectedPlugin].CreateTableDocument(new PluginsConventionSaveDocument() { FileName = dialog.FileName }))
|
|
||||||
{
|
|
||||||
MessageBox.Show("Документ сохранен", "Создание документа", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MessageBox.Show("Ошибка при создании документа",
|
|
||||||
"Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void CreateChartDoc()
|
|
||||||
{
|
|
||||||
using var dialog = new SaveFileDialog
|
|
||||||
{
|
|
||||||
Filter = "docx|*.docx"
|
|
||||||
};
|
|
||||||
if (dialog.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
if (_plugins[_selectedPlugin].CreateChartDocument(new PluginsConventionSaveDocument() { FileName = dialog.FileName }))
|
|
||||||
{
|
|
||||||
MessageBox.Show("Документ сохранен", "Создание документа", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MessageBox.Show("Ошибка при создании документа",
|
|
||||||
"Ошибка", 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();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,123 +0,0 @@
|
|||||||
<?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>
|
|
||||||
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
|
||||||
<value>17, 17</value>
|
|
||||||
</metadata>
|
|
||||||
</root>
|
|
@ -1,17 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<OutputType>WinExe</OutputType>
|
|
||||||
<TargetFramework>net8.0-windows</TargetFramework>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
<UseWindowsForms>true</UseWindowsForms>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\DatabaseImplement\DatabaseImplement.csproj" />
|
|
||||||
<ProjectReference Include="..\Forms\Forms.csproj" />
|
|
||||||
<ProjectReference Include="..\PluginsConventionLibrary\PluginsConventionLibrary.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
@ -1,17 +0,0 @@
|
|||||||
namespace PluginApp
|
|
||||||
{
|
|
||||||
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());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
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.
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.
@ -1,63 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace PluginsConventionLibrary
|
|
||||||
{
|
|
||||||
public interface IPluginsConvention
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Название плагина
|
|
||||||
/// </summary>
|
|
||||||
string PluginName { get; }
|
|
||||||
/// <summary>
|
|
||||||
/// Получение контрола для вывода набора данных
|
|
||||||
/// </summary>
|
|
||||||
UserControl GetControl { get; }
|
|
||||||
/// <summary>
|
|
||||||
/// Получение элемента, выбранного в контроле
|
|
||||||
/// </summary>
|
|
||||||
PluginsConventionElement GetElement { get; }
|
|
||||||
/// <summary>
|
|
||||||
/// Получение формы для создания/редактирования объекта
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="element"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
Form GetForm(PluginsConventionElement element);
|
|
||||||
/// <summary>
|
|
||||||
/// Получение формы для работы со справочником
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
Form GetThesaurus();
|
|
||||||
/// <summary>
|
|
||||||
/// Удаление элемента
|
|
||||||
/// /// </summary>
|
|
||||||
/// <param name="element"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
bool DeleteElement(PluginsConventionElement element);
|
|
||||||
/// <summary>
|
|
||||||
/// Обновление набора данных в контроле
|
|
||||||
/// </summary>
|
|
||||||
void ReloadData();
|
|
||||||
/// <summary>
|
|
||||||
/// Создание простого документа
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="saveDocument"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
bool CreateSimpleDocument(PluginsConventionSaveDocument saveDocument);
|
|
||||||
/// <summary>
|
|
||||||
/// Создание простого документа
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="saveDocument"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
bool CreateTableDocument(PluginsConventionSaveDocument saveDocument);
|
|
||||||
/// <summary>
|
|
||||||
/// Создание документа с диаграммой
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="saveDocument"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
bool CreateChartDocument(PluginsConventionSaveDocument saveDocument);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
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; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net8.0-windows</TargetFramework>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<UseWindowsForms>true</UseWindowsForms>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
@ -1,13 +0,0 @@
|
|||||||
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; }
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user