36 lines
960 B
C#
36 lines
960 B
C#
using ExcelDna.Integration;
|
|
using ExcelDna.IntelliSense;
|
|
using Microsoft.Office.Interop.Excel;
|
|
using RhSolutions.Services;
|
|
using System.Net;
|
|
using System.Net.Http;
|
|
|
|
namespace RhSolutions.AddIn
|
|
{
|
|
class RhSolutionsAddIn : IExcelAddIn
|
|
{
|
|
public static Application Excel { get; private set; }
|
|
public static HttpClient HttpClient { get; private set; }
|
|
|
|
public void AutoOpen()
|
|
{
|
|
Excel = (Application)ExcelDnaUtil.Application;
|
|
HttpClient = new HttpClient();
|
|
IntelliSenseServer.Install();
|
|
RegistryUtil.Initialize();
|
|
EventsUtil.Initialize();
|
|
|
|
ServicePointManager.SecurityProtocol =
|
|
SecurityProtocolType.Tls12;
|
|
}
|
|
|
|
public void AutoClose()
|
|
{
|
|
IntelliSenseServer.Uninstall();
|
|
RegistryUtil.Uninitialize();
|
|
EventsUtil.Uninitialize();
|
|
HttpClient.Dispose();
|
|
}
|
|
}
|
|
}
|