diff options
Diffstat (limited to 'src/AddIn/RegistryUtil.cs')
-rw-r--r-- | src/AddIn/RegistryUtil.cs | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/src/AddIn/RegistryUtil.cs b/src/AddIn/RegistryUtil.cs deleted file mode 100644 index e848462..0000000 --- a/src/AddIn/RegistryUtil.cs +++ /dev/null @@ -1,73 +0,0 @@ -using Microsoft.Win32; -using RhSolutions.Interface; -using System; -using System.IO; -using System.Windows.Forms; - -namespace RhSolutions -{ - static class RegistryUtil - { - private static string priceListPath; - private static RegistryKey RootKey { get; set; } - - public static void Initialize() - { - RootKey = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\REHAU\SkuAssist"); - priceListPath = RootKey.GetValue("PriceListPath") as string; - } - - public static void Uninitialize() - { - RootKey.Close(); - } - - public static string PriceListPath - { - get - { - if (string.IsNullOrEmpty(priceListPath) || !File.Exists(priceListPath)) - { - DialogResult result = MessageBox.Show("Прайс-лист отсутствует или неверный файл шаблона прайс-листа. " + - "Укажите файл шаблона прайс-листа.", - "Нет файла шаблона", - MessageBoxButtons.OK, MessageBoxIcon.Warning); - - if (result == DialogResult.OK) - { - string fileName = Dialog.GetFilePath(); - - if (string.IsNullOrEmpty(fileName)) - { - throw new Exception("Нет файла шаблона"); - } - - priceListPath = fileName; - RootKey.SetValue("PriceListPath", fileName); - return priceListPath; - } - - else - throw new Exception("Нет файла шаблона"); - } - - else - { - return priceListPath; - } - } - - set - { - priceListPath = value; - RootKey.SetValue("PriceListPath", value); - RibbonController.RefreshControl("setPriceList"); - } - } - - public static string GetPriceListName() - { - return Path.GetFileName(priceListPath); - } - } -} |