/// <summary> /// Adds a behavior to the interactor. /// </summary> /// <param name="behavior">The behavior to add.</param> public void AddBehavior(IEyeXBehavior behavior) { if (_behaviors.Any(x => x.BehaviorType == behavior.BehaviorType)) { throw new InvalidOperationException("A behavior with the same type has already been added."); } _behaviors.Add(behavior); }
/// <summary> /// Adds the supplied IEyeXBehavior to this WpfInteractor and saves /// a references to the associated FrameworkElement if this is the /// first added behavior. Will replace any already added behavior /// with the same BehaviorType. /// </summary> /// <param name="element">The <see cref="FrameworkElement"/> where to add the behavior.</param> /// <param name="behavior">The <see cref="IEyeXBehavior"/> to add.</param> public void AddBehavior(FrameworkElement element, IEyeXBehavior behavior) { if (!IsInteractor) { Initialize(element); } var wasInteractor = IsInteractor; _behaviors.RemoveAll(x => x.BehaviorType == behavior.BehaviorType); _behaviors.Add(behavior); NotifyIfInteractorStatusChanged(wasInteractor); }
private static void AddBehavior(FrameworkElement element, IEyeXBehavior behavior) { var wpfInteractor = element.GetWpfInteractorOrDefault(); wpfInteractor.AddBehavior(element, behavior); }
/// <summary> /// Makes the specified control eye-gaze interactive, by assigning an EyeX behavior /// to the interactor associated with the control. /// Creates a new interactor for the control if necessary. /// </summary> /// <param name="control">Control to be made eye-gaze interactive.</param> /// <param name="behavior">EyeX behavior to be assigned.</param> public void Add(Control control, IEyeXBehavior behavior) { GetInteractor(control).AddBehavior(behavior); }