Application Singleton fix
This commit is contained in:
parent
6555d6343f
commit
7bb6ce6c5a
@ -21,7 +21,7 @@ namespace RhSolutions.AddIn
|
|||||||
Services.AddHttpClient()
|
Services.AddHttpClient()
|
||||||
.AddSingleton<IDatabaseClient, RhDatabaseClient>()
|
.AddSingleton<IDatabaseClient, RhDatabaseClient>()
|
||||||
.AddSingleton<IAddInConfiguration, AddInConfiguration>()
|
.AddSingleton<IAddInConfiguration, AddInConfiguration>()
|
||||||
.AddSingleton(ExcelDnaUtil.Application);
|
.AddSingleton((Application)ExcelDnaUtil.Application);
|
||||||
|
|
||||||
ServiceProvider = Services.BuildServiceProvider();
|
ServiceProvider = Services.BuildServiceProvider();
|
||||||
Configuration = ServiceProvider.GetService<IAddInConfiguration>();
|
Configuration = ServiceProvider.GetService<IAddInConfiguration>();
|
||||||
|
@ -7,21 +7,19 @@ namespace RhSolutions.Services
|
|||||||
{
|
{
|
||||||
internal static class EventsUtil
|
internal static class EventsUtil
|
||||||
{
|
{
|
||||||
private static readonly Application Excel = RhSolutionsAddIn.Excel;
|
|
||||||
|
|
||||||
public static void Initialize()
|
public static void Initialize()
|
||||||
{
|
{
|
||||||
Excel.SheetSelectionChange += RefreshExportButton;
|
RhSolutionsAddIn.Excel.SheetSelectionChange += RefreshExportButton;
|
||||||
Excel.SheetActivate += RefreshConvertButton;
|
RhSolutionsAddIn.Excel.SheetActivate += RefreshConvertButton;
|
||||||
Excel.WorkbookActivate += RefreshConvertButton;
|
RhSolutionsAddIn.Excel.WorkbookActivate += RefreshConvertButton;
|
||||||
RhSolutionsAddIn.Configuration.OnSettingsChange += RefreshSettingTitle;
|
RhSolutionsAddIn.Configuration.OnSettingsChange += RefreshSettingTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Uninitialize()
|
public static void Uninitialize()
|
||||||
{
|
{
|
||||||
Excel.SheetSelectionChange -= RefreshExportButton;
|
RhSolutionsAddIn.Excel.SheetSelectionChange -= RefreshExportButton;
|
||||||
Excel.SheetActivate -= RefreshConvertButton;
|
RhSolutionsAddIn.Excel.SheetActivate -= RefreshConvertButton;
|
||||||
Excel.WorkbookActivate -= RefreshConvertButton;
|
RhSolutionsAddIn.Excel.WorkbookActivate -= RefreshConvertButton;
|
||||||
RhSolutionsAddIn.Configuration.OnSettingsChange -= RefreshSettingTitle;
|
RhSolutionsAddIn.Configuration.OnSettingsChange -= RefreshSettingTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user