public void BindToSimulator(KpSimulator kps)
        {
            if (kps == null)
            {
                throw new ArgumentNullException("kps");
            }
            SimulationParams = kps.SimulationParams;

            if (kps.SimulationStarted == null)
            {
                kps.SimulationStarted = simulationStarted;
            }
            else
            {
                kps.SimulationStarted += simulationStarted;
            }

            if (kps.ReachedStep == null)
            {
                kps.ReachedStep = reachedStep;
            }
            else
            {
                kps.ReachedStep += reachedStep;
            }

            if (!MuteConfiguration)
            {
                if (kps.StepComplete == null)
                {
                    kps.StepComplete = stepComplete;
                }
                else
                {
                    kps.StepComplete += stepComplete;
                }
            }

            if (!MuteRuleSelection)
            {
                if (kps.RuleApplied == null)
                {
                    kps.RuleApplied = ruleApplied;
                }
                else
                {
                    kps.RuleApplied += ruleApplied;
                }
            }

            if (!MuteTargetSelection)
            {
                if (kps.TargetSelected == null)
                {
                    kps.TargetSelected = targetSelected;
                }
                else
                {
                    kps.TargetSelected += targetSelected;
                }
            }

            if (!MuteInstanceCreation)
            {
                if (kps.NewInstanceCreated == null)
                {
                    kps.NewInstanceCreated = newInstanceCreated;
                }
                else
                {
                    kps.NewInstanceCreated += newInstanceCreated;
                }
            }

            if (kps.SystemHalted == null)
            {
                kps.SystemHalted = systemHalted;
            }
            else
            {
                kps.SystemHalted += systemHalted;
            }

            if (kps.SimulationComplete == null)
            {
                kps.SimulationComplete = simulationComplete;
            }
            else
            {
                kps.SimulationComplete += simulationComplete;
            }
        }
예제 #2
0
 public KpSimulator(KpSimulationParams parameters)
     : this()
 {
     SimulationParams = parameters;
 }