private void logoutToolStripMenuItem_Click(object sender, EventArgs e) { btnAddContact.Enabled = false; dgvContacts.Enabled = false; logoutToolStripMenuItem.Enabled = false; ChatTwo_Client_Protocol.LogOut(); loginToolStripMenuItem.Enabled = true; toolStripStatusLabel1.Text = "Logged out"; MessageBox.Show(this, "This feature is sadly not fully implemented yet." + Environment.NewLine + "" + Environment.NewLine + "Currently the server just detects that you have timed out." + Environment.NewLine + "So wait 10 seconds before trying to log in again.", "Logout", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void FormMain_FormClosing(object sender, FormClosingEventArgs e) { // Check if we are exiting the program, or just hiding it. if (!_closing) { e.Cancel = true; this.Hide(); TrayBalloonTip("Minimized to tray", ToolTipIcon.None); return; } // We are exting the program, stop all threaded workers and stuff. if (ChatTwo_Client_Protocol.LoggedIn) { ChatTwo_Client_Protocol.LogOut(); } _client.Stop(); }