示例#1
0
 public frmConnection()
 {
     InitializeComponent();
     loadingWin                        = new frmLoadingWin();
     connectWorker                     = new BackgroundWorker();
     connectWorker.DoWork             += Worker_DoWork;
     connectWorker.RunWorkerCompleted += Worker_RunWorkerCompleted;
 }
示例#2
0
        public frmLogin(TcpClient tcpClient)
        {
            InitializeComponent();

            this.tcpClient = tcpClient;

            loadingWin                      = new frmLoadingWin();
            loginWorker                     = new BackgroundWorker();
            loginWorker.DoWork             += Worker_DoWork;
            loginWorker.RunWorkerCompleted += Worker_RunWorkerCompleted;
        }
示例#3
0
        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();
        }
示例#4
0
        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();
        }