Example #1
0
        /// <summary>
        /// 查找下一步。
        /// 如果是currentStep空,则查找第一步。
        /// </summary>
        /// <param name="condition"></param>
        /// <returns></returns>
        public Step FindNextStep(string condition)
        {
            Step nextStep = null;

            if (this.currentStep == null)
            {
                nextStep = this.currentScript.StepList.OrderBy(a => a.Id).First();
                goto finish;
            }
            if (this.currentStep.Id == 99)
            {
                this.Status = TaskStatus.测试完成;
                nextStep    = this.currentStep;
                goto finish;
            }
            if (string.IsNullOrEmpty(condition))
            {
                nextStep = this.currentScript.StepList.Where(a => a.Id == this.currentStep.NextStepId).FirstOrDefault();
                goto finish;
            }
            else
            {
                nextStep = this.currentScript.StepList.Where(a => a.Id == this.currentStep.Id && a.Conditon == condition).FirstOrDefault();
                goto finish;
            }
finish:
            if (nextStep != null)
            {
                log.Info("查找下一步, 名称是:" + nextStep.Name, this.currentTask.Id);
            }
            return(nextStep);
        }
Example #2
0
        static void Main()
        {
            Thread t = new Thread(() => startListen());

            t.Start();
            for (; ;)
            {
                log.Info("I'm alive");
                Thread.Sleep(1000 * 5);
            }
        }
        public static void ModifyWirelessMode(string modeString)
        {
            log.Info("modeString = " + modeString);
            RegistryKey hkml       = Registry.LocalMachine;
            string      registData = "";
            RegistryKey myKey      = hkml.OpenSubKey(@"SYSTEM\ControlSet001\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0007", true);

            if (myKey != null)
            {
                object wirelessMode = myKey.GetValue("WirelessMode");
                if (wirelessMode == null)
                {
                    log.Info("系统不存在WirelessMode键值");
                    return;
                }
                registData = wirelessMode.ToString();
                log.Info(registData);
                myKey.SetValue("WirelessMode", modeString);
            }
            log.Info(myKey.GetValue("WirelessMode").ToString());
            NetWork("无线网络连接", "禁用");
            NetWork("无线网络连接", "启用");
        }
Example #4
0
 private static void startListen()
 {
     MqAgentConsumer.GetInst(consumer_Listener, MqConst.AgentTest2);
     log.Info("AgentTest2开始监听");
 }