Example #1
0
        //return true if there are more steps
        public bool ExecuteStep(SocketMessage Message)
        {
            ProcessStep Step;

            if (ProcessSteps.TryDequeue(out Step))
            {
                Step.Execute(Message, this);

                if (OnProcessStep != null)
                {
                    OnProcessStep.Invoke(Message, this, Step);
                }
            }

            bool MoreSteps = ProcessSteps.Count > 0;

            if (!MoreSteps)
            {
                if (OnProcessComplete != null)
                {
                    OnProcessComplete.Invoke(this);
                }
            }

            return(MoreSteps);
        }
Example #2
0
        public void DelegateCountToTen()
        {
            ProcessSteps func = new ProcessSteps(CountProcess);
            Process      p    = new Process(_sim, func);

            _sim.Run(new Task [] { p });
            Assert.AreEqual(10, _count);
            Assert.AreEqual(100L, _sim.Now);
        }
Example #3
0
        /// <summary>
        /// Create a new <see cref="Process"/> that obtains its processing
        /// steps generator from the given delegate and which can pass client
        /// data to the delegate.
        /// </summary>
        /// <param name="sim">The simulation context.</param>
        /// <param name="steps">
        /// The <see cref="ProcessSteps"/> delegate that can create the
        /// generator which supplies the processing steps for the
        /// <see cref="Process"/>.
        /// </param>
        /// <param name="data">
        /// Client data passed to <paramref name="steps"/> when it is invoked.
        /// May be <see langword="null"/>.
        /// </param>
        public Process(Simulation sim, ProcessSteps steps, object data)
            : base(sim)
        {
            if (steps == null)
            {
                throw new ArgumentNullException("steps");
            }

            _stepsfunc = steps;
            _stepsdata = data;
        }
Example #4
0
        public PageEntryModel Save()
        {
            var model = new PageEntryModel
            {
                Title             = Title,
                Category          = Category.DisplayName,
                Steps             = ProcessSteps.Where(s => s.IsPresent).Select(s => s.DisplayName).ToArray(),
                EntryDate         = EntryDate,
                NextSteps         = NextSteps.GetModel(),
                ItemsAccomplished = ItemsAccomplished.GetModel(),
                Attended          = AttendanceViewModel.GetModel(),
                Author            = AttendanceViewModel.Author?.DisplayName,
                Sections          = Sections.GetModel(),
                Reflections       = Reflections,
            };

            return(model);
        }
        /// <summary>
        /// Default query for ProcessSteps
        /// </summary>
        /// <returns></returns>
        public virtual IQueryable <ProcessStep> GetProcessStepQuery()
        {
            IQueryable <ProcessStep> query = ProcessSteps.OrderBy(p => p.DisplayOrder);

            return(query);
        }
 public void PerformanceTrace(string processName, ProcessSteps step)
 => Log(LogLevels.Trace, $"[{processName};{(step == ProcessSteps.Start ? "START" : "END")}]");
Example #7
0
 public ProcessStep GetCurrentProcessStep()
 {
     return(ProcessSteps.Peek());
 }
Example #8
0
 /// <summary>
 /// Create a new <see cref="Process"/> that obtains its processing
 /// steps generator from the given delegate.
 /// </summary>
 /// <param name="sim">The simulation context.</param>
 /// <param name="steps">
 /// The <see cref="ProcessSteps"/> delegate that can create the
 /// generator which supplies the processing steps for the
 /// <see cref="Process"/>.
 /// </param>
 public Process(Simulation sim, ProcessSteps steps)
     : this(sim, steps, null)
 {
 }
Example #9
0
 private ProcessStep FindStep(string name)
 {
     return(ProcessSteps.FirstOrDefault(a => a.DisplayName == name));
 }