From 72ac236b15603e84f18ec346749186b6cb2c2bdf Mon Sep 17 00:00:00 2001 From: Sergey Chebotar Date: Thu, 27 Jan 2022 10:22:30 +0300 Subject: Refactoring tolls classes --- src/Ribbon/RibbonController.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/Ribbon') diff --git a/src/Ribbon/RibbonController.cs b/src/Ribbon/RibbonController.cs index ed59541..d17426b 100644 --- a/src/Ribbon/RibbonController.cs +++ b/src/Ribbon/RibbonController.cs @@ -42,10 +42,10 @@ namespace RehauSku.Ribbon string[] files = Dialog.GetMultiplyFiles(); if (files.Length != 0) { - mergeTool.GetSource(files); + mergeTool.GetSourceLists(files); string exportFile = RegistryUtil.PriceListPath; mergeTool.OpenNewPrice(exportFile); - mergeTool.FillPriceList(); + mergeTool.FillTarget(); } } } @@ -57,10 +57,10 @@ namespace RehauSku.Ribbon string[] files = Dialog.GetMultiplyFiles(); if (files.Length != 0) { - combineTool.GetSource(files); + combineTool.GetSourceLists(files); string exportFile = RegistryUtil.PriceListPath; combineTool.OpenNewPrice(exportFile); - combineTool.FillPriceList(); + combineTool.FillTarget(); } } } @@ -74,7 +74,7 @@ namespace RehauSku.Ribbon exportTool.GetSource(); string exportFile = RegistryUtil.PriceListPath; exportTool.OpenNewPrice(exportFile); - exportTool.FillPriceList(); + exportTool.FillTarget(); } } catch (Exception ex) -- cgit v1.2.3 From 935d48fc5fe264218b39b335e1fc5232af5dae61 Mon Sep 17 00:00:00 2001 From: Sergey Chebotar Date: Thu, 27 Jan 2022 17:34:03 +0300 Subject: Complete tools refactoring --- src/Ribbon/RibbonController.cs | 48 ++++++++++++++++++------------------------ 1 file changed, 20 insertions(+), 28 deletions(-) (limited to 'src/Ribbon') diff --git a/src/Ribbon/RibbonController.cs b/src/Ribbon/RibbonController.cs index d17426b..b00e23a 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 { @@ -33,35 +34,29 @@ namespace RehauSku.Ribbon "; } - // - 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.GetSourceLists(files); - string exportFile = RegistryUtil.PriceListPath; - mergeTool.OpenNewPrice(exportFile); - mergeTool.FillTarget(); - } + mergeTool.SourceFiles = SourceUtil.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.GetSourceLists(files); - string exportFile = RegistryUtil.PriceListPath; - combineTool.OpenNewPrice(exportFile); - combineTool.FillTarget(); - } + combineTool.SourceFiles = SourceUtil.GetSourceLists(files); + combineTool.OpenNewPrice(); + combineTool.FillTarget(); } } @@ -69,14 +64,12 @@ namespace RehauSku.Ribbon { try { - using (ExportTool exportTool = new ExportTool()) - { - exportTool.GetSource(); - string exportFile = RegistryUtil.PriceListPath; - exportTool.OpenNewPrice(exportFile); - exportTool.FillTarget(); - } + ExportTool exportTool = new ExportTool(); + exportTool.TryGetSelection(); + exportTool.OpenNewPrice(); + exportTool.FillTarget(); } + catch (Exception ex) { MessageBox.Show(ex.Message, @@ -85,7 +78,6 @@ namespace RehauSku.Ribbon MessageBoxIcon.Information); return; } - } public void OnSetPricePressed(IRibbonControl control) -- cgit v1.2.3 From 722de64dadd29744972ec5c5eca228f7a2e326e5 Mon Sep 17 00:00:00 2001 From: Sergey Chebotar Date: Fri, 28 Jan 2022 09:08:35 +0300 Subject: Add convert Tool --- src/Ribbon/RibbonController.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/Ribbon') diff --git a/src/Ribbon/RibbonController.cs b/src/Ribbon/RibbonController.cs index b00e23a..99f44df 100644 --- a/src/Ribbon/RibbonController.cs +++ b/src/Ribbon/RibbonController.cs @@ -20,13 +20,14 @@ namespace RehauSku.Ribbon