public void OnStop() { IsClosing = true; Program.Logger.Log.Debug("On stop"); Program.Logger.Log.Info($"Stopping {Program.ProductName} service"); if (worker != null) { worker.Close(); } if (workerTask != null && workerTask.Status != TaskStatus.RanToCompletion) { workerTask.Dispose(); workerTask = null; } if (milestoneServer != null) { milestoneServer.Close(); } }
public void OnStop() { Chatting.WhisperGui(new Info { MsgId = MessageId.ConnectedToMilestoneServer, Bool = false }); IsClosing = true; Program.Log.Debug("On stop"); Program.Log.Info($"Stopping {Program.ProductName} service"); if (worker != null) { worker.Close(); } if (workerTask != null && workerTask.Status != TaskStatus.RanToCompletion) { workerTask.Dispose(); workerTask = null; } if (milestoneServer != null) { milestoneServer.Close(); } try { Chatting.UserEnter -= ServerConnection_UserEnter; Chatting.UserLeave -= ServerConnection_UserLeave; Chatting.InfoArrived -= ServerConnection_MessageArrived; Chatting.Close(); } catch (Exception ex) { Program.Log.Error("OnStop", ex); } }