Exemple #1
0
 private void LoginButton_Click(object sender, EventArgs e)
 {
     if (IsID(IDTextBox.Text) && (IsRoomNum(textBox1.Text)))
     {
         client.beginThread();
         AsynTask asynTask = new AsynTask(LoginDoWork, LoginCallBack);//线程
         asynTask.startTask();
         mLoadingBox = new LoadingBox();
         mLoadingBox.ShowDialog();
     }
     else
     {
         MessageBox infoBox = new MessageBox("请输入正确的房间号和身份证号");
         infoBox.ShowDialog();
         infoBox.Dispose();
     }
 }
 private void Client_Load(object sender, EventArgs e)
 {
     heartbeatpacketSender = new HeartbeatpacketSender(this);
     mLoadingBox           = new LoadingBox();
     timeWordker           = new BackgroundWorker();
     refreshTimeWorker     = new BackgroundWorker();
     timeWordker.WorkerSupportsCancellation = true;
     timeWordker.DoWork                     += panelWait;
     timeWordker.RunWorkerCompleted         += panelCallBack;
     refreshTimeWorker.DoWork               += getSysTime;
     refreshTimeWorker.ProgressChanged      += refreshTimeText;
     refreshTimeWorker.WorkerReportsProgress = true;
     refreshTimeWorker.RunWorkerAsync();
     isOff           = true;
     isLogin         = false;
     isClose         = false;
     nowTp           = Constants.DEFAULT_TEMPERATURE;
     roomTpText.Text = Constants.ROOM_TP + Constants.DEFAULT_TEMPERATURE.ToString() + "℃";
     context         = SynchronizationContext.Current;
     speed           = Constants.NONE_SPEED;
     clientLock      = new object();
 }