Exemplo n.º 1
0
        /// <summary>
        /// Adds a binding for the observer, unless one already exists.
        /// </summary>
        /// <param name="observer">The observer to add.</param>
        /// <param name="priority">
        /// The priority of the observer. Observers with higher priority will
        /// receive touch events before observers with lower priority.The
        /// default value is zero.
        /// </param>
        public void Add(IMultiTouchObserver observer, int priority = 0)
        {
            MultiTouchBinding binding;

            binding = this.GetBinding(observer);

            if (binding == null)
            {
                binding          = new MultiTouchBinding();
                binding.Observer = observer;
                binding.Priority = priority;
                this.AddBinding(binding);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Compares two bindings and returns a value indicating whether
        /// one is less than, equal to, or greater than the other.
        /// </summary>
        /// <param name="binding">The first binding to compare.</param>
        /// <param name="other">The second binding to compare.</param>
        /// <returns>A signed integer that indicates the relative values of binding and other.</returns>
        public static int Compare(MultiTouchBinding binding, MultiTouchBinding other)
        {
            int result = 0;

            if (result == 0)
            {
                result = binding.Priority.CompareTo(other.Priority) * -1;
            }
            if (result == 0)
            {
                result = binding.Identifier.CompareTo(other.Identifier);
            }
            return(result);
        }
Exemplo n.º 3
0
 private void RemoveBinding(MultiTouchBinding binding)
 {
     if (this.Locked)
     {
         if (this.BindingsToAdd.Contains(binding) == true)
         {
             this.BindingsToAdd.Remove(binding);
         }
         if (this.BindingsToRemove.Contains(binding) == false)
         {
             this.BindingsToRemove.Add(binding);
         }
     }
     else
     {
         if (this.Bindings.Contains(binding) == true)
         {
             this.Bindings.Remove(binding);
             this.Dirty = true;
         }
     }
 }