aboutsummaryrefslogtreecommitdiff
path: root/src/AddIn/AddIn.cs
diff options
context:
space:
mode:
authorSergey Chebotar <s.chebotar@gmail.com>2021-12-26 18:22:32 +0300
committerSergey Chebotar <s.chebotar@gmail.com>2021-12-26 18:22:32 +0300
commit54fc3320e7d64d7903b4d091fe0d5c15df01fd78 (patch)
treeac8b9aa1e883a85339a594b2797ab319cca73c4e /src/AddIn/AddIn.cs
parent20cfbfcca3a779c04aecdca5e4b465651e2be42a (diff)
Move to /src
Diffstat (limited to 'src/AddIn/AddIn.cs')
-rw-r--r--src/AddIn/AddIn.cs47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/AddIn/AddIn.cs b/src/AddIn/AddIn.cs
new file mode 100644
index 0000000..67cdcc8
--- /dev/null
+++ b/src/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();
+ }
+ }
+}