private void Worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { btnLogin.Enabled = true; btnCancel.Enabled = true; loadingWin.Close(); object[] arr = e.Result as object[]; if (arr[0].ToString() == "Failed") { MessageBox.Show(arr[1].ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { DialogResult = DialogResult.OK; Close(); } }
private void Worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { btnConnect.Enabled = true; btnCancel.Enabled = true; loadingWin.Close(); object[] arr = e.Result as object[]; if (arr[0].ToString() == "Failed") { MessageBox.Show(arr[1].ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { Hide(); frmControlPanel controlPanelWin = new frmControlPanel(TcpClient); controlPanelWin.ShowDialog(); } }