protected override void ProcessRecord() { _logger.Info("ServerPrefiexes: {0}", string.Join(", ", WebSocketParam.ServerPrefixes)); using (Item.WssHandle = new WebSocketServer()) { _logger.Debug("Set cancel event."); Console.CancelKeyPress += (sender, e) => { e.Cancel = false; if (Item.WssHandle != null) { Item.WssHandle.Stop(); } _logger.Info("Cancel key entered."); }; Item.UnassignedCancelEvent = false; // ワーキングセットを定期的に縮小化 _logger.Info("Start ShrinkWorkingSet Thread."); WorkingSet.Shrink().ConfigureAwait(false); // WebSocket待ち受け開始 _logger.Info("Start WebSocket Server."); Item.WssHandle.Start().Wait(); } // 終了処理 _logger.Info("Stop WebSocket Server."); _logger.Info("Process End."); WebSocketParam.ClearConfig(); Item.WssHandle = null; }
/// <summary> /// 最小化/最大化時 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Window_StateChanged(object sender, EventArgs e) { switch (this.WindowState) { case WindowState.Minimized: WorkingSet.Shrink(); StopAutoImageStoreItems(); break; case WindowState.Normal: case WindowState.Maximized: StartAutoImageStoreItems(); break; } }