Ejemplo n.º 1
0
 void OnNewContact(object sender, NewContactEventArgs e)
 {
     if (ClickMode != ClickMode.Hover)
     {
         e.Handled = true;
         if (e.Contact.Capture(this))
         {
             IsPressed = true;
             if (ClickMode == ClickMode.Press && MultitouchScreen.GetContactsCaptured(this).Count() == 1)
             {
                 bool failed = true;
                 try
                 {
                     OnClick();
                     failed = false;
                 }
                 finally
                 {
                     if (failed)
                     {
                         IsPressed = false;
                         e.Contact.ReleaseCapture();
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
 static void OnNewContact(object sender, NewContactEventArgs e)
 {
     if (e.Contact.Captured != e.Source)
     {
         e.Contact.Capture((IInputElement)e.Source);
     }
 }
Ejemplo n.º 3
0
		/// <summary>
		/// Called on new contact.
		/// </summary>
		/// <param name="sender">The sender.</param>
		/// <param name="e">The <see cref="Multitouch.Framework.WPF.Input.NewContactEventArgs"/> instance containing the event data.</param>
		protected virtual void OnNewContact(object sender, NewContactEventArgs e)
		{
			StylusPointCollection pointCollection = new StylusPointCollection();
			points.Add(e.Contact.Id, pointCollection);

			Point position = e.GetPosition(this);
			pointCollection.Add(new StylusPoint(position.X, position.Y));
		}
Ejemplo n.º 4
0
        private void ListBox_NewContact(object sender, NewContactEventArgs e)
        {
            IInputElement element   = listInkEditingModes.InputHitTest(e.GetPosition(listInkEditingModes));
            ListBoxItem   container = ItemsControl.ContainerFromElement(listInkEditingModes, (DependencyObject)element) as ListBoxItem;

            if (container != null)
            {
                container.IsSelected = true;
            }
        }
Ejemplo n.º 5
0
        void InvokeHandler(NewContactEventHandler handler, NewContactEventArgs e)
        {
            if (handler != null)
            {
                handler(this, e);

                if (executeOnNextContact != null)
                {
                    Action <Contact> action = executeOnNextContact;
                    executeOnNextContact = null;
                    action(e.Contact);
                }
            }
        }
Ejemplo n.º 6
0
        void OnNewContact(object sender, NewContactEventArgs e)
        {
            if (!firstContactId.HasValue)
            {
                firstContactId = e.Contact.Id;

                startPoint    = e.GetPosition(this);
                startOffset.X = HorizontalOffset;
                startOffset.Y = VerticalOffset;

                Vector2D contactPoint = startPoint.ToVector2D();
                scrollJoint = new FixedHingeJoint(Body, contactPoint, new Lifespan());
                engine.AddJoint(scrollJoint);
            }
        }
Ejemplo n.º 7
0
        protected virtual void OnNewContact(object sender, NewContactEventArgs e)
        {
            switch (EditingMode)
            {
            case InkCanvasEditingMode.EraseByStroke:
                EraseStroke(e.Contact);
                break;

            case InkCanvasEditingMode.EraseByPoint:
                ErasePoint(e.Contact);
                break;

            case InkCanvasEditingMode.Ink:
                StartStroke(e.Contact);
                break;

            default:
                break;
            }
            e.Contact.Capture(this);
            e.Handled = true;
        }
        void OnNewContact(object sender, NewContactEventArgs e)
        {
            Point         position      = e.GetPosition(this);
            HitTestResult hitTestResult = VisualTreeHelper.HitTest(this, position);

            if (hitTestResult != null)
            {
                FrameworkElement element = hitTestResult.VisualHit as FrameworkElement;
                if (element != null)
                {
                    FrameworkElement parent = element.Parent as FrameworkElement;
                    while (parent != null && !parent.Equals(sender))
                    {
                        element = parent;
                        parent  = element.Parent as FrameworkElement;
                    }
                    if (eltOffset.ContainsKey(element))
                    {
                        contactElements[e.Contact.Id] = element;
                        eltOffset[element]            = e.GetPosition(element);
                    }
                    else
                    {
                        if (contactElements.ContainsKey(e.Contact.Id))
                        {
                            contactElements[e.Contact.Id] = element;
                        }
                        else
                        {
                            contactElements.Add(e.Contact.Id, element);
                        }
                        eltOffset.Add(element, e.GetPosition(element));
                    }
                }
            }
        }
Ejemplo n.º 9
0
 void OnPreviewNewContact(object sender, NewContactEventArgs e)
 {
     InvokeHandler(PreviewNewContact, e);
 }
Ejemplo n.º 10
0
 void OnNewContact(object sender, NewContactEventArgs e)
 {
     InvokeHandler(NewContact, e);
 }
Ejemplo n.º 11
0
 void OnNewContact(object sender, NewContactEventArgs e)
 {
     e.Handled = true;
     e.Contact.Capture(this);
 }