From 880b95f8625830e85b9eac816a4cd672d850297b Mon Sep 17 00:00:00 2001 From: Sergey Chebotar Date: Sat, 5 Feb 2022 12:59:16 +0300 Subject: Create EventsUtil --- src/AddIn/EventsUtil.cs | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/AddIn/EventsUtil.cs (limited to 'src/AddIn/EventsUtil.cs') diff --git a/src/AddIn/EventsUtil.cs b/src/AddIn/EventsUtil.cs new file mode 100644 index 0000000..102e12e --- /dev/null +++ b/src/AddIn/EventsUtil.cs @@ -0,0 +1,33 @@ +using Microsoft.Office.Interop.Excel; + +namespace RehauSku +{ + internal static class EventsUtil + { + private static Application Excel = AddIn.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) + { + Interface.RibbonController.RefreshControl("convertPrice"); + } + + private static void RefreshExportButton(object sh, Range target) + { + Interface.RibbonController.RefreshControl("exportToPrice"); + } + } +} -- cgit v1.2.3