private void connectButton_Click(object sender, EventArgs e) { if (GameSocket.Connected) { CommonUIFunctions.SendNotification("Already connected!"); } else { Connect(DebugProtoclAdress, GameSocket); if (GameSocket.Connected) { statusLabel.Text = "Status: Connected"; CommonUIFunctions.SendNotification("Connected!"); DataRecieveWorker.RunWorkerAsync(); } else { statusLabel.Text = "Status: Error"; CommonUIFunctions.SendNotification("Failed to connect!"); } } }
private void frmDebug_FormClosing(object sender, FormClosingEventArgs e) { DataRecieveWorker.CancelAsync(); GameSocket.Close(); }