diff --git a/RhSolutions.AddIn/Controllers/RibbonController.cs b/RhSolutions.AddIn/Controllers/RibbonController.cs index f7fdd1d..b33f6d6 100644 --- a/RhSolutions.AddIn/Controllers/RibbonController.cs +++ b/RhSolutions.AddIn/Controllers/RibbonController.cs @@ -1,16 +1,10 @@ using ExcelDna.Integration.CustomUI; +using System.IO; using System.Reflection; using System.Runtime.InteropServices; -#if! NET472 -using System.Runtime.Versioning; -#endif -using System.Windows.Forms; namespace RhSolutions.Controllers; -#if !NET472 -[SupportedOSPlatform("windows")] -#endif [ComVisible(true)] public class RibbonController : ExcelRibbon { @@ -114,7 +108,7 @@ public class RibbonController : ExcelRibbon public string GetPriceListPathLabel(IRibbonControl control) { string name = RhSolutionsAddIn.Configuration.GetPriceListFileName(); - return string.IsNullOrEmpty(name) ? "Шаблонный файл" : name; + return string.IsNullOrEmpty(name) ? "Указать шаблонный файл" : name; } public static void UpdateWorkbookValidation() @@ -128,4 +122,13 @@ public class RibbonController : ExcelRibbon _workbookIsValid = worksheet.IsValidSource(); } } + + public static void EnsurePriseListExists() + { + string pricelistPath = RhSolutionsAddIn.Configuration.GetPriceListPath(); + if (!File.Exists(pricelistPath)) + { + RhSolutionsAddIn.Configuration.SetPriceListPath(string.Empty); + } + } } diff --git a/RhSolutions.AddIn/Tools/EventsUtil.cs b/RhSolutions.AddIn/Tools/EventsUtil.cs index 6723835..5522c10 100644 --- a/RhSolutions.AddIn/Tools/EventsUtil.cs +++ b/RhSolutions.AddIn/Tools/EventsUtil.cs @@ -1,17 +1,12 @@ using RhSolutions.Controllers; -#if !NET472 -using System.Runtime.Versioning; -#endif namespace RhSolutions.Tools; -#if !NET472 -[SupportedOSPlatform("windows")] -#endif internal static class EventsUtil { public static void Initialize() { + RibbonController.EnsurePriseListExists(); RhSolutionsAddIn.Excel.SheetSelectionChange += RefreshExportButton; RhSolutionsAddIn.Excel.SheetActivate += RefreshButtons; RhSolutionsAddIn.Excel.WorkbookActivate += RefreshButtons;