Exemplo n.º 1
0
 /// <summary>
 /// Parameterized internal class constructor.
 /// </summary>
 /// <param name="contact">
 /// An event that has occured for a Surface Contact.</param>
 /// <param name="model">
 /// Interface for upating a state machine.</param>
 internal HitTestResult(ContactTargetEvent contact, IInputElementStateMachine model)
 {
     this.contact = contact;
     this.stateMachine = model;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Sets information about what uncaptured 
 /// <strong><see cref="CoreInteractionFramework.IInputElementStateMachine"/></strong> state machine was hit, 
 /// if any, and details about the hit. 
 /// </summary>
 /// <remarks>The <em>hitTestDetails</em> parameter can be null in two cases:
 /// <list type="bullet">
 /// <item>When the <strong>TypeOfHitTestDetails</strong> on an 
 /// <strong><see cref="CoreInteractionFramework.IInputElementStateMachine"/></strong> state machine
 /// returns null.</item>
 /// <item>When the <strong>StateMachine</strong> on a 
 /// <strong><see cref="CoreInteractionFramework.HitTestResult"/></strong> object returns 
 /// null.</item>
 /// </list>
 /// An exception is thrown in all other cases. The type of <strong>hitTestDetails</strong> must 
 /// match the type that is returned from the <strong>TypeOfHitTestDetails</strong> property on the <em>elementHit</em> 
 /// parameter.
 /// </remarks>
 /// <param name="elementHit">The element that a contact hit.</param>
 /// <param name="hitTestDetails">Details about that hit.</param>
 public void SetUncapturedHitTestInformation(IInputElementStateMachine elementHit, IHitTestDetails hitTestDetails)
 {
     // This will only be non null if this element is captured.
     if (stateMachine != null)
     {
         throw SurfaceCoreFrameworkExceptions.CalledReleaseHitTestInformationForCapturedElement();
     }
     else // stateMachine == null - This is an uncaptured hitTest
     {
         if (elementHit == null)
         {
             if (hitTestDetails == null)
             {
                 stateMachine = null;
                 hitTestDetails = null;
             }
         }
         else // elementHit != null.
         {
             SetHitTestDetails(elementHit, elementHit.GetType(), hitTestDetails, elementHit.TypeOfHitTestDetails);
         }
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Sets the stateMachine and hitTestDetails. Throws an exception returned 
        /// from the exception parameter if the type of hitTestDetails and the 
        /// HitTestDetails paired with the stateMachine don't match.
        /// </summary>
        /// <param name="stateMachine">State Machine subject of the hit.</param>
        /// <param name="stateMachineType">Type of State Machine hit.</param>
        /// <param name="hitTestDetails">Details about the hit.</param>
        /// <param name="typeOfHitTestDetails">Type of hit test details about the hit.</param>
        private void SetHitTestDetails(IInputElementStateMachine stateMachine, Type stateMachineType, IHitTestDetails hitTestDetails, Type typeOfHitTestDetails)
        {
            this.stateMachine = stateMachine;

            Type actualType = (hitTestDetails == null) ? null : hitTestDetails.GetType();

            if (actualType != typeOfHitTestDetails)
            {
                throw SurfaceCoreFrameworkExceptions.HitTestDetailsMustBeTypeof(typeOfHitTestDetails, stateMachineType, hitTestDetails);
            }

            ContactTargetEvent.HitTestDetails = hitTestDetails;
        }
 internal StateMachineContactEventArgs(Contact contact, IInputElementStateMachine stateMachine)
     : base(contact)
 {
     StateMachine = stateMachine;
 }
 internal StateMachineTouchEventArgs(TouchPoint touch, IInputElementStateMachine stateMachine) : base(touch)
 {
     StateMachine = stateMachine;
 }
Exemplo n.º 6
0
 /// <summary>
 /// Parameterized internal class constructor.
 /// </summary>
 /// <param name="touch">
 /// An event that has occured for a Surface Touch.</param>
 /// <param name="model">
 /// Interface for upating a state machine.</param>
 internal HitTestResult(TouchTargetEvent touch, IInputElementStateMachine model)
 {
     this.touch = touch;
     this.stateMachine = model;
 }
Exemplo n.º 7
0
        /// <summary>
        /// Gives exclusive access to events that are raised for a particular touch.  
        /// </summary>
        /// <remarks>All events raised on the specified touch are routed to the element that passed
        /// to the <strong>Capture</strong> method. The 
        /// <strong><see cref="M:CoreInteractionFramework.HitTestCallback"/></strong> delegate is not called while
        /// a touch is captured.
        /// </remarks>
        /// <param name="touch">The touch to capture.</param>
        /// <param name="element">The element to route the captured touch's event to.</param>
        public void Capture(TouchPoint touch, IInputElementStateMachine element)
        {
            if (touch == null)
                throw SurfaceCoreFrameworkExceptions.ArgumentNullException("touch");

            if (element == null)
                throw SurfaceCoreFrameworkExceptions.ArgumentNullException("element");

            if (this.capturedTouches.ContainsKey(touch.Id))
            {
                this.capturedTouches.Remove(touch.Id);
            }

            this.capturedTouches.Add(touch.Id, element);

            element.OnGotTouchCapture(touch);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Gives exclusive access to events that are raised for a particular contact.  
        /// </summary>
        /// <remarks>All events raised on the specified contact are routed to the element that passed
        /// to the <strong>Capture</strong> method. The 
        /// <strong><see cref="M:CoreInteractionFramework.HitTestCallback"/></strong> delegate is not called while
        /// a contact is captured.
        /// </remarks>
        /// <param name="contact">The contact to capture.</param>
        /// <param name="element">The element to route the captured contact's event to.</param>
        public void Capture(Contact contact, IInputElementStateMachine element)
        {
            if (contact == null)
                throw SurfaceCoreFrameworkExceptions.ArgumentNullException("contact");

            if (element == null)
                throw SurfaceCoreFrameworkExceptions.ArgumentNullException("element");

            if (this.capturedContacts.ContainsKey(contact.Id))
                throw SurfaceCoreFrameworkExceptions.ContactAlreadyCapturedException(contact);

            this.capturedContacts.Add(contact.Id, element);

            element.OnGotContactCapture(contact);
        }