blob: 40d0ec297d456ecabfd4fcfbcfc11184c8183863 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
using Microsoft.Win32;
using System.IO;
using RehauSku.Forms;
using System.Windows.Forms;
namespace RehauSku
{
static class RegistryUtil
{
private static string _priceListPath;
private static int? _storeResponseOrder;
private static RegistryKey _RootKey { get; set; }
public static void Initialize()
{
_RootKey = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\REHAU\SkuAssist");
_priceListPath = _RootKey.GetValue("PriceListPath") as string;
_storeResponseOrder = _RootKey.GetValue("StoreResponseOrder") as int?;
}
public static void Uninitialize()
{
_RootKey.Close();
}
public static bool IsPriceListPathEmpty()
{
return string.IsNullOrEmpty(_priceListPath);
}
public static string PriceListPath
{
get
{
if (IsPriceListPathEmpty() || !File.Exists(_priceListPath))
{
MessageBox.Show("Прайс-лист отсутствует или неверный файл прайс-листа", "Укажите файл прайс-листа", MessageBoxButtons.OK, MessageBoxIcon.Warning);
string fileName = Dialog.GetFilePath();
_priceListPath = fileName;
_RootKey.SetValue("PriceListPath", fileName);
return _priceListPath;
}
else
{
return _priceListPath;
}
}
set
{
_priceListPath = value;
_RootKey.SetValue("PriceListPath", value);
}
}
public static ResponseOrder StoreResponseOrder
{
get
{
if (_storeResponseOrder == null)
{
_RootKey.SetValue("StoreResponseOrder", (int)ResponseOrder.Default);
_storeResponseOrder = (int)ResponseOrder.Default;
return (ResponseOrder)_storeResponseOrder.Value;
}
else
{
return (ResponseOrder)_storeResponseOrder.Value;
}
}
}
}
}
|