From 0258eb4d2bf82c03be2b0eb2deed5643bb78843e Mon Sep 17 00:00:00 2001 From: Sergey Chebotar Date: Wed, 2 Feb 2022 18:10:29 +0300 Subject: Incapsulate some classes --- src/AddIn/AddIn.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/AddIn/AddIn.cs') diff --git a/src/AddIn/AddIn.cs b/src/AddIn/AddIn.cs index 93d8aec..b0fcc3b 100644 --- a/src/AddIn/AddIn.cs +++ b/src/AddIn/AddIn.cs @@ -8,7 +8,7 @@ using System.Runtime.Caching; namespace RehauSku { - public enum ResponseOrder + enum ResponseOrder { Default, Relevance, @@ -17,7 +17,7 @@ namespace RehauSku Series } - public class AddIn : IExcelAddIn + class AddIn : IExcelAddIn { public static HttpClient httpClient; public static MemoryCache memoryCache; -- cgit v1.2.3 From cc96e1ebe7255c7278c70cef0f951103e9844487 Mon Sep 17 00:00:00 2001 From: Sergey Chebotar Date: Fri, 4 Feb 2022 17:13:47 +0300 Subject: Implement Enable/Disable tools buttons events --- src/AddIn/AddIn.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/AddIn/AddIn.cs') diff --git a/src/AddIn/AddIn.cs b/src/AddIn/AddIn.cs index b0fcc3b..ad77247 100644 --- a/src/AddIn/AddIn.cs +++ b/src/AddIn/AddIn.cs @@ -31,6 +31,24 @@ namespace RehauSku IntelliSenseServer.Install(); RegistryUtil.Initialize(); Excel = (Application)ExcelDnaUtil.Application; + AddEvents(); + } + + private void AddEvents() + { + Excel.SheetSelectionChange += RefreshExportButton; + Excel.SheetActivate += RefreshConvertButton; + Excel.WorkbookActivate += RefreshConvertButton; + } + + private void RefreshConvertButton(object sh) + { + Interface.RibbonController.RefreshControl("convertPrice"); + } + + private void RefreshExportButton(object sh, Range target) + { + Interface.RibbonController.RefreshControl("exportToPrice"); } public void AutoClose() -- cgit v1.2.3 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/AddIn.cs | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) (limited to 'src/AddIn/AddIn.cs') diff --git a/src/AddIn/AddIn.cs b/src/AddIn/AddIn.cs index ad77247..b532bfb 100644 --- a/src/AddIn/AddIn.cs +++ b/src/AddIn/AddIn.cs @@ -5,7 +5,6 @@ using Microsoft.Office.Interop.Excel; using System.Net.Http; using System.Runtime.Caching; - namespace RehauSku { enum ResponseOrder @@ -27,34 +26,18 @@ namespace RehauSku { httpClient = new HttpClient(); memoryCache = new MemoryCache("RehauSku"); + Excel = (Application)ExcelDnaUtil.Application; RegisterFunctions(); IntelliSenseServer.Install(); RegistryUtil.Initialize(); - Excel = (Application)ExcelDnaUtil.Application; - AddEvents(); - } - - private void AddEvents() - { - Excel.SheetSelectionChange += RefreshExportButton; - Excel.SheetActivate += RefreshConvertButton; - Excel.WorkbookActivate += RefreshConvertButton; - } - - private void RefreshConvertButton(object sh) - { - Interface.RibbonController.RefreshControl("convertPrice"); - } - - private void RefreshExportButton(object sh, Range target) - { - Interface.RibbonController.RefreshControl("exportToPrice"); + EventsUtil.Initialize(); } public void AutoClose() { IntelliSenseServer.Uninstall(); RegistryUtil.Uninitialize(); + EventsUtil.Uninitialize(); memoryCache.Dispose(); } -- cgit v1.2.3