Example #1
0
 static StatusController()
 {
     current = new Status();
 }
Example #2
0
 private void AppController_OnStatusChange(Status obj)
 {
     this.UpdateStatus(obj);
 }
Example #3
0
        /// <summary>
        /// 重置状态
        /// </summary>
        public static void Reset()
        {
            if (null != OnStatusChange)
            {
                try
                {
                    RWLock.EnterWriteLock();

                    current = new Status();
                }
                finally
                {
                    RWLock.ExitWriteLock();
                }

                UpdateUIStatus();
            }
        }
Example #4
0
        public void UpdateStatus(Status status)
        {
            this.tlsDownloadNum.Text = "已抓取:" + status.DownloadNum + "张";
            this.tslThreadNum.Text = "线程数:" + status.ThreadNum.ToString();
            this.tslState.Text = "状态:" + status.State.ToString();

            switch (status.State)
            {
                case State.运行中:
                    tbSetting.Enabled =
                    btnStart.Enabled = false;
                    btnStop.Enabled = true;
                    break;
                case State.正在取消:
                    tbSetting.Enabled =
                    btnStart.Enabled = false;
                    btnStop.Enabled = false;
                    break;
                default:
                    tbSetting.Enabled =
                    btnStart.Enabled = true;
                    btnStop.Enabled = false;
                    tmConsume.Stop();
                    break;
            }
        }