45 lines
1.3 KiB
C#
45 lines
1.3 KiB
C#
using RhSolutions.Controllers;
|
|
|
|
namespace RhSolutions.Tools;
|
|
|
|
internal static class EventsUtil
|
|
{
|
|
public static void Initialize()
|
|
{
|
|
RibbonController.EnsurePriseListExists();
|
|
RhSolutionsAddIn.Excel.SheetSelectionChange += RefreshExportButton;
|
|
RhSolutionsAddIn.Excel.SheetActivate += RefreshButtons;
|
|
RhSolutionsAddIn.Excel.WorkbookActivate += RefreshButtons;
|
|
RhSolutionsAddIn.Configuration.OnSettingsChange += RefreshSettingTitle;
|
|
}
|
|
|
|
public static void Uninitialize()
|
|
{
|
|
RhSolutionsAddIn.Excel.SheetSelectionChange -= RefreshExportButton;
|
|
RhSolutionsAddIn.Excel.SheetActivate -= RefreshButtons;
|
|
RhSolutionsAddIn.Excel.WorkbookActivate -= RefreshButtons;
|
|
RhSolutionsAddIn.Configuration.OnSettingsChange -= RefreshSettingTitle;
|
|
}
|
|
|
|
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");
|
|
}
|
|
|
|
private static void RefreshExportButton(object sh, Range target)
|
|
{
|
|
RibbonController.RefreshControl("export");
|
|
}
|
|
|
|
private static void RefreshSettingTitle()
|
|
{
|
|
RibbonController.RefreshControl("setPriceList");
|
|
}
|
|
}
|