RhSolutions-AddIn/RhSolutions.AddIn/Services/EventsUtil.cs
2023-03-22 08:36:13 +03:00

36 lines
1.0 KiB
C#

using Microsoft.Office.Interop.Excel;
using RhSolutions.AddIn;
using RhSolutions.Controllers;
namespace RhSolutions.Services
{
internal static class EventsUtil
{
private static readonly Application Excel = RhSolutionsAddIn.Excel;
public static void Initialize()
{
Excel.SheetSelectionChange += RefreshExportButton;
Excel.SheetActivate += RefreshConvertButton;
Excel.WorkbookActivate += RefreshConvertButton;
}
public static void Uninitialize()
{
Excel.SheetSelectionChange -= RefreshExportButton;
Excel.SheetActivate -= RefreshConvertButton;
Excel.WorkbookActivate -= RefreshConvertButton;
}
private static void RefreshConvertButton(object sh)
{
RibbonController.RefreshControl("convert");
}
private static void RefreshExportButton(object sh, Range target)
{
RibbonController.RefreshControl("export");
}
}
}