diff --git a/RhSolutions.AddIn/AddIn/RhSolutionsAddIn.cs b/RhSolutions.AddIn/AddIn/RhSolutionsAddIn.cs index 58002ee..aad1302 100644 --- a/RhSolutions.AddIn/AddIn/RhSolutionsAddIn.cs +++ b/RhSolutions.AddIn/AddIn/RhSolutionsAddIn.cs @@ -21,7 +21,7 @@ namespace RhSolutions.AddIn Services.AddHttpClient() .AddSingleton() .AddSingleton() - .AddSingleton(ExcelDnaUtil.Application); + .AddSingleton((Application)ExcelDnaUtil.Application); ServiceProvider = Services.BuildServiceProvider(); Configuration = ServiceProvider.GetService(); diff --git a/RhSolutions.AddIn/Services/EventsUtil.cs b/RhSolutions.AddIn/Services/EventsUtil.cs index 7d96d23..bd7dd7b 100644 --- a/RhSolutions.AddIn/Services/EventsUtil.cs +++ b/RhSolutions.AddIn/Services/EventsUtil.cs @@ -7,21 +7,19 @@ namespace RhSolutions.Services { internal static class EventsUtil { - private static readonly Application Excel = RhSolutionsAddIn.Excel; - public static void Initialize() { - Excel.SheetSelectionChange += RefreshExportButton; - Excel.SheetActivate += RefreshConvertButton; - Excel.WorkbookActivate += RefreshConvertButton; + RhSolutionsAddIn.Excel.SheetSelectionChange += RefreshExportButton; + RhSolutionsAddIn.Excel.SheetActivate += RefreshConvertButton; + RhSolutionsAddIn.Excel.WorkbookActivate += RefreshConvertButton; RhSolutionsAddIn.Configuration.OnSettingsChange += RefreshSettingTitle; } public static void Uninitialize() { - Excel.SheetSelectionChange -= RefreshExportButton; - Excel.SheetActivate -= RefreshConvertButton; - Excel.WorkbookActivate -= RefreshConvertButton; + RhSolutionsAddIn.Excel.SheetSelectionChange -= RefreshExportButton; + RhSolutionsAddIn.Excel.SheetActivate -= RefreshConvertButton; + RhSolutionsAddIn.Excel.WorkbookActivate -= RefreshConvertButton; RhSolutionsAddIn.Configuration.OnSettingsChange -= RefreshSettingTitle; }