diff options
author | Serghei Cebotari <51533848+schebotar@users.noreply.github.com> | 2022-01-28 18:20:30 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-28 18:20:30 +0300 |
commit | ec1d38f2d4926ddd89dc8f17d29617ea4ddefa82 (patch) | |
tree | 9fd3a44e58693dc9bbc8d0e406ba4de21b39ec86 /src/Ribbon | |
parent | d688578a46e3a3383371c1df952fa2898c828a9a (diff) | |
parent | 2ad016bb4c332ecad6d12d824a84f15616ecea38 (diff) |
Merge pull request #12 from schebotar/dev
Dev
Diffstat (limited to 'src/Ribbon')
-rw-r--r-- | src/Ribbon/RibbonController.cs | 58 |
1 files changed, 30 insertions, 28 deletions
diff --git a/src/Ribbon/RibbonController.cs b/src/Ribbon/RibbonController.cs index ed59541..9011a43 100644 --- a/src/Ribbon/RibbonController.cs +++ b/src/Ribbon/RibbonController.cs @@ -4,6 +4,7 @@ using ExcelDna.Integration.CustomUI; using RehauSku.PriceListTools; using RehauSku.Forms; using System; +using System.Collections.Generic; namespace RehauSku.Ribbon { @@ -19,13 +20,14 @@ namespace RehauSku.Ribbon <tab id='rau' label='REHAU'> <group id='priceList' label='Прайс-лист'> <button id='exportToPrice' label='Экспорт в новый файл' size='normal' imageMso='PivotExportToExcel' onAction='OnExportPressed'/> + <button id='convertPrice' label='Актуализировать' size='normal' imageMso='FileUpdate' onAction='OnConvertPressed'/> <menu id='conjoinMenu' label='Объединить' imageMso='Copy'> <button id='mergeFiles' label='Сложить' onAction='OnMergePressed'/> <button id='combineFiles' label='По колонкам' onAction='OnCombinePressed'/> </menu> </group> <group id='rausettings' label='Настройки'> - <button id='setPriceList' label='Файл прайс-листа' size='large' imageMso='CurrentViewSettings' onAction='OnSetPricePressed'/> + <button id='setPriceList' label='Указать путь к шаблону' size='large' imageMso='CurrentViewSettings' onAction='OnSetPricePressed'/> </group> </tab> </tabs> @@ -33,35 +35,29 @@ namespace RehauSku.Ribbon </customUI>"; } - // <dropDown id = 'dd1' label = 'Drop dynamic' getItemCount = 'fncGetItemCountDrop' getItemLabel = 'fncGetItemLabelDrop' onAction = 'fncOnActionDrop'/> - public void OnMergePressed(IRibbonControl control) { - using (MergeTool mergeTool = new MergeTool()) + MergeTool mergeTool = new MergeTool(); + string[] files = Dialog.GetMultiplyFiles(); + + if (files.Length != 0) { - string[] files = Dialog.GetMultiplyFiles(); - if (files.Length != 0) - { - mergeTool.GetSource(files); - string exportFile = RegistryUtil.PriceListPath; - mergeTool.OpenNewPrice(exportFile); - mergeTool.FillPriceList(); - } + mergeTool.SourceFiles = Source.GetSourceLists(files); + mergeTool.OpenNewPrice(); + mergeTool.FillTarget(); } } public void OnCombinePressed(IRibbonControl control) { - using (CombineTool combineTool = new CombineTool()) + CombineTool combineTool = new CombineTool(); + string[] files = Dialog.GetMultiplyFiles(); + + if (files.Length != 0) { - string[] files = Dialog.GetMultiplyFiles(); - if (files.Length != 0) - { - combineTool.GetSource(files); - string exportFile = RegistryUtil.PriceListPath; - combineTool.OpenNewPrice(exportFile); - combineTool.FillPriceList(); - } + combineTool.SourceFiles = Source.GetSourceLists(files); + combineTool.OpenNewPrice(); + combineTool.FillTarget(); } } @@ -69,14 +65,12 @@ namespace RehauSku.Ribbon { try { - using (ExportTool exportTool = new ExportTool()) - { - exportTool.GetSource(); - string exportFile = RegistryUtil.PriceListPath; - exportTool.OpenNewPrice(exportFile); - exportTool.FillPriceList(); - } + ExportTool exportTool = new ExportTool(); + exportTool.TryGetSelection(); + exportTool.OpenNewPrice(); + exportTool.FillTarget(); } + catch (Exception ex) { MessageBox.Show(ex.Message, @@ -85,7 +79,15 @@ namespace RehauSku.Ribbon MessageBoxIcon.Information); return; } + } + + public void OnConvertPressed(IRibbonControl control) + { + ConvertTool convertTool = new ConvertTool(); + convertTool.GetCurrent(); + convertTool.OpenNewPrice(); + convertTool.FillTarget(); } public void OnSetPricePressed(IRibbonControl control) |