Application Singleton fix
This commit is contained in:
parent
6555d6343f
commit
7bb6ce6c5a
@ -21,7 +21,7 @@ namespace RhSolutions.AddIn
|
||||
Services.AddHttpClient()
|
||||
.AddSingleton<IDatabaseClient, RhDatabaseClient>()
|
||||
.AddSingleton<IAddInConfiguration, AddInConfiguration>()
|
||||
.AddSingleton(ExcelDnaUtil.Application);
|
||||
.AddSingleton((Application)ExcelDnaUtil.Application);
|
||||
|
||||
ServiceProvider = Services.BuildServiceProvider();
|
||||
Configuration = ServiceProvider.GetService<IAddInConfiguration>();
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user