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

44 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
{
public static void Initialize()
2022-02-05 12:59:16 +03:00
{
2024-02-22 18:09:27 +03:00
RibbonController.EnsurePriseListExists();
2023-11-12 16:31:26 +03:00
RhSolutionsAddIn.Excel.SheetSelectionChange += RefreshExportButton;
RhSolutionsAddIn.Excel.SheetActivate += RefreshButtons;
RhSolutionsAddIn.Excel.WorkbookActivate += RefreshButtons;
RhSolutionsAddIn.Configuration.OnSettingsChange += RefreshSettingTitle;
}
2022-02-05 12:59:16 +03:00
2023-11-12 16:31:26 +03:00
public static void Uninitialize()
{
RhSolutionsAddIn.Excel.SheetSelectionChange -= RefreshExportButton;
RhSolutionsAddIn.Excel.SheetActivate -= RefreshButtons;
RhSolutionsAddIn.Excel.WorkbookActivate -= RefreshButtons;
RhSolutionsAddIn.Configuration.OnSettingsChange -= RefreshSettingTitle;
}
2022-02-05 12:59:16 +03:00
2023-11-12 16:31:26 +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");
}
2023-04-07 08:10:51 +03:00
2023-11-12 16:31:26 +03:00
private static void RefreshExportButton(object sh, Range target)
{
RibbonController.RefreshControl("export");
}
2023-03-28 07:25:10 +03:00
2023-11-12 16:31:26 +03:00
private static void RefreshSettingTitle()
{
RibbonController.RefreshControl("setPriceList");
2022-02-05 12:59:16 +03:00
}
}