Do not delete template path on registry key if cancel pick template dialog

This commit is contained in:
Sergey Chebotar 2022-02-02 18:34:32 +03:00
parent 9018d7d504
commit 5001219695
3 changed files with 13 additions and 3 deletions

View File

@ -38,6 +38,12 @@ namespace RehauSku
if (result == DialogResult.OK) if (result == DialogResult.OK)
{ {
string fileName = Dialog.GetFilePath(); string fileName = Dialog.GetFilePath();
if (string.IsNullOrEmpty(fileName))
{
throw new Exception("Нет файла шаблона");
}
priceListPath = fileName; priceListPath = fileName;
RootKey.SetValue("PriceListPath", fileName); RootKey.SetValue("PriceListPath", fileName);
return priceListPath; return priceListPath;

View File

@ -16,9 +16,9 @@ namespace RehauSku.Interface
{ {
return dialog.FileName; return dialog.FileName;
} }
}
return string.Empty; else return string.Empty;
}
} }
public static string[] GetMultiplyFiles() public static string[] GetMultiplyFiles()

View File

@ -91,7 +91,11 @@ namespace RehauSku.Interface
public void OnSetPricePressed(IRibbonControl control) public void OnSetPricePressed(IRibbonControl control)
{ {
string path = Dialog.GetFilePath(); string path = Dialog.GetFilePath();
if (!string.IsNullOrEmpty(path))
{
RegistryUtil.PriceListPath = path; RegistryUtil.PriceListPath = path;
} }
} }
} }
}