aboutsummaryrefslogtreecommitdiff
path: root/src/AddIn/RegistryUtil.cs
diff options
context:
space:
mode:
authorSergey Chebotar <s.chebotar@gmail.com>2022-02-01 20:32:29 +0300
committerSergey Chebotar <s.chebotar@gmail.com>2022-02-01 20:32:29 +0300
commit7e5020ec253df1d0d32304ba72cdaa62937bb26b (patch)
tree24298e02436da95fd3b24b98ae61fb2b88c3f7e9 /src/AddIn/RegistryUtil.cs
parentcfb15d1279f604cc7387e1e23680ba8a63c9f110 (diff)
Refactoring, Not fount table formatting etc
Diffstat (limited to 'src/AddIn/RegistryUtil.cs')
-rw-r--r--src/AddIn/RegistryUtil.cs31
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