浏览代码

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

Michael 11 年之前
父节点
当前提交
b2550f6dd3
共有 1 个文件被更改,包括 4 次插入3 次删除
  1. 4 3
      MediaBrowser.ServerApplication/MainStartup.cs

+ 4 - 3
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();