Пример #1
0
 private void btnlogin_Click(object sender, EventArgs e)
 {
     this.btnlogin.Focus();
     this.btnlogin.Enabled = false;
     if (AppClient.NetworkIsAvailable())
     {
         if (!string.IsNullOrEmpty(txtusername.Text) && !string.IsNullOrEmpty(txtuserpwd.Text))
         {
             Console.WriteLine(" start login thread ~~~~~ ");
             if (!AppClient.IsReady)
             {
                 AppClient.Close();
                 DSClient.Close();
             }
             loginThread = new Thread(new ThreadStart(this.Login));
             loginThread.Start();
         }
         else
         {
             MessageBox.Show("User ID and 密码均不能为空!", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
             this.btnlogin.Enabled = true;
             return;
         }
     }
     else
     {
         MessageBox.Show("Network is disconnected!", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
         this.btnlogin.Enabled = true;
         return;
     }
 }
        public static ICrypta GetCrypta()
        {
            ICrypta crypta = new Crypta();

            crypta.BfKey = DSClient.GetKey(typeof(ICrypta).Name);
            return(crypta);
        }
Пример #3
0
 private void btncancel_Click(object sender, EventArgs e)
 {
     isCancel = true;
     AppClient.Close();
     DSClient.Close();
     AppClient.IsStopAttempt = true;
     DSClient.IsStopAttempt  = true;
     try
     {
         if (loginThread.IsAlive)
         {
             loginThread.Abort();
         }
     }
     catch (Exception ex) { }
     this.DialogResult = DialogResult.Cancel;
     this.Close();
 }