2021-12-05 16:55:36 +03:00
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using ExcelDna.Integration.CustomUI;
|
2021-12-24 16:22:03 +03:00
|
|
|
|
using RehauSku.PriceListTools;
|
|
|
|
|
using RehauSku.Forms;
|
2021-12-05 16:55:36 +03:00
|
|
|
|
|
2021-12-08 14:45:14 +03:00
|
|
|
|
namespace RehauSku.Ribbon
|
2021-12-05 16:55:36 +03:00
|
|
|
|
{
|
|
|
|
|
[ComVisible(true)]
|
|
|
|
|
public class RibbonController : ExcelRibbon
|
|
|
|
|
{
|
|
|
|
|
public override string GetCustomUI(string RibbonID)
|
|
|
|
|
{
|
|
|
|
|
return @"
|
|
|
|
|
<customUI xmlns='http://schemas.microsoft.com/office/2006/01/customui'>
|
|
|
|
|
<ribbon>
|
|
|
|
|
<tabs>
|
2021-12-09 14:08:26 +03:00
|
|
|
|
<tab id='rau' label='REHAU'>
|
|
|
|
|
<group id='priceList' label='Прайс-лист'>
|
2021-12-17 09:07:34 +03:00
|
|
|
|
<button id='exportToPrice' label='Экспорт' size='large' imageMso='PivotExportToExcel' onAction='OnExportPressed'/>
|
2021-12-24 16:22:03 +03:00
|
|
|
|
<button id='mergeFiles' label='Объединить' size='large' imageMso='Copy' onAction='OnMergePressed'/>
|
2021-12-09 14:08:26 +03:00
|
|
|
|
</group>
|
|
|
|
|
<group id='rausettings' label='Настройки'>
|
2021-12-17 09:07:34 +03:00
|
|
|
|
<button id='set' label='Настройки' size='large' imageMso='CurrentViewSettings' onAction='OnSettingsPressed'/>
|
2021-12-09 14:08:26 +03:00
|
|
|
|
</group>
|
2021-12-05 16:55:36 +03:00
|
|
|
|
</tab>
|
|
|
|
|
</tabs>
|
|
|
|
|
</ribbon>
|
|
|
|
|
</customUI>";
|
|
|
|
|
}
|
2021-12-07 08:28:21 +03:00
|
|
|
|
|
2021-12-24 16:22:03 +03:00
|
|
|
|
public void OnMergePressed(IRibbonControl control)
|
|
|
|
|
{
|
|
|
|
|
using (MergeTool mergeTool = new MergeTool())
|
|
|
|
|
{
|
|
|
|
|
string[] files = Dialog.GetMultiplyFiles();
|
|
|
|
|
mergeTool.AddSkuAmountToDict(files);
|
|
|
|
|
string exportFile = PriceListUtil.CreateNewExportFile();
|
|
|
|
|
mergeTool.ExportToNewFile(exportFile);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-17 09:07:34 +03:00
|
|
|
|
public void OnExportPressed(IRibbonControl control)
|
2021-12-07 08:28:21 +03:00
|
|
|
|
{
|
2021-12-24 16:22:03 +03:00
|
|
|
|
using (ExportTool exportTool = new ExportTool())
|
2021-12-07 08:28:21 +03:00
|
|
|
|
{
|
2021-12-24 16:22:03 +03:00
|
|
|
|
if (!exportTool.IsRangeValid())
|
2021-12-07 08:28:21 +03:00
|
|
|
|
{
|
2021-12-17 09:07:34 +03:00
|
|
|
|
MessageBox.Show("Выделен неверный диапазон!",
|
|
|
|
|
"Неверный диапазон",
|
2021-12-10 13:56:28 +03:00
|
|
|
|
MessageBoxButtons.OK,
|
|
|
|
|
MessageBoxIcon.Information);
|
2021-12-07 08:28:21 +03:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
{
|
2021-12-24 16:22:03 +03:00
|
|
|
|
exportTool.ExportToNewFile();
|
2021-12-07 08:28:21 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-12-24 16:22:03 +03:00
|
|
|
|
|
2021-12-17 09:07:34 +03:00
|
|
|
|
public void OnSettingsPressed(IRibbonControl control)
|
|
|
|
|
{
|
2021-12-24 16:22:03 +03:00
|
|
|
|
Form settingsForm = new SettingsForm();
|
|
|
|
|
|
2021-12-22 17:07:37 +03:00
|
|
|
|
settingsForm.Show();
|
2021-12-24 16:22:03 +03:00
|
|
|
|
|
2021-12-17 09:07:34 +03:00
|
|
|
|
}
|
2021-12-05 16:55:36 +03:00
|
|
|
|
}
|
|
|
|
|
}
|