/// <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);
        }
示例#2
0
        /// <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);
        }
示例#3
0
 private static void AddBehavior(FrameworkElement element, IEyeXBehavior behavior)
 {
     var wpfInteractor = element.GetWpfInteractorOrDefault();
     wpfInteractor.AddBehavior(element, behavior);
 }
示例#4
0
        private static void AddBehavior(FrameworkElement element, IEyeXBehavior behavior)
        {
            var wpfInteractor = element.GetWpfInteractorOrDefault();

            wpfInteractor.AddBehavior(element, behavior);
        }
示例#5
0
        /// <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);
        }
示例#6
0
 /// <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);
 }
示例#7
0
        /// <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);
        }
示例#8
0
 /// <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);
 }