2021-11-29 15:50:24 +03:00
|
|
|
|
using ExcelDna.Integration;
|
|
|
|
|
using ExcelDna.Registration;
|
2021-12-06 17:44:33 +03:00
|
|
|
|
using Microsoft.Win32;
|
2021-12-03 12:57:22 +03:00
|
|
|
|
using System.Net.Http;
|
2021-11-29 15:50:24 +03:00
|
|
|
|
|
2021-12-08 13:58:37 +03:00
|
|
|
|
namespace RehauSku.Assist
|
2021-11-29 15:50:24 +03:00
|
|
|
|
{
|
2021-12-05 21:19:28 +03:00
|
|
|
|
public enum ResponseOrder
|
|
|
|
|
{
|
2021-12-07 08:34:48 +03:00
|
|
|
|
Default,
|
2021-12-05 21:19:28 +03:00
|
|
|
|
Relevance,
|
|
|
|
|
Name,
|
|
|
|
|
Price,
|
|
|
|
|
Series
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-29 15:50:24 +03:00
|
|
|
|
public class AddIn : IExcelAddIn
|
|
|
|
|
{
|
2021-12-05 21:14:33 +03:00
|
|
|
|
public static readonly HttpClient httpClient = new HttpClient();
|
2021-12-05 21:19:28 +03:00
|
|
|
|
public static ResponseOrder responseOrder;
|
2021-12-06 19:50:37 +03:00
|
|
|
|
public static string priceListPath;
|
2021-12-03 12:57:22 +03:00
|
|
|
|
|
2021-11-29 15:50:24 +03:00
|
|
|
|
public void AutoOpen()
|
|
|
|
|
{
|
|
|
|
|
RegisterFunctions();
|
2021-12-06 17:44:33 +03:00
|
|
|
|
GetRegistryKeys();
|
2021-11-29 15:50:24 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void AutoClose()
|
|
|
|
|
{
|
2021-12-06 17:44:33 +03:00
|
|
|
|
|
2021-11-29 15:50:24 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RegisterFunctions()
|
|
|
|
|
{
|
|
|
|
|
ExcelRegistration.GetExcelFunctions()
|
|
|
|
|
.ProcessAsyncRegistrations(nativeAsyncIfAvailable: false)
|
|
|
|
|
.RegisterFunctions();
|
|
|
|
|
}
|
2021-12-06 17:44:33 +03:00
|
|
|
|
|
|
|
|
|
void GetRegistryKeys()
|
|
|
|
|
{
|
|
|
|
|
RegistryKey addInKeys = Registry
|
|
|
|
|
.CurrentUser
|
|
|
|
|
.OpenSubKey("SOFTWARE")
|
|
|
|
|
.OpenSubKey("REHAU")
|
|
|
|
|
.OpenSubKey("SkuAssist");
|
|
|
|
|
|
|
|
|
|
responseOrder = (ResponseOrder)addInKeys.GetValue("ResponseOrder");
|
|
|
|
|
priceListPath = (string)addInKeys.GetValue("PriceListPath");
|
|
|
|
|
}
|
2021-11-29 15:50:24 +03:00
|
|
|
|
}
|
|
|
|
|
}
|