RhSolutions-AddIn/Source/ExcelDNA/AddIn.cs
2021-12-08 13:58:37 +03:00

54 lines
1.3 KiB
C#

using ExcelDna.Integration;
using ExcelDna.Registration;
using Microsoft.Win32;
using System.Net.Http;
namespace RehauSku.Assist
{
public enum ResponseOrder
{
Default,
Relevance,
Name,
Price,
Series
}
public class AddIn : IExcelAddIn
{
public static readonly HttpClient httpClient = new HttpClient();
public static ResponseOrder responseOrder;
public static string priceListPath;
public void AutoOpen()
{
RegisterFunctions();
GetRegistryKeys();
}
public void AutoClose()
{
}
void RegisterFunctions()
{
ExcelRegistration.GetExcelFunctions()
.ProcessAsyncRegistrations(nativeAsyncIfAvailable: false)
.RegisterFunctions();
}
void GetRegistryKeys()
{
RegistryKey addInKeys = Registry
.CurrentUser
.OpenSubKey("SOFTWARE")
.OpenSubKey("REHAU")
.OpenSubKey("SkuAssist");
responseOrder = (ResponseOrder)addInKeys.GetValue("ResponseOrder");
priceListPath = (string)addInKeys.GetValue("PriceListPath");
}
}
}