Beispiel #1
0
 private void ActivitiesHolder_ActivityPerformed(object sender, EventArgs e)
 {
     // save
     LastActivityPerformed = (e as ActivityPerformedEventArgs).Activity;
     // call ActivityPerformedEventhandler
     OnActivityPerformed(e);
 }
Beispiel #2
0
        private void OnCLEMEndOfTimeStep(object sender, EventArgs e)
        {
            // fire all activity performed triggers at end of time step
            foreach (CLEMActivityBase child in Children.Where(a => a.GetType().IsSubclassOf(typeof(CLEMActivityBase))))
            {
                child.ReportAllAllActivitiesPerformed();
            }

            // add timestep activity for reporting
            ActivityPerformedEventArgs ea = new ActivityPerformedEventArgs()
            {
                Activity = TimeStep
            };

            LastActivityPerformed = TimeStep;
            OnActivityPerformed(ea);
        }
Beispiel #3
0
        private void OnCLEMEndOfTimeStep(object sender, EventArgs e)
        {
            // fire all activity performed triggers at end of time step
            foreach (CLEMActivityBase child in Children.Where(a => a.GetType().IsSubclassOf(typeof(CLEMActivityBase))))
            {
                if (child.Enabled)
                {
                    child.ReportAllAllActivitiesPerformed();
                }
            }

            // report all timers that were due this time step
            foreach (IActivityTimer timer in Apsim.ChildrenRecursively(this, typeof(IActivityTimer)))
            {
                if (timer.ActivityDue)
                {
                    // report activity performed.
                    ActivityPerformedEventArgs timerActivity = new ActivityPerformedEventArgs
                    {
                        Activity = new BlankActivity()
                        {
                            Status = ActivityStatus.Timer,
                            Name   = (timer as IModel).Name
                        }
                    };
                    timerActivity.Activity.SetGuID((timer as CLEMModel).UniqueID);
                    timer.OnActivityPerformed(timerActivity);
                }
            }

            // add timestep activity for reporting
            ActivityPerformedEventArgs ea = new ActivityPerformedEventArgs()
            {
                Activity = timeStep
            };

            LastActivityPerformed = timeStep;
            OnActivityPerformed(ea);
        }
Beispiel #4
0
        private void OnCLEMEndOfTimeStep(object sender, EventArgs e)
        {
            // fire all activity performed triggers at end of time step
            foreach (CLEMActivityBase child in FindAllChildren <CLEMActivityBase>())
            {
                child.ReportAllAllActivitiesPerformed();
            }

            // report all timers that were due this time step
            foreach (IActivityTimer timer in this.FindAllDescendants <IActivityTimer>())
            {
                if (timer.ActivityDue)
                {
                    // report activity performed.
                    ActivityPerformedEventArgs timerActivity = new ActivityPerformedEventArgs
                    {
                        Activity = new BlankActivity()
                        {
                            Status = ActivityStatus.Timer,
                            Name   = (timer as IModel).Name
                        }
                    };
                    timerActivity.Activity.SetGuID((timer as CLEMModel).UniqueID);
                    timer.OnActivityPerformed(timerActivity);
                }
            }

            // add timestep activity for reporting
            ActivityPerformedEventArgs ea = new ActivityPerformedEventArgs()
            {
                Activity = timeStep
            };

            LastActivityPerformed = timeStep;
            OnActivityPerformed(ea);
        }