2022-02-05 12:59:16 +03:00
|
|
|
|
using Microsoft.Office.Interop.Excel;
|
2022-12-20 12:41:46 +03:00
|
|
|
|
using RhSolutions.AddIn;
|
2022-12-20 12:27:47 +03:00
|
|
|
|
using RhSolutions.Controllers;
|
2023-03-28 07:25:10 +03:00
|
|
|
|
using System.Configuration;
|
2023-04-06 08:29:39 +03:00
|
|
|
|
#if !NET472
|
|
|
|
|
using System.Runtime.Versioning;
|
|
|
|
|
#endif
|
2022-02-05 12:59:16 +03:00
|
|
|
|
|
2023-04-06 08:29:39 +03:00
|
|
|
|
namespace RhSolutions.Tools
|
2022-02-05 12:59:16 +03:00
|
|
|
|
{
|
2023-04-06 08:29:39 +03:00
|
|
|
|
#if !NET472
|
|
|
|
|
[SupportedOSPlatform("windows")]
|
|
|
|
|
#endif
|
2022-02-05 12:59:16 +03:00
|
|
|
|
internal static class EventsUtil
|
|
|
|
|
{
|
|
|
|
|
public static void Initialize()
|
|
|
|
|
{
|
2023-03-28 07:55:45 +03:00
|
|
|
|
RhSolutionsAddIn.Excel.SheetSelectionChange += RefreshExportButton;
|
|
|
|
|
RhSolutionsAddIn.Excel.SheetActivate += RefreshConvertButton;
|
|
|
|
|
RhSolutionsAddIn.Excel.WorkbookActivate += RefreshConvertButton;
|
2023-03-28 07:25:10 +03:00
|
|
|
|
RhSolutionsAddIn.Configuration.OnSettingsChange += RefreshSettingTitle;
|
2022-02-05 12:59:16 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void Uninitialize()
|
|
|
|
|
{
|
2023-03-28 07:55:45 +03:00
|
|
|
|
RhSolutionsAddIn.Excel.SheetSelectionChange -= RefreshExportButton;
|
|
|
|
|
RhSolutionsAddIn.Excel.SheetActivate -= RefreshConvertButton;
|
|
|
|
|
RhSolutionsAddIn.Excel.WorkbookActivate -= RefreshConvertButton;
|
2023-03-28 07:25:10 +03:00
|
|
|
|
RhSolutionsAddIn.Configuration.OnSettingsChange -= RefreshSettingTitle;
|
2022-02-05 12:59:16 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void RefreshConvertButton(object sh)
|
|
|
|
|
{
|
2022-12-20 12:27:47 +03:00
|
|
|
|
RibbonController.RefreshControl("convert");
|
2022-02-05 12:59:16 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void RefreshExportButton(object sh, Range target)
|
|
|
|
|
{
|
2022-12-20 12:27:47 +03:00
|
|
|
|
RibbonController.RefreshControl("export");
|
2022-02-05 12:59:16 +03:00
|
|
|
|
}
|
2023-03-28 07:25:10 +03:00
|
|
|
|
|
|
|
|
|
private static void RefreshSettingTitle(object sender, SettingChangingEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
RibbonController.RefreshControl("setPriceList");
|
|
|
|
|
}
|
2022-02-05 12:59:16 +03:00
|
|
|
|
}
|
|
|
|
|
}
|