/// <summary>
        /// Initializes a new instance of the <see cref="CurrentSwitchBindingContext"/> class.
        /// </summary>
        /// <param name="component">The component that creates the behavior.</param>
        /// <param name="simulation">The simulation for which the behavior is created.</param>
        /// <param name="behaviors">The created behaviors.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="component"/>, <paramref name="simulation"/> or <paramref name="behaviors"/> is <c>null</c>.</exception>
        public CurrentSwitchBindingContext(ICurrentControllingComponent component, ISimulation simulation, IBehaviorContainer behaviors)
            : base(component, simulation, behaviors)
        {
            var branch = ControlBehaviors.GetValue <IBranchedBehavior <double> >().Branch;

            ControlValue = () => branch.Value;
        }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CurrentControlledBindingContext" /> class.
 /// </summary>
 /// <param name="component">The component that creates the behavior.</param>
 /// <param name="simulation">The simulation for which the behavior is created.</param>
 /// <param name="behaviors">The created behaviors.</param>
 /// <exception cref="ArgumentNullException">Thrown if <paramref name="component"/> or <paramref name="simulation"/> is <c>null</c>.</exception>
 public CurrentControlledBindingContext(ICurrentControllingComponent component, ISimulation simulation, IBehaviorContainer behaviors)
     : base(component, simulation, behaviors)
 {
     // Gets the current controlling behaviors
     if (component.ControllingSource != null)
     {
         ControlBehaviors = simulation.EntityBehaviors[component.ControllingSource];
     }
 }