From 7e5020ec253df1d0d32304ba72cdaa62937bb26b Mon Sep 17 00:00:00 2001 From: Sergey Chebotar Date: Tue, 1 Feb 2022 20:32:29 +0300 Subject: Refactoring, Not fount table formatting etc --- src/AddIn/RegistryUtil.cs | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) (limited to 'src/AddIn') 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 -- cgit v1.2.3