Пример #1
0
        protected void DoAction(object sender, Func <ErrorInfoWithPause> act)
        {
            if (ClassCommonSetting.CheckGeneralAir != null)
            {
                if (ClassCommonSetting.CheckGeneralAir() != null)
                {
                    return;
                }
            }
            Stopwatch sw = new Stopwatch();

            sw.Start();
            labelStatus.Text = "开始执行" + ((Control)sender).Text;
            ErrorInfoWithPause res = act();

            sw.Stop();
            if (res == null)
            {
                labelStatus.Text = "执行" + ((Control)sender).Text + "正常 用时:" + sw.ElapsedMilliseconds.ToString() + "ms";
            }
            else
            {
                string temp = res.Message;
                //if (res.NeedRetry) temp += "(可重试)";
                labelStatus.Text = "执行" + ((Control)sender).Text + "出错: " + temp;
            }
        }
Пример #2
0
 protected void buttonReset_Click(object sender, EventArgs e)
 {
     if (ClassCommonSetting.CheckGeneralAir != null)
     {
         if (ClassCommonSetting.CheckGeneralAir() != null)
         {
             return;
         }
     }
     labelStatus.Text = "开始复位。";
     _owner.SubscribeMeToResponseEvent(this);
     _owner.DoReset();
 }
Пример #3
0
        protected void DoAction(object sender, Func <string> act)
        {
            if (ClassCommonSetting.CheckGeneralAir != null)
            {
                if (ClassCommonSetting.CheckGeneralAir() != null)
                {
                    return;
                }
            }
            labelStatus.Text = "开始执行" + ((Control)sender).Text;
            string res = act();

            if (res == "")
            {
                labelStatus.Text = "执行" + ((Control)sender).Text + "正常";
            }
            else
            {
                //if (retry) res += "(可重试)";
                labelStatus.Text = "执行" + ((Control)sender).Text + "出错: " + res;
            }
        }
Пример #4
0
 protected void StartSM(object sender, BaseStateMachine sm, string FinishEventName)
 {
     if (ClassCommonSetting.CheckGeneralAir != null)
     {
         if (ClassCommonSetting.CheckGeneralAir() != null)
         {
             return;
         }
     }
     if (currentSM != null && currentSM.IsRunning)
     {
         labelStatus.Text = "上一次流程未结束,无法开始新流程。";
     }
     else
     {
         currentSM   = sm;
         finishevent = FinishEventName;
         currentSMsw.Reset();
         currentSMsw.Start();
         labelStatus.Text = "开始执行" + ((Control)sender).Text;
         currentSM.subscribeMeToResponseEvents(this);
         currentSM.StartHandler(null, null);
     }
 }