Skip to content

The Free Software Media System - Server Backend & API

As session switch can't launch browser and sessionending does nothing in window service mode, moved the events handler to run only in interactive mode

Michaelb2550f6dd34b
diff --git a/MediaBrowser.ServerApplication/MainStartup.cs b/MediaBrowser.ServerApplication/MainStartup.cs
index ffb6a9add1..4c81716ed5 100644
--- a/MediaBrowser.ServerApplication/MainStartup.cs
+++ b/MediaBrowser.ServerApplication/MainStartup.cs
@@ -226,8 +226,6 @@ namespace MediaBrowser.ServerApplication
ErrorModes.SEM_NOGPFAULTERRORBOX | ErrorModes.SEM_NOOPENFILEERRORBOX);
}
- SystemEvents.SessionEnding += SystemEvents_SessionEnding;
- SystemEvents.SessionSwitch += SystemEvents_SessionSwitch;
var task = _appHost.Init(initProgress);
task = task.ContinueWith(new Action<Task>(a => _appHost.RunStartupTasks()));
@@ -239,7 +237,10 @@ namespace MediaBrowser.ServerApplication
else
{
Task.WaitAll(task);
-
+
+ SystemEvents.SessionEnding += SystemEvents_SessionEnding;
+ SystemEvents.SessionSwitch += SystemEvents_SessionSwitch;
+
HideSplashScreen();
ShowTrayIcon();