Return to ResetStatusBar Excel macro function

This commit is contained in:
Sergey Chebotar 2022-12-23 21:10:43 +03:00
parent 9892b3687f
commit 0ccbf29382
5 changed files with 14 additions and 15 deletions

View File

@ -27,5 +27,11 @@ namespace RhSolutions.AddIn
return result; return result;
} }
[ExcelFunction]
public static void ResetStatusBar()
{
RhSolutionsAddIn.Excel.StatusBar = false;
}
} }
} }

View File

@ -9,13 +9,13 @@ namespace RhSolutions.AddIn
{ {
class RhSolutionsAddIn : IExcelAddIn class RhSolutionsAddIn : IExcelAddIn
{ {
public static Application Excel; public static Application Excel { get; private set; }
public static HttpClient httpClient; public static HttpClient HttpClient { get; private set; }
public void AutoOpen() public void AutoOpen()
{ {
Excel = (Application)ExcelDnaUtil.Application; Excel = (Application)ExcelDnaUtil.Application;
httpClient = new HttpClient(); HttpClient = new HttpClient();
IntelliSenseServer.Install(); IntelliSenseServer.Install();
RegistryUtil.Initialize(); RegistryUtil.Initialize();
EventsUtil.Initialize(); EventsUtil.Initialize();
@ -31,6 +31,7 @@ namespace RhSolutions.AddIn
IntelliSenseServer.Uninstall(); IntelliSenseServer.Uninstall();
RegistryUtil.Uninitialize(); RegistryUtil.Uninitialize();
EventsUtil.Uninitialize(); EventsUtil.Uninitialize();
HttpClient.Dispose();
} }
} }
} }

View File

@ -1,9 +1,6 @@
using ExcelDna.Integration; using Microsoft.Office.Interop.Excel;
using Microsoft.Office.Interop.Excel;
using RhSolutions.AddIn; using RhSolutions.AddIn;
using System; using System;
using System.Threading;
using System.Threading.Tasks;
namespace RhSolutions.Models namespace RhSolutions.Models
{ {
@ -13,14 +10,9 @@ namespace RhSolutions.Models
public abstract void Update(); public abstract void Update();
private static void ResetStatusBar()
{
RhSolutionsAddIn.Excel.StatusBar = false;
}
public void Dispose() public void Dispose()
{ {
Task.Delay(500).ContinueWith(t => ResetStatusBar()); RhSolutionsAddIn.Excel.OnTime(DateTime.Now + new TimeSpan(0, 0, 5), "ResetStatusBar");
} }
} }
} }

View File

@ -97,7 +97,7 @@
<Compile Include="Models\TargetPriceList.cs" /> <Compile Include="Models\TargetPriceList.cs" />
<Compile Include="Controllers\RibbonController.cs" /> <Compile Include="Controllers\RibbonController.cs" />
<Compile Include="Controllers\ExportTool.cs" /> <Compile Include="Controllers\ExportTool.cs" />
<Compile Include="AddIn\AddIn.cs" /> <Compile Include="AddIn\RhSolutionsAddIn.cs" />
<Compile Include="AddIn\Functions.cs" /> <Compile Include="AddIn\Functions.cs" />
<Compile Include="Models\WorksheetExtensions.cs" /> <Compile Include="Models\WorksheetExtensions.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />

View File

@ -11,7 +11,7 @@ namespace RhSolutions.Services
{ {
public static class RhDatabaseClient public static class RhDatabaseClient
{ {
private static HttpClient httpClient = RhSolutionsAddIn.httpClient; private static HttpClient httpClient = RhSolutionsAddIn.HttpClient;
public static async Task<object> GetProduct(string line) public static async Task<object> GetProduct(string line)
{ {