diff options
author | Serghei Cebotari <51533848+schebotar@users.noreply.github.com> | 2021-12-24 17:43:04 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-24 17:43:04 +0300 |
commit | 0525ec1b42d5857b740dd0dae7f6d9baeb7088d1 (patch) | |
tree | 5d9c814fd023395d894ce36a9040cf7f7330198c /Source/AddIn/AddIn.cs | |
parent | 8e5db1238ad3ed97f51d9f0a9c7de83c00a12983 (diff) | |
parent | 20cfbfcca3a779c04aecdca5e4b465651e2be42a (diff) |
Merge pull request #8 from schebotar/dev
Dev
Diffstat (limited to 'Source/AddIn/AddIn.cs')
-rw-r--r-- | Source/AddIn/AddIn.cs | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/Source/AddIn/AddIn.cs b/Source/AddIn/AddIn.cs new file mode 100644 index 0000000..67cdcc8 --- /dev/null +++ b/Source/AddIn/AddIn.cs @@ -0,0 +1,47 @@ +using ExcelDna.Integration; +using ExcelDna.IntelliSense; +using ExcelDna.Registration; +using System.Net.Http; +using System.Runtime.Caching; + + +namespace RehauSku +{ + public enum ResponseOrder + { + Default, + Relevance, + Name, + Price, + Series + } + + public class AddIn : IExcelAddIn + { + public static HttpClient httpClient; + public static MemoryCache memoryCache; + + public void AutoOpen() + { + httpClient = new HttpClient(); + memoryCache = new MemoryCache("RehauSku"); + RegisterFunctions(); + IntelliSenseServer.Install(); + RegistryUtil.Initialize(); + } + + public void AutoClose() + { + IntelliSenseServer.Uninstall(); + RegistryUtil.Uninitialize(); + memoryCache.Dispose(); + } + + void RegisterFunctions() + { + ExcelRegistration.GetExcelFunctions() + .ProcessAsyncRegistrations(nativeAsyncIfAvailable: false) + .RegisterFunctions(); + } + } +} |