public frmConnection() { InitializeComponent(); loadingWin = new frmLoadingWin(); connectWorker = new BackgroundWorker(); connectWorker.DoWork += Worker_DoWork; connectWorker.RunWorkerCompleted += Worker_RunWorkerCompleted; }
public frmLogin(TcpClient tcpClient) { InitializeComponent(); this.tcpClient = tcpClient; loadingWin = new frmLoadingWin(); loginWorker = new BackgroundWorker(); loginWorker.DoWork += Worker_DoWork; loginWorker.RunWorkerCompleted += Worker_RunWorkerCompleted; }
private void btnLogin_Click(object sender, EventArgs e) { if (!IPAddress.TryParse(txtIP.Text, out _)) { MessageBox.Show("Please input a valid ip address!"); return; } else if (!int.TryParse(txtPort.Text, out _)) { MessageBox.Show("Please input a valid port!"); return; } btnConnect.Enabled = false; btnCancel.Enabled = false; loadingWin = new frmLoadingWin(); loadingWin.Show(); loadingWin.BringToFront(); connectWorker.RunWorkerAsync(); }
private void btnLogin_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtUsername.Text)) { MessageBox.Show("Please input a valid username!"); return; } else if (string.IsNullOrEmpty(txtPassword.Text)) { MessageBox.Show("Please input a valid password!"); return; } btnLogin.Enabled = false; btnCancel.Enabled = false; loadingWin = new frmLoadingWin(); loadingWin.Show(); loadingWin.BringToFront(); loginWorker.RunWorkerAsync(); }