diff options
author | Sergey Chebotar <s.chebotar@gmail.com> | 2022-12-23 21:10:43 +0300 |
---|---|---|
committer | Sergey Chebotar <s.chebotar@gmail.com> | 2022-12-23 21:10:43 +0300 |
commit | 0ccbf29382b43d19f7ea0d1f4b5841149137842d (patch) | |
tree | f93cc67ffc387e281c2c8f15f4d645cfa40339cf /src | |
parent | 9892b3687f4c896fbaeb85717857f39f5316111c (diff) |
Return to ResetStatusBar Excel macro function
Diffstat (limited to 'src')
-rw-r--r-- | src/AddIn/Functions.cs | 6 | ||||
-rw-r--r-- | src/AddIn/RhSolutionsAddIn.cs (renamed from src/AddIn/AddIn.cs) | 7 | ||||
-rw-r--r-- | src/Models/StatusbarBase.cs | 12 | ||||
-rw-r--r-- | src/RhSolutions.csproj | 2 | ||||
-rw-r--r-- | src/Services/RhDatabaseClient.cs | 2 |
5 files changed, 14 insertions, 15 deletions
diff --git a/src/AddIn/Functions.cs b/src/AddIn/Functions.cs index 2be19fa..0d3aef5 100644 --- a/src/AddIn/Functions.cs +++ b/src/AddIn/Functions.cs @@ -27,5 +27,11 @@ namespace RhSolutions.AddIn return result; } + + [ExcelFunction] + public static void ResetStatusBar() + { + RhSolutionsAddIn.Excel.StatusBar = false; + } } }
\ No newline at end of file diff --git a/src/AddIn/AddIn.cs b/src/AddIn/RhSolutionsAddIn.cs index 2aa71c7..0e51bec 100644 --- a/src/AddIn/AddIn.cs +++ b/src/AddIn/RhSolutionsAddIn.cs @@ -9,13 +9,13 @@ namespace RhSolutions.AddIn { class RhSolutionsAddIn : IExcelAddIn { - public static Application Excel; - public static HttpClient httpClient; + public static Application Excel { get; private set; } + public static HttpClient HttpClient { get; private set; } public void AutoOpen() { Excel = (Application)ExcelDnaUtil.Application; - httpClient = new HttpClient(); + HttpClient = new HttpClient(); IntelliSenseServer.Install(); RegistryUtil.Initialize(); EventsUtil.Initialize(); @@ -31,6 +31,7 @@ namespace RhSolutions.AddIn IntelliSenseServer.Uninstall(); RegistryUtil.Uninitialize(); EventsUtil.Uninitialize(); + HttpClient.Dispose(); } } } diff --git a/src/Models/StatusbarBase.cs b/src/Models/StatusbarBase.cs index 756abe3..8176013 100644 --- a/src/Models/StatusbarBase.cs +++ b/src/Models/StatusbarBase.cs @@ -1,9 +1,6 @@ -using ExcelDna.Integration; -using Microsoft.Office.Interop.Excel; +using Microsoft.Office.Interop.Excel; using RhSolutions.AddIn; using System; -using System.Threading; -using System.Threading.Tasks; namespace RhSolutions.Models { @@ -13,14 +10,9 @@ namespace RhSolutions.Models public abstract void Update(); - private static void ResetStatusBar() - { - RhSolutionsAddIn.Excel.StatusBar = false; - } - public void Dispose() { - Task.Delay(500).ContinueWith(t => ResetStatusBar()); + RhSolutionsAddIn.Excel.OnTime(DateTime.Now + new TimeSpan(0, 0, 5), "ResetStatusBar"); } } } diff --git a/src/RhSolutions.csproj b/src/RhSolutions.csproj index 6fb6587..d88943e 100644 --- a/src/RhSolutions.csproj +++ b/src/RhSolutions.csproj @@ -97,7 +97,7 @@ <Compile Include="Models\TargetPriceList.cs" /> <Compile Include="Controllers\RibbonController.cs" /> <Compile Include="Controllers\ExportTool.cs" /> - <Compile Include="AddIn\AddIn.cs" /> + <Compile Include="AddIn\RhSolutionsAddIn.cs" /> <Compile Include="AddIn\Functions.cs" /> <Compile Include="Models\WorksheetExtensions.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> diff --git a/src/Services/RhDatabaseClient.cs b/src/Services/RhDatabaseClient.cs index 9664361..bfa80ad 100644 --- a/src/Services/RhDatabaseClient.cs +++ b/src/Services/RhDatabaseClient.cs @@ -11,7 +11,7 @@ namespace RhSolutions.Services { public static class RhDatabaseClient { - private static HttpClient httpClient = RhSolutionsAddIn.httpClient; + private static HttpClient httpClient = RhSolutionsAddIn.HttpClient; public static async Task<object> GetProduct(string line) { |