|
@@ -55,16 +55,25 @@ namespace Vinno.FIS.Sonopost
|
|
|
ProcessHelper.FinishProcessByName(SonopostConstants.UpgradeAppName);
|
|
|
AppManager.Instance.Initialize();
|
|
|
Init();
|
|
|
- _webHost = new WebHost();
|
|
|
- _webHost.Start();
|
|
|
+ CreateWebHost();
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
Logger.WriteLineError($"Sonopost Start Up Error:{ex}");
|
|
|
+ SonopostUserDefinedSettings.Instance.Reset();
|
|
|
Process.GetCurrentProcess().Kill();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void CreateWebHost()
|
|
|
+ {
|
|
|
+ if (_webHost == null)
|
|
|
+ {
|
|
|
+ _webHost = new WebHost();
|
|
|
+ _webHost.Start();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private void Init()
|
|
|
{
|
|
|
AppManager.Instance.GetManager<ILoginManager>().Init();
|
|
@@ -239,11 +248,7 @@ namespace Vinno.FIS.Sonopost
|
|
|
_networkManager.CurrentWifiLevelChanged -= OnCurrentWifiLevelChanged;
|
|
|
AppDomain.CurrentDomain.UnhandledException -= CurrentDomainUnhandledException;
|
|
|
SystemEvents.SessionEnded -= OnSessionEnded;
|
|
|
- if (_webHost != null)
|
|
|
- {
|
|
|
- _webHost.Dispose();
|
|
|
- _webHost = null;
|
|
|
- }
|
|
|
+ DisposeWebHost();
|
|
|
AppManager.Instance.DisposeAllManagers();
|
|
|
}
|
|
|
catch (Exception ex)
|
|
@@ -258,5 +263,14 @@ namespace Vinno.FIS.Sonopost
|
|
|
Logger.WriteLineError($"Sonopost Dispose Error:{ex}");
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ private void DisposeWebHost()
|
|
|
+ {
|
|
|
+ if (_webHost != null)
|
|
|
+ {
|
|
|
+ _webHost.Dispose();
|
|
|
+ _webHost = null;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|