aboutsummaryrefslogtreecommitdiff
path: root/Source/AddIn/RegistryUtil.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Source/AddIn/RegistryUtil.cs')
-rw-r--r--Source/AddIn/RegistryUtil.cs76
1 files changed, 76 insertions, 0 deletions
diff --git a/Source/AddIn/RegistryUtil.cs b/Source/AddIn/RegistryUtil.cs
new file mode 100644
index 0000000..105d5af
--- /dev/null
+++ b/Source/AddIn/RegistryUtil.cs
@@ -0,0 +1,76 @@
+using Microsoft.Win32;
+
+namespace RehauSku
+{
+ static class RegistryUtil
+ {
+ public static string PriceListPath
+ {
+ get
+ {
+ _GetRootKey();
+
+ if (_RootKey == null)
+ {
+ return @"D:\Dropbox\Рабочее\Таблица заказов ИС EAE_2021.xlsm";
+ }
+
+ else return (string)_RootKey.GetValue("PriceListPath");
+ }
+
+ private set
+ {
+ _GetRootKey();
+
+ if (_RootKey == null)
+ {
+ RegistryKey PriceListPath = Registry.CurrentUser
+ .CreateSubKey("SOFTWARE")
+ .CreateSubKey("REHAU")
+ .CreateSubKey("SkuAssist");
+ }
+
+ _RootKey.SetValue("PriceListPath", value);
+ }
+ }
+
+ public static ResponseOrder StoreResponseOrder
+ {
+ get
+ {
+ _GetRootKey();
+
+ if (_RootKey == null)
+ {
+ return ResponseOrder.Default;
+ }
+
+ return (ResponseOrder)_RootKey.GetValue("ResponseOrder");
+ }
+
+ private set
+ {
+ if (_RootKey == null)
+ {
+ RegistryKey PriceListPath = Registry.CurrentUser
+ .CreateSubKey("SOFTWARE")
+ .CreateSubKey("REHAU")
+ .CreateSubKey("SkuAssist");
+ }
+
+ _RootKey.SetValue("ResponseOrder", value);
+ }
+ }
+
+ private static RegistryKey _RootKey { get; set; }
+
+ private static void _GetRootKey()
+ {
+ _RootKey = Registry
+ .CurrentUser
+ .OpenSubKey("SOFTWARE")
+ .OpenSubKey("REHAU")
+ .OpenSubKey("SkuAssist");
+ }
+ }
+}