From 8a869e73fb1873b1f85203b7a4a18dc8a2325a11 Mon Sep 17 00:00:00 2001 From: Sergey Chebotar Date: Wed, 8 Dec 2021 14:38:23 +0300 Subject: Rename dir ExcelDNA -> AddIn --- Source/AddIn/AddIn.cs | 53 ++++++++++++++++++++++++++++++++++++++++++++ Source/AddIn/Functions.cs | 19 ++++++++++++++++ Source/ExcelDNA/AddIn.cs | 53 -------------------------------------------- Source/ExcelDNA/Functions.cs | 19 ---------------- 4 files changed, 72 insertions(+), 72 deletions(-) create mode 100644 Source/AddIn/AddIn.cs create mode 100644 Source/AddIn/Functions.cs delete mode 100644 Source/ExcelDNA/AddIn.cs delete mode 100644 Source/ExcelDNA/Functions.cs (limited to 'Source') diff --git a/Source/AddIn/AddIn.cs b/Source/AddIn/AddIn.cs new file mode 100644 index 0000000..3c82406 --- /dev/null +++ b/Source/AddIn/AddIn.cs @@ -0,0 +1,53 @@ +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"); + } + } +} diff --git a/Source/AddIn/Functions.cs b/Source/AddIn/Functions.cs new file mode 100644 index 0000000..6d94e24 --- /dev/null +++ b/Source/AddIn/Functions.cs @@ -0,0 +1,19 @@ +using ExcelDna.Integration; + +namespace RehauSku.Assist +{ + public class Functions + { + [ExcelFunction] + public static object RAUNAME(string request) + => SkuAssist.GetProduct(request, ProductField.Name); + + [ExcelFunction] + public static object RAUSKU(string request) + => SkuAssist.GetProduct(request, ProductField.Id); + + [ExcelFunction] + public static object RAUPRICE(string request) + => SkuAssist.GetProduct(request, ProductField.Price); + } +} \ No newline at end of file diff --git a/Source/ExcelDNA/AddIn.cs b/Source/ExcelDNA/AddIn.cs deleted file mode 100644 index 3c82406..0000000 --- a/Source/ExcelDNA/AddIn.cs +++ /dev/null @@ -1,53 +0,0 @@ -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"); - } - } -} diff --git a/Source/ExcelDNA/Functions.cs b/Source/ExcelDNA/Functions.cs deleted file mode 100644 index 6d94e24..0000000 --- a/Source/ExcelDNA/Functions.cs +++ /dev/null @@ -1,19 +0,0 @@ -using ExcelDna.Integration; - -namespace RehauSku.Assist -{ - public class Functions - { - [ExcelFunction] - public static object RAUNAME(string request) - => SkuAssist.GetProduct(request, ProductField.Name); - - [ExcelFunction] - public static object RAUSKU(string request) - => SkuAssist.GetProduct(request, ProductField.Id); - - [ExcelFunction] - public static object RAUPRICE(string request) - => SkuAssist.GetProduct(request, ProductField.Price); - } -} \ No newline at end of file -- cgit v1.2.3