Exemple #1
0
        void Ball_TouchMove(object sender, TouchEventArgs e)
        {
            if (touchMove)
            {
                touchMoveCount++;
                lastTouchMoveX = this.x;
                lastTouchMoveY = this.y;
                this.x         = (float)e.GetTouchPoint((IInputElement)this.Parent).Position.X;
                this.y         = (float)e.GetTouchPoint((IInputElement)this.Parent).Position.Y;

                Canvas.SetLeft(this, x - width / 2);
                Canvas.SetTop(this, y - height / 2);

                DataObject data = new DataObject();
                data.SetData("Object", this);

                TouchDragDrop.FireDrag(this, e);
            }
        }
Exemple #2
0
 void Ball_TouchUp(object sender, TouchEventArgs e)
 {
     if (touchMove)
     {
         touchMove = false;
         if (touchMoveCount > 2)
         {
             this.vX = (this.x - this.lastTouchMoveX) / 40f;
             this.vY = (this.y - this.lastTouchMoveY) / 40f;
         }
         touchMoveCount = 0;
         EventArgs args = new EventArgs();
         TouchDragDrop.FireDrop(this, e);
         if (Dropped)
         {
             if (OnDrop != null)
             {
                 OnDrop(this, e);
             }
         }
     }
 }