aboutsummaryrefslogtreecommitdiff
path: root/src/Ribbon
diff options
context:
space:
mode:
Diffstat (limited to 'src/Ribbon')
-rw-r--r--src/Ribbon/RibbonController.cs58
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)