/// <summary>
        /// Event wird aufgerufen bei TouchDown auf Tabs.
        /// </summary>
        /// <param name="sender">Sender</param>
        /// <param name="e">Eventparameter</param>
        private void CategoryTouchDown(object sender, System.Windows.Input.TouchEventArgs e)
        {
            // Capture to the ScaleButton.
            e.TouchDevice.Capture(this.CategoryGrid);

            // Remember this contact if a contact has not been remembered already.
            // This contact is then used to move the ellipse around.
            if (CategoryTouchDevice == null)
            {
                CategoryTouchDevice = e.TouchDevice;
                UpdateCategoryPreview(CategoryTouchDevice.GetTouchPoint(this.CategoryGrid).Position);
            }
            // Mark this event as handled.
            e.Handled = true;
        }
        private void _internetAccessBrowser_TouchDown(object sender, System.Windows.Input.TouchEventArgs e)
        {
            try
            {
                Control control = (Control)sender;
                e.TouchDevice.Capture(control);
                windowTouchDevice = e.TouchDevice;
                var currentTouchPoint = windowTouchDevice.GetTouchPoint(null);


                var locationOnScreen = control.PointToScreen(new System.Windows.Point(currentTouchPoint.Position.X, currentTouchPoint.Position.Y));
                lastPoint = locationOnScreen;
            }
            catch { }
        }
        private void ShowHideTouchDown(object sender, System.Windows.Input.TouchEventArgs e)
        {
            // Capture to the HideShowButton.
            e.TouchDevice.Capture(this.ShowHideButton);
            // Remember this contact if a contact has not been remembered already.
            if (_moveTouchDevice == null)
            {
                _moveTouchDevice = e.TouchDevice;

                // Remember where this contact took place.
                TouchDownPoint = _moveTouchDevice.GetTouchPoint(this.MainGrid).Position;
            }

            // Mark this event as handled.
            e.Handled = true;
        }
示例#4
0
        private void DragEllipse_TouchDown(object sender, TouchEventArgs e)
        {
            // Capture to the ellipse.
            e.TouchDevice.Capture(sender as Ellipse);

            // Remember this contact if a contact has not been remembered already.
            // This contact is then used to move the ellipse around.
            if (ellipseControlTouchDevice == null)
            {
                ellipseControlTouchDevice = e.TouchDevice;

                // Remember where this contact took place.
                lastPoint = ellipseControlTouchDevice.GetTouchPoint(this.MainCanvas).Position;
            }

            // Mark this event as handled.
            e.Handled = true;
        }
示例#5
0
        private void _internetAccessBrowser_TouchMove(object sender, System.Windows.Input.TouchEventArgs e)
        {
            try
            {
                Control control = (Control)sender;

                var currentTouchPoint = windowTouchDevice.GetTouchPoint(null);

                var locationOnScreen = control.PointToScreen(new System.Windows.Point(currentTouchPoint.Position.X, currentTouchPoint.Position.Y));

                var deltaX = locationOnScreen.X - lastPoint.X;
                var deltaY = locationOnScreen.Y - lastPoint.Y;

                lastPoint = locationOnScreen;

                _internetAccessBrowser.SendMouseWheelEvent((int)lastPoint.X, (int)lastPoint.Y, (int)deltaX, (int)deltaY, CefEventFlags.None);
            }
            catch { }
        }
示例#6
0
        void CheckGesture(object sender, TouchEventArgs e)
        {
            touchMove = true;
            TouchDevice c = e.TouchDevice;
            //c.GetTouchPoint(this).Position;
            Point currentpoint = c.GetTouchPoint(this).Position;

            if (currentpoint.X - initialpoint.X >= 500)//500 is the threshold value, where you want to trigger the swipe right event
            {
                System.Diagnostics.Debug.WriteLine("Swipe Right");
                TabControl.SpinToNext();
                //e.Complete();
            }
            if (currentpoint.X - initialpoint.X <= -500)//500 is the threshold value, where you want to trigger the swipe right event
            {
                System.Diagnostics.Debug.WriteLine("Swipe Left");
                TabControl.SpinToPrevious();
                //e.Complete();
            }
        }
示例#7
0
        /// <summary>
        /// Event wird aufgerufen wenn TouchDown auf Skalieren-Schaltfläche.
        /// Speichert Touchpunkte.
        /// </summary>
        /// <param name="sender">Sender</param>
        /// <param name="e">Eventparameter</param>
        private void ScaleButtonDown(object sender, TouchEventArgs e)
        {
            // Capture to the ScaleButton.
            e.TouchDevice.Capture(this.ScaleButton);

            // Remember this contact if a contact has not been remembered already.
            // This contact is then used to move the ellipse around.
            if (_scaleControlTouchDevice == null)
            {
                _scaleControlTouchDevice = e.TouchDevice;

                // Remember where this contact took place.
                _lastPoint           = _scaleControlTouchDevice.GetTouchPoint(this.MainGrid).Position;
                _lastValidScalePoint = _lastPoint;
                // Console.WriteLine("first Point: (" + _lastPoint.X + ", " + _lastPoint.Y + " )");
            }

            _parentSVI.CanMove = false;

            // Mark this event as handled.
            e.Handled = true;
        }
