diff options
author | Serghei Cebotari <51533848+schebotar@users.noreply.github.com> | 2022-02-01 20:33:33 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-01 20:33:33 +0300 |
commit | 180807d749f4eb3a16c1f136d42b90ea2945008f (patch) | |
tree | 24298e02436da95fd3b24b98ae61fb2b88c3f7e9 /src/AddIn/RegistryUtil.cs | |
parent | 62cfb27784ce601acf8c45ed8470769d454921db (diff) | |
parent | 7e5020ec253df1d0d32304ba72cdaa62937bb26b (diff) |
Merge pull request #14 from schebotar/dev
Dev
Diffstat (limited to 'src/AddIn/RegistryUtil.cs')
-rw-r--r-- | src/AddIn/RegistryUtil.cs | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/src/AddIn/RegistryUtil.cs b/src/AddIn/RegistryUtil.cs index ceee2fe..3ec6f6a 100644 --- a/src/AddIn/RegistryUtil.cs +++ b/src/AddIn/RegistryUtil.cs @@ -1,8 +1,8 @@ using Microsoft.Win32; -using System.IO; using RehauSku.Forms; +using System; +using System.IO; using System.Windows.Forms; -using ExcelDna.Integration; namespace RehauSku { @@ -24,22 +24,27 @@ namespace RehauSku RootKey.Close(); } - public static bool IsPriceListPathEmpty() - { - return string.IsNullOrEmpty(priceListPath); - } - public static string PriceListPath { get { - if (IsPriceListPathEmpty() || !File.Exists(priceListPath)) + if (string.IsNullOrEmpty(priceListPath) || !File.Exists(priceListPath)) { - //MessageBox.Show("Прайс-лист отсутствует или неверный файл прайс-листа", "Укажите файл прайс-листа", MessageBoxButtons.OK, MessageBoxIcon.Warning); - string fileName = Dialog.GetFilePath(); - priceListPath = fileName; - RootKey.SetValue("PriceListPath", fileName); - return priceListPath; + DialogResult result = MessageBox.Show("Прайс-лист отсутствует или неверный файл шаблона прайс-листа. " + + "Укажите файл шаблона прайс-листа.", + "Нет файла шаблона", + MessageBoxButtons.OK, MessageBoxIcon.Warning); + + if (result == DialogResult.OK) + { + string fileName = Dialog.GetFilePath(); + priceListPath = fileName; + RootKey.SetValue("PriceListPath", fileName); + return priceListPath; + } + + else + throw new Exception("Нет файла шаблона"); } else |