private void CloseConnection() { if (chatConnection != null) { chatConnection.InfoReceived -= InfoReceived; chatConnection.InfoWhispreReceived -= InfoWhispreReceived; chatConnection.UserEnter -= UserEnter; chatConnection.UserLeave -= UserLeft; chatConnection.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); } }
private void LogoutClick(object sender, RoutedEventArgs e) { Chatting chatting = App.chatting; chatting.Close(); }