示例#8
0
        private int GetMendedFingerCount(IEnumerable <IManipulator> manipulators)
        {
            int sum = 0;

            foreach (var mani in manipulators)
            {
                TouchDevice device = (TouchDevice)mani;
                TouchPoint  point  = device.GetTouchPoint(Application.Current.MainWindow);
                double      width  = point.Size.Width;
                double      height = GestureDetector.GetMendedHeight(point.Size.Width, point.Size.Height);
                double      ratio  = height / width;
                if (ratio > GestureConsts.Current.FingerHeightWidhtRatio || ratio < (1 / GestureConsts.Current.FingerHeightWidhtRatio))
                {
                    sum += 2;
                }
                else
                {
                    sum += 1;
                }
            }
            return(sum);
        }
示例#9
0
 /// <summary>
 /// Fire the Hold event
 /// </summary>
 void Tmer_Hold(object sender, EventArgs e)
 {
     timer.Stop();
     if (this.AssociatedObject.TouchesOver.Count() > 0)
     {
         TouchDevice device   = this.AssociatedObject.TouchesOver.First();
         TouchPoint  point    = device.GetTouchPoint(Application.Current.MainWindow);
         Point       startPos = (Point)timer.Tag;
         if (point.Position.Sub(startPos).Length() < GestureConsts.Current.ShakedThreshold)
         {
             if (this.isHold && this.OnGestureDetector != null)
             {
                 this.currentResult = GestureResult.Hold;
                 GestureArg arg = new GestureArg(this.AssociatedObject, this.currentResult, null);
                 arg.Tag = this.timer.Tag;
                 this.OnGestureDetector(this.AssociatedObject, arg);
                 this.isGestureBehavior = true;
                 this.isHold            = false;
             }
         }
     }
 }
示例#10
0
        private void groupBox2_TouchDown(object sender, TouchEventArgs e)
        {
            // Capture to the groupbox.
            e.TouchDevice.Capture(this.groupBox2);

            // Remember this contact if a contact has not been remembered already.
            // This contact is then used to move the groupbox around.
            if (ControlTouchDevice == null)
            {
                ControlTouchDevice = e.TouchDevice;

                // Remember where this contact took place.
                lastPoint2 = ControlTouchDevice.GetTouchPoint(this.canvas);
                Cuadro2_X  = lastPoint2.Position.X;
                Cuadro2_Y  = lastPoint2.Position.Y;

                if (lineStarted & !lineDrawn)
                {
                    line = new Line();
                    SolidColorBrush mySolidColorBrush = new SolidColorBrush();
                    mySolidColorBrush.Color = Color.FromArgb(255, 234, 234, 234);
                    line.Fill            = mySolidColorBrush;
                    line.StrokeThickness = 2;
                    line.Stroke          = Brushes.Black;
                    line.X1 = Cuadro_X;
                    line.Y1 = Cuadro_Y;
                    line.X2 = Cuadro2_X;
                    line.Y2 = Cuadro2_Y;
                    canvas.Children.Add(line);
                    lineStarted = false;
                    lineDrawn   = true;
                }
            }

            // Mark this event as handled.
            e.Handled = true;
        }
