2021-11-29 15:50:24 +03:00
|
|
|
|
using ExcelDna.Integration;
|
2021-12-13 20:39:41 +03:00
|
|
|
|
using ExcelDna.IntelliSense;
|
2021-11-29 15:50:24 +03:00
|
|
|
|
using ExcelDna.Registration;
|
2022-01-09 15:47:54 +03:00
|
|
|
|
using Microsoft.Office.Interop.Excel;
|
2021-12-03 12:57:22 +03:00
|
|
|
|
using System.Net.Http;
|
2021-12-24 16:22:03 +03:00
|
|
|
|
using System.Runtime.Caching;
|
|
|
|
|
|
2021-11-29 15:50:24 +03:00
|
|
|
|
|
2021-12-08 14:45:14 +03:00
|
|
|
|
namespace RehauSku
|
2021-11-29 15:50:24 +03:00
|
|
|
|
{
|
2022-02-02 18:10:29 +03:00
|
|
|
|
enum ResponseOrder
|
2021-12-05 21:19:28 +03:00
|
|
|
|
{
|
2021-12-07 08:34:48 +03:00
|
|
|
|
Default,
|
2021-12-05 21:19:28 +03:00
|
|
|
|
Relevance,
|
|
|
|
|
Name,
|
|
|
|
|
Price,
|
|
|
|
|
Series
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-02 18:10:29 +03:00
|
|
|
|
class AddIn : IExcelAddIn
|
2021-11-29 15:50:24 +03:00
|
|
|
|
{
|
2021-12-24 16:22:03 +03:00
|
|
|
|
public static HttpClient httpClient;
|
|
|
|
|
public static MemoryCache memoryCache;
|
2022-01-09 15:47:54 +03:00
|
|
|
|
public static Application Excel;
|
2021-12-03 12:57:22 +03:00
|
|
|
|
|
2021-11-29 15:50:24 +03:00
|
|
|
|
public void AutoOpen()
|
|
|
|
|
{
|
2021-12-24 16:22:03 +03:00
|
|
|
|
httpClient = new HttpClient();
|
|
|
|
|
memoryCache = new MemoryCache("RehauSku");
|
2021-11-29 15:50:24 +03:00
|
|
|
|
RegisterFunctions();
|
2021-12-13 20:39:41 +03:00
|
|
|
|
IntelliSenseServer.Install();
|
2021-12-22 17:07:37 +03:00
|
|
|
|
RegistryUtil.Initialize();
|
2022-01-09 15:47:54 +03:00
|
|
|
|
Excel = (Application)ExcelDnaUtil.Application;
|
2021-11-29 15:50:24 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void AutoClose()
|
|
|
|
|
{
|
2021-12-13 20:39:41 +03:00
|
|
|
|
IntelliSenseServer.Uninstall();
|
2021-12-23 15:31:23 +03:00
|
|
|
|
RegistryUtil.Uninitialize();
|
2021-12-24 16:22:03 +03:00
|
|
|
|
memoryCache.Dispose();
|
2021-11-29 15:50:24 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RegisterFunctions()
|
|
|
|
|
{
|
|
|
|
|
ExcelRegistration.GetExcelFunctions()
|
|
|
|
|
.ProcessAsyncRegistrations(nativeAsyncIfAvailable: false)
|
|
|
|
|
.RegisterFunctions();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|