Add settings registry keys

This commit is contained in:
Sergey Chebotar 2021-12-06 17:44:33 +03:00
parent 8bc62a6f02
commit d47e5d5282

View File

@ -1,6 +1,8 @@
using ExcelDna.Integration; using ExcelDna.Integration;
using ExcelDna.Registration; using ExcelDna.Registration;
using Microsoft.Win32;
using System.Net.Http; using System.Net.Http;
using System.IO;
namespace Rehau.Sku.Assist namespace Rehau.Sku.Assist
{ {
@ -17,15 +19,17 @@ namespace Rehau.Sku.Assist
{ {
public static readonly HttpClient httpClient = new HttpClient(); public static readonly HttpClient httpClient = new HttpClient();
public static ResponseOrder responseOrder; public static ResponseOrder responseOrder;
public string priceListPath;
public void AutoOpen() public void AutoOpen()
{ {
RegisterFunctions(); RegisterFunctions();
responseOrder = ResponseOrder.NoSettings; GetRegistryKeys();
} }
public void AutoClose() public void AutoClose()
{ {
} }
void RegisterFunctions() void RegisterFunctions()
@ -34,5 +38,18 @@ namespace Rehau.Sku.Assist
.ProcessAsyncRegistrations(nativeAsyncIfAvailable: false) .ProcessAsyncRegistrations(nativeAsyncIfAvailable: false)
.RegisterFunctions(); .RegisterFunctions();
} }
void GetRegistryKeys()
{
RegistryKey addInKeys = Registry
.CurrentUser
.OpenSubKey("SOFTWARE")
.OpenSubKey("REHAU")
.OpenSubKey("SkuAssist");
responseOrder = (ResponseOrder)addInKeys.GetValue("ResponseOrder");
priceListPath = (string)addInKeys.GetValue("PriceListPath");
}
} }
} }