Полностью доделал

This commit is contained in:
Артём Алейкин 2023-12-14 01:48:08 +04:00
parent 34d262287b
commit 290b40fe1c
3 changed files with 91 additions and 53 deletions

View File

@ -145,6 +145,8 @@ namespace AppView
} }
public bool CreateWordDocument(PluginsConventionSaveDocument saveDocument) public bool CreateWordDocument(PluginsConventionSaveDocument saveDocument)
{
try
{ {
ImageClass info = new ImageClass(); ImageClass info = new ImageClass();
@ -155,10 +157,19 @@ namespace AppView
info.Files = images; info.Files = images;
documentWithImage1.CreateDocument(info); documentWithImage1.CreateDocument(info);
MessageBox.Show("Готово");
return true; return true;
} }
catch(Exception e)
{
MessageBox.Show(e.Message, "Ошибка");
return false;
}
}
public bool CreateTableDocument(PluginsConventionSaveDocument saveDocument) public bool CreateTableDocument(PluginsConventionSaveDocument saveDocument)
{
try
{ {
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance); System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
@ -185,10 +196,18 @@ namespace AppView
MessageBox.Show("Готово"); MessageBox.Show("Готово");
return true; return true;
} }
catch(Exception e)
{
MessageBox.Show(e.Message, "Ошибка");
return false;
}
}
public bool CreateChartDocument(PluginsConventionSaveDocument saveDocument) public bool CreateChartDocument(PluginsConventionSaveDocument saveDocument)
{ {
try
{
var providers = _providerStorage.GetFullList(); var providers = _providerStorage.GetFullList();
var uniqueTypes = providers.Select(p => p.Type).Distinct(); var uniqueTypes = providers.Select(p => p.Type).Distinct();
@ -212,8 +231,15 @@ namespace AppView
} }
gistograma1.GenerateExcelChartDocument(saveDocument.FileName, "Сводка по типам изделия.", "Количество поставщиков для товаров каждого типа", WinFormsLibrary.not_visual.LegendPosition.Bottom, data); gistograma1.GenerateExcelChartDocument(saveDocument.FileName, "Сводка по типам изделия.", "Количество поставщиков для товаров каждого типа", WinFormsLibrary.not_visual.LegendPosition.Bottom, data);
MessageBox.Show("Готово");
return true; return true;
} }
catch(Exception e)
{
MessageBox.Show(e.Message, "Ошибка");
return false;
}
}
} }

Binary file not shown.

View File

@ -182,6 +182,8 @@ namespace WinFormsAppByPlugins
} }
private void CreateSimpleDoc() private void CreateSimpleDoc()
{
try
{ {
SaveFileDialog saveFileDialog = new() SaveFileDialog saveFileDialog = new()
{ {
@ -193,7 +195,11 @@ namespace WinFormsAppByPlugins
} }
} }
catch(Exception ex) { MessageBox.Show(ex.Message, "Îøèáêà çàãðóçêè ïëàãèíà."); }
}
private void CreateTableDoc() private void CreateTableDoc()
{
try
{ {
SaveFileDialog saveFileDialog = new() SaveFileDialog saveFileDialog = new()
{ {
@ -205,7 +211,11 @@ namespace WinFormsAppByPlugins
} }
} }
catch (Exception ex) { MessageBox.Show(ex.Message, "Îøèáêà çàãðóçêè ïëàãèíà."); }
}
private void CreateChartDoc() private void CreateChartDoc()
{
try
{ {
SaveFileDialog saveFileDialog = new() SaveFileDialog saveFileDialog = new()
{ {
@ -216,6 +226,8 @@ namespace WinFormsAppByPlugins
_plugins[_selectedPlugin].CreateChartDocument(new PluginsConventionSaveDocument() { FileName = saveFileDialog.FileName }); _plugins[_selectedPlugin].CreateChartDocument(new PluginsConventionSaveDocument() { FileName = saveFileDialog.FileName });
} }
} }
catch (Exception ex) { MessageBox.Show(ex.Message, "Îøèáêà çàãðóçêè ïëàãèíà."); }
}
private void ThesaurusToolStripMenuItem_Click(object sender, EventArgs e) => ShowThesaurus(); private void ThesaurusToolStripMenuItem_Click(object sender, EventArgs e) => ShowThesaurus();
private void AddElementToolStripMenuItem_Click(object sender, EventArgs e) => AddNewElement(); private void AddElementToolStripMenuItem_Click(object sender, EventArgs e) => AddNewElement();