aboutsummaryrefslogtreecommitdiff
path: root/src/Services/EventsUtil.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Services/EventsUtil.cs')
-rw-r--r--src/Services/EventsUtil.cs34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/Services/EventsUtil.cs b/src/Services/EventsUtil.cs
new file mode 100644
index 0000000..4b1d923
--- /dev/null
+++ b/src/Services/EventsUtil.cs
@@ -0,0 +1,34 @@
+using Microsoft.Office.Interop.Excel;
+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");
+ }
+ }
+}