fix windows restart hang

This commit is contained in:
Luke Pulverenti 2015-09-30 00:07:21 -04:00
parent 11754a2fb2
commit 459e483b4e
3 changed files with 25 additions and 11 deletions

View File

@ -158,9 +158,14 @@ namespace MediaBrowser.Common.Implementations.Security
return new SupporterInfo();
}
var url = MbAdmin.HttpsUrl + "/service/supporter/retrieve?key=" + key;
var data = new Dictionary<string, string>
{
{ "key", key },
};
using (var stream = await _httpClient.Get(url, CancellationToken.None).ConfigureAwait(false))
var url = MbAdmin.HttpsUrl + "/service/supporter/retrieve";
using (var stream = await _httpClient.Post(url, data, CancellationToken.None).ConfigureAwait(false))
{
var response = _jsonSerializer.DeserializeFromStream<SuppporterInfoResponse>(stream);

View File

@ -513,23 +513,19 @@ namespace MediaBrowser.ServerApplication
if (!_isRunningAsService)
{
_logger.Info("Hiding server notify icon");
_serverNotifyIcon.Visible = false;
//_logger.Info("Hiding server notify icon");
//_serverNotifyIcon.Visible = false;
_logger.Info("Starting new instance");
//Application.Restart();
Process.Start(_appHost.ServerConfigurationManager.ApplicationPaths.ApplicationPath);
_logger.Info("Calling Environment.Exit");
Environment.Exit(0);
ShutdownWindowsApplication();
}
}
private static void ShutdownWindowsApplication()
{
_logger.Info("Hiding server notify icon");
_serverNotifyIcon.Visible = false;
_logger.Info("Calling Application.Exit");
Application.Exit();

View File

@ -168,6 +168,19 @@ namespace MediaBrowser.ServerApplication
}
notifyIcon1.DoubleClick += notifyIcon1_DoubleClick;
Application.ApplicationExit += Application_ApplicationExit;
}
void Application_ApplicationExit(object sender, EventArgs e)
{
try
{
notifyIcon1.Visible = false;
}
catch
{
}
}
void notifyIcon1_DoubleClick(object sender, EventArgs e)