示例#11
0
        private bool CheckIsAreaGesture(ManipulationDeltaEventArgs e)
        {
            int fingerCount = this.AssociatedObject.TouchesOver.Count();

            if (fingerCount > this.gestureFingerCount)
            {
                this.gestureFingerCount = fingerCount;
            }

            TouchDevice device       = (TouchDevice)e.Manipulators.First();
            TouchPoint  point        = device.GetTouchPoint(Application.Current.MainWindow);
            double      mendedHeight = GestureDetector.GetMendedHeight(point.Size.Width, point.Size.Height);

            if (GestureDetector.IsErase(point.Size.Width, mendedHeight))
            {
                if (this.OnGestureDetector != null)
                {
                    this.currentResult = GestureResult.Brush;
                    GestureArg arg = new GestureArg(this.AssociatedObject, this.currentResult, device);
                    arg.Tag = new Rect(point.Position.X, point.Position.Y, point.Size.Width, mendedHeight);
                    this.OnGestureDetector(this.AssociatedObject, arg);
                }
                this.isGestureBehavior = true;
                return(true);
            }
            else
            {
                if (this.gestureFingerCount == 1)
                {
                    double checkWidht  = point.Size.Width;
                    double checkHeight = mendedHeight;
                    double checkRadio  = checkHeight / checkWidht;
                    bool   isZoom      = this.IsZoom(e.CumulativeManipulation.Scale);
                    if (
                        (checkRadio > GestureConsts.Current.FingerHeightWidhtRatio || checkWidht < (1 / GestureConsts.Current.FingerHeightWidhtRatio)) &&
                        (Math.Min(checkWidht, checkHeight) > GestureConsts.Current.OneFingerSize)
                        )
                    {
                        if (this.gestureStatusBehavior != null)
                        {
                            this.gestureStatusBehavior(new GestureArg(this.AssociatedObject, GestureResult.MultipleFingers, device));
                        }
                        if (e.CumulativeManipulation.Translation.Length > GestureConsts.Current.MultiFingerDragThreshold && isZoom == false)
                        {
                            if (this.OnGestureDetector != null)
                            {
                                this.currentResult = GestureResult.Drag;
                                GestureArg arg = new GestureArg(this.AssociatedObject, this.currentResult, device);
                                arg.Tag = e.CumulativeManipulation.Translation;
                                this.OnGestureDetector(this.AssociatedObject, arg);
                            }
                            this.isGestureBehavior = true;
                            return(true);
                        }
                    }

                    else if (e.CumulativeManipulation.Translation.Length > GestureConsts.Current.MultiFingerDragThreshold && isZoom == false)
                    {
                        if (this.OnGestureDetector != null)
                        {
                            this.currentResult = GestureResult.OneFinger;
                            this.OnGestureDetector(this.AssociatedObject, new GestureArg(this.AssociatedObject, this.currentResult, device));
                        }
                        this.isGestureBehavior = true;
                        return(true);
                    }
                }
            }
            return(false);
        }
        /// <summary>
        /// Event wird aufgerufen wenn TouchMove auf SafeSelect.
        /// </summary>
        /// <param name="sender">Sender</param>
        /// <param name="e">Eventparameter</param>
        private void OptionTouchMove(object sender, TouchEventArgs e)
        {
            // If this contact is the one that was remembered
            if (e.TouchDevice == OptionControlTouchDevice)
            {
                double touchPointXOnGrid = OptionControlTouchDevice.GetTouchPoint(this.SolvingGrid).Position.X;
                touchPointXOnGrid = touchPointXOnGrid - TouchPointXOnButton;
                if (touchPointXOnGrid < 21)
                {
                    touchPointXOnGrid = 21;
                }
                else if (touchPointXOnGrid > 121)
                {
                    touchPointXOnGrid = 121;
                }
                ((SurfaceButton)sender).Margin = new Thickness(touchPointXOnGrid, ((SurfaceButton)sender).Margin.Top, ((SurfaceButton)sender).Margin.Right, ((SurfaceButton)sender).Margin.Bottom);

                DoNothingText.Foreground = new SolidColorBrush(Colors.White);
                PausePlayText.Foreground = new SolidColorBrush(Colors.White);
                StopText.Foreground      = new SolidColorBrush(Colors.White);
                KillText.Foreground      = new SolidColorBrush(Colors.White);
                if (touchPointXOnGrid < 100)
                {
                    ChosenMeasureText.Foreground = new SolidColorBrush((Color)FindResource("TouchLineColor_Base"));
                    ConfirmRectangle.Fill        = new SolidColorBrush((Color)FindResource("TouchLineColor_Base"));
                    if (_chosenControl.Equals(ChosenControl.None))
                    {
                        DoNothingText.Foreground = new SolidColorBrush((Color)FindResource("TouchLineColor_Base"));
                    }
                    else if (_chosenControl.Equals(ChosenControl.PausePlay))
                    {
                        PausePlayText.Foreground = new SolidColorBrush((Color)FindResource("TouchLineColor_Base"));
                    }
                    else if (_chosenControl.Equals(ChosenControl.Stop))
                    {
                        StopText.Foreground = new SolidColorBrush((Color)FindResource("TouchLineColor_Base"));
                    }
                    else if (_chosenControl.Equals(ChosenControl.Kill))
                    {
                        KillText.Foreground = new SolidColorBrush((Color)FindResource("TouchLineColor_Base"));
                    }
                }
                else
                {
                    ChosenMeasureText.Foreground = new SolidColorBrush((Color)FindResource("TouchLineColor_Chosen"));
                    ConfirmRectangle.Fill        = new SolidColorBrush((Color)FindResource("TouchLineColor_Chosen"));
                    if (_chosenControl.Equals(ChosenControl.None))
                    {
                        DoNothingText.Foreground = new SolidColorBrush((Color)FindResource("TouchLineColor_Chosen"));
                    }
                    else if (_chosenControl.Equals(ChosenControl.PausePlay))
                    {
                        PausePlayText.Foreground = new SolidColorBrush((Color)FindResource("TouchLineColor_Chosen"));
                    }
                    else if (_chosenControl.Equals(ChosenControl.Stop))
                    {
                        StopText.Foreground = new SolidColorBrush((Color)FindResource("TouchLineColor_Chosen"));
                    }
                    else if (_chosenControl.Equals(ChosenControl.Kill))
                    {
                        KillText.Foreground = new SolidColorBrush((Color)FindResource("TouchLineColor_Chosen"));
                    }
                }
            }
        }
示例#13
0
        void TouchMovementStarting(object sender, TouchEventArgs e)
        {
            TouchDevice c = e.TouchDevice;

            initialpoint = c.GetTouchPoint(this).Position;
        }