diff options
author | Serghei Cebotari <serghei@cebotari.ru> | 2024-01-21 15:14:35 +0300 |
---|---|---|
committer | Serghei Cebotari <serghei@cebotari.ru> | 2024-01-21 15:14:35 +0300 |
commit | 964bb01a80bb2d6e1046a206716d5852e49c43da (patch) | |
tree | 7fcb40d39bf7fd2896c0ea05dea476b58c2806bd | |
parent | f0fca06beb661b17583eb8259c6943f27f04d87a (diff) |
Revert "Refactoring Excel application field"
This reverts commit 56112eae51349ce88cc4ec0c34f6269cc821f0d0.
-rw-r--r-- | RhSolutions.AddIn/AddIn/RhSolutionsAddIn.cs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/RhSolutions.AddIn/AddIn/RhSolutionsAddIn.cs b/RhSolutions.AddIn/AddIn/RhSolutionsAddIn.cs index 0edfe07..983c0e6 100644 --- a/RhSolutions.AddIn/AddIn/RhSolutionsAddIn.cs +++ b/RhSolutions.AddIn/AddIn/RhSolutionsAddIn.cs @@ -4,7 +4,7 @@ namespace RhSolutions.AddIn; public sealed class RhSolutionsAddIn : IExcelAddIn { - public static readonly Application Excel = (Application)ExcelDnaUtil.Application; + public static Application Excel { get; private set; } public static ServiceProvider ServiceProvider { get; private set; } public static IAddInConfiguration Configuration { get; private set; } @@ -14,6 +14,7 @@ public sealed class RhSolutionsAddIn : IExcelAddIn Services.AddHttpClient() .AddMemoryCache() + .AddSingleton((Application)ExcelDnaUtil.Application) .AddSingleton<IAddInConfiguration, AddInConfiguration>() .AddSingleton<IDatabaseClient, DatabaseClient>() .AddSingleton<ICurrencyClient, CurrencyClient>() @@ -43,6 +44,7 @@ public sealed class RhSolutionsAddIn : IExcelAddIn ServiceProvider = Services.BuildServiceProvider(); Configuration = ServiceProvider.GetService<IAddInConfiguration>(); + Excel = ServiceProvider.GetService<Application>(); EventsUtil.Initialize(); |