From d47e5d5282e89d1fcc69bf3907aa459277fcc104 Mon Sep 17 00:00:00 2001 From: Sergey Chebotar Date: Mon, 6 Dec 2021 17:44:33 +0300 Subject: [PATCH] Add settings registry keys --- Source/ExcelDNA/AddIn.cs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Source/ExcelDNA/AddIn.cs b/Source/ExcelDNA/AddIn.cs index 25e5bfd..8a25799 100644 --- a/Source/ExcelDNA/AddIn.cs +++ b/Source/ExcelDNA/AddIn.cs @@ -1,6 +1,8 @@ using ExcelDna.Integration; using ExcelDna.Registration; +using Microsoft.Win32; using System.Net.Http; +using System.IO; namespace Rehau.Sku.Assist { @@ -17,15 +19,17 @@ namespace Rehau.Sku.Assist { public static readonly HttpClient httpClient = new HttpClient(); public static ResponseOrder responseOrder; + public string priceListPath; public void AutoOpen() { RegisterFunctions(); - responseOrder = ResponseOrder.NoSettings; + GetRegistryKeys(); } public void AutoClose() { + } void RegisterFunctions() @@ -34,5 +38,18 @@ namespace Rehau.Sku.Assist .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"); + } + } }