RhSolutions-AddIn/RhSolutions.AddIn/Tools/EventsUtil.cs

47 lines
1.4 KiB
C#
Raw Normal View History

2023-11-12 16:31:26 +03:00
using RhSolutions.Controllers;
2022-02-05 12:59:16 +03:00
2023-11-12 16:31:26 +03:00
namespace RhSolutions.Tools;
internal static class EventsUtil
{
2024-11-13 23:42:28 +03:00
public static void Initialize()
{
RibbonController.EnsurePriseListExists();
RhSolutionsAddIn.Excel.SheetSelectionChange += RefreshExportButton;
RhSolutionsAddIn.Excel.SheetActivate += RefreshButtons;
RhSolutionsAddIn.Excel.WorkbookActivate += RefreshButtons;
2024-11-14 00:16:03 +03:00
RhSolutionsAddIn.Excel.WorkbookDeactivate += RefreshButtons;
2024-11-13 23:42:28 +03:00
RhSolutionsAddIn.Configuration.OnSettingsChange += RefreshSettingTitle;
}
2022-02-05 12:59:16 +03:00
2024-11-13 23:42:28 +03:00
public static void Uninitialize()
{
RhSolutionsAddIn.Excel.SheetSelectionChange -= RefreshExportButton;
RhSolutionsAddIn.Excel.SheetActivate -= RefreshButtons;
RhSolutionsAddIn.Excel.WorkbookActivate -= RefreshButtons;
2024-11-14 00:16:03 +03:00
RhSolutionsAddIn.Excel.WorkbookDeactivate -= RefreshButtons;
2024-11-13 23:42:28 +03:00
RhSolutionsAddIn.Configuration.OnSettingsChange -= RefreshSettingTitle;
}
2022-02-05 12:59:16 +03:00
2024-11-13 23:42:28 +03:00
private static void RefreshButtons(object sh)
{
RibbonController.UpdateWorkbookValidation();
RibbonController.RefreshControl("convert");
RibbonController.RefreshControl("dxfexport");
RibbonController.RefreshControl("guess");
RibbonController.RefreshControl("fillsleeves");
RibbonController.RefreshControl("fillcouplings");
RibbonController.RefreshControl("ocr");
}
2023-04-07 08:10:51 +03:00
2024-11-13 23:42:28 +03:00
private static void RefreshExportButton(object sh, Range target)
{
RibbonController.RefreshControl("export");
}
2023-03-28 07:25:10 +03:00
2024-11-13 23:42:28 +03:00
private static void RefreshSettingTitle()
{
RibbonController.RefreshControl("setPriceList");
}
2022-02-05 12:59:16 +03:00
}