コード例 #1
0
 public override void UnregisterArchitecture()
 {
     foreach (Signal signal in _sensedSignals)
     {
         signal.ValueChanged -= signal_SignalValueChanged;
     }
     _sensedSignals.Clear();
 }
コード例 #2
0
        public static bool SimplifyFactors(SignalSet signals)
        {
            Signal zero;

            if (signals.Exists(Std.IsConstantAdditiveIdentity, out zero))
            {
                signals.Clear();
                signals.Add(zero);
                return(true);
            }
            return(0 < signals.RemoveAll(Std.IsConstantMultiplicativeIdentity));
        }
コード例 #3
0
        public override async Task StartAsync(ExamContext context)
        {
            //清除历史的信号记录;
            SignalSet.Clear();

            //设置考试里程
            context.ExamDistance = (context.ExamTimeMode == ExamTimeMode.Day)
                ? Settings.ExamDistance
                : Settings.NightDistance;

            await ExamManager.StartExamAsync(context);

            if (context.ExamMode == ExamMode.Training)
            {
                await StartTrainingAsync(context);
            }
            else
            {
                await StartExamAsync(context);
            }
        }
コード例 #4
0
        public override async Task ReadyStartExamAsync(ExamContext context)
        {
            //清除历史的信号记录;
            SignalSet.Clear();

            //设置考试里程
            context.ExamDistance = (context.ExamTimeMode == ExamTimeMode.Day)
                ? Settings.ExamDistance
                : Settings.NightDistance;

            await ExamManager.StartExamAsync(context);

            await Task.Run(() =>
            {
                while (!(SignalSet.Current != null && SignalSet.Current.Sensor.Brake))
                {
                    Thread.Sleep(100);
                }
            });

            await StartExamItemAutoAsync(context, ExamItemCodes.CommonExamItem);
            await StartExamItemAutoAsync(context, ExamItemCodes.Start);
        }
コード例 #5
0
        public static bool SimplifyFactors(SignalSet signals)
        {
            if (signals == null)
            {
                throw new ArgumentNullException("signals");
            }
            if (Std.IsConstantAdditiveIdentity(signals[0]))
            {
                signals.Clear();
                signals.Add(signals[0]);
                return(true);
            }
            bool altered = false;

            for (int i = signals.Count - 1; i > 0; i--) //don't touch first item!
            {
                if (Std.IsConstantMultiplicativeIdentity(signals[i]))
                {
                    altered = true;
                    signals.RemoveAt(i);
                }
            }
            return(altered);
        }
コード例 #6
0
 public static bool SimplifyFactors(SignalSet signals)
 {
     Signal zero;
     if(signals.Exists(Std.IsConstantAdditiveIdentity, out zero))
     {
         signals.Clear();
         signals.Add(zero);
         return true;
     }
     return 0 < signals.RemoveAll(Std.IsConstantMultiplicativeIdentity);
 }
コード例 #7
0
 public void Reset()
 {
     _signals.Clear();
     _ports.Clear();
     _buses.Clear();
 }
コード例 #8
0
 public static bool SimplifyFactors(SignalSet signals)
 {
     if(signals == null) throw new ArgumentNullException("signals");
     if(Std.IsConstantAdditiveIdentity(signals[0]))
     {
         signals.Clear();
         signals.Add(signals[0]);
         return true;
     }
     bool altered = false;
     for(int i = signals.Count - 1; i > 0; i--) //don't touch first item!
         if(Std.IsConstantMultiplicativeIdentity(signals[i]))
         {
             altered = true;
             signals.RemoveAt(i);
         }
     return altered;
 }