Ejemplo n.º 1
0
 void MenuContent_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
 {
     if (e.FinalVelocities.LinearVelocity.Y < -500)
     {
         Storyboard6.Begin();
     }
 }
Ejemplo n.º 2
0
        private void HandleManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
        {
            sender.AsOption <UIElement>().Do(
                element =>
            {
                var modifier =
                    GetMostRepresentativeNumberOfTouchPoints(_gestureSurfaceTouchRegistry[element])
                    .Map(ToGestureModifier);

                var totalTranslation           = e.TotalManipulation.Translation;
                var finalLinearVelocity        = e.FinalVelocities.LinearVelocity;
                var observers                  = _observersOfElement[element];
                var observersPairedWithGesture =
                    observers.Select(
                        o =>
                        new
                {
                    Observer = o,
                    Gesture  =
                        ToSwipeGesture(totalTranslation, finalLinearVelocity,
                                       o.UseVelocityForTapDetection, o.TapThreshold),
                    Modifier = modifier
                });

                foreach (var observerWithGesture in observersPairedWithGesture)
                {
                    observerWithGesture.Observer.OnGestureDetected(observerWithGesture.Gesture, observerWithGesture.Modifier);
                }
            });
        }
Ejemplo n.º 3
0
    /** ManCompleteReaction
     *
     * Called when the Manipulation/move event is completed.
     *
     */
    public void ManCompleteReaction(ManipulationCompletedEventArgs args)
    {
        StateMachine.State state = StateMachine.Instance.state;
        switch (state)
        {
        case StateMachine.State.Calibration:
            CaliMan c = this as CaliMan;
            if (c != null)
            {
                c.ManComplete(args);
            }
            break;

        case StateMachine.State.Interaction:
            InterMan i = this as InterMan;
            if (i != null)
            {
                i.ManComplete(args);
            }
            break;

        case StateMachine.State.Adjusting:
            AdjMan a = this as AdjMan;
            if (a != null)
            {
                a.ManComplete(args);
            }
            break;

        default:
            Debug.Log("Unkonwn State");
            break;
        }
    }
Ejemplo n.º 4
0
 private void dragInterceptor_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
 {
     if (this.dragItem == null)
     {
         this.scrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
     }
     else
     {
         e.Handled            = true;
         this._isManipulating = false;
         if (this.dropTargetIndex >= 0)
         {
             this.MoveItem(this.dragItem, this.dropTargetIndex);
         }
         if (this.dragItemContainer != null)
         {
             this.dragItemContainer.Visibility = Visibility.Visible;
             this.dragItemContainer.Opacity    = 0.0;
             this.AnimateDrop(this.dragItemContainer);
             this.dragItemContainer = (ReorderListBoxItem)null;
         }
         this.dragScrollDelta = 0.0;
         this.dropTargetIndex = -1;
         this.ClearDropTarget();
         this.scrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
     }
 }
 private void Image_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
 {
     if (this.dragImage != null && this.isMoveToy)
     {
         e.Handled = true;
     }
 }
        private void UiElementOnManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
        {
            var gesture = gestureRecognizer.Gesture;

            if (isDoubleTapping && Math.Abs(e.TotalManipulation.Translation.X) < 0.02)
            {
                PinchAction?.Invoke();
            }
            else if (gesture == TouchGestureType.MoveRightToLeft)
            {
                SwipeLeftAction?.Invoke();
            }
            else if (gesture == TouchGestureType.MoveLeftToRight)
            {
                SwipeRightAction?.Invoke();
            }
            else if (gesture == TouchGestureType.MoveBottomToUp)
            {
                SwipeUpAction?.Invoke();
            }
            else if (gesture == TouchGestureType.MoveTopToBottom)
            {
                SwipeDownAction?.Invoke();
            }
            else if (gesture == TouchGestureType.SingleTap)
            {
                SingleTapAction?.Invoke();
            }
        }
Ejemplo n.º 7
0
        private void _menuCallout_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
        {
            if (!this.CheckShouldRespondToManipulation())
            {
                return;
            }
            if (e.OriginalSource == this._menuCallout)
            {
                e.Handled = true;
            }
            this._manipulationStarted = false;
            Point  point;
            double num1;

            if (e.FinalVelocities != null)
            {
                point = e.FinalVelocities.LinearVelocity;
                num1  = point.X;
            }
            else
            {
                num1 = 0.0;
            }
            double num2 = num1;

            point = e.TotalManipulation.Translation;
            double x = point.X;

            this.OpenCloseMenu(!this.IsMenuOpen ? x >= 216.0 || num2 >= 10.0 : x > -216.0 && num2 > -10.0, null, false);
        }
Ejemplo n.º 8
0
        private void Element_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
        {
            if (!IsActive)
            {
                return;
            }

            FrameworkElement fe = sender as FrameworkElement;

            if (Math.Abs(e.TotalManipulation.Translation.X) > fe.ActualWidth / 2 ||
                Math.Abs(e.FinalVelocities.LinearVelocity.X) > FlickVelocity)
            {
                if (e.TotalManipulation.Translation.X < 0.0)
                {
                    ToDoItemDeletedAction(fe);
                }
                else
                {
                    ToDoItemCompletedAction(fe);
                }
            }
            else
            {
                ToDoItemBounceBack(fe, null);
            }

            IsActive = false;
        }
Ejemplo n.º 9
0
 private void LB_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
 {
     if (_isBouncy)
     {
         _isBouncy = false;
     }
 }
Ejemplo n.º 10
0
        protected override void OnManipulationCompleted(ManipulationCompletedEventArgs e)
        {
            tbCompleted.Text  = string.Format("{0}", e.FinalVelocities.LinearVelocity);
            tbCompleted.Text += string.Format("\r\n{0}", e.TotalManipulation.Translation);
            //UIElement el = e.Source as UIElement;
            //el.Effect = new BlurEffect() { Radius= 10.0};

            //MatrixTransform xform = el.RenderTransform as MatrixTransform;
            //Matrix matrix = xform.Matrix;
            //Matrix from = matrix;
            //Matrix to = matrix;
            //to.Translate(e.TotalManipulation.Translation.X * Math.Abs(e.FinalVelocities.LinearVelocity.X), e.TotalManipulation.Translation.Y * Math.Abs(e.FinalVelocities.LinearVelocity.Y));

            //if (Math.Abs(e.FinalVelocities.LinearVelocity.X) > 0.5 || Math.Abs(e.FinalVelocities.LinearVelocity.Y) > 0.5)
            //{
            //  MatrixAnimation b = new MatrixAnimation()
            //  {
            //    From = from,
            //    To = to,
            //    Duration = TimeSpan.FromMilliseconds(500),
            //    FillBehavior = FillBehavior.HoldEnd
            //  };
            //  (el.RenderTransform as MatrixTransform).BeginAnimation(MatrixTransform.MatrixProperty, b);
            //}


            base.OnManipulationCompleted(e);
        }
Ejemplo n.º 11
0
        private void textBlock1_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
        {
            if (e.TotalManipulation.Translation.X < -100)// move the object to left
            {
                textBlockSendIndicator.Text = "Must sent";
                //DoubleAnimation da = new DoubleAnimation();
                //da.Duration = new Duration(new TimeSpan(0, 0, 2));
                //da.To = 0;
                //Storyboard myStoryboard = new Storyboard();
                //myStoryboard.Children.Add(da);
                //Storyboard.SetTargetName(da, "textBlock1");
                //Storyboard.SetTargetProperty(da, new PropertyPath(Rectangle.OpacityProperty));
                //myStoryboard.Begin();
                FadeTextBlock.Begin();

                client.Send("__TEXT__" + textBlockText.Text);
                if (client.Receive() == "__TEXT__RECV")
                {
                    textBlockSendIndicator.Text = "Successful sent.";
                }
            }
            else
            {
                textBlockSendIndicator.Text = "Dont send.";
            }
        }
 private void LayoutRoot_OnManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
 {
     if (!_cancelRequested && Hint.Visibility == Visibility.Collapsed)
     {
         StopRecording();
     }
 }
Ejemplo n.º 13
0
 private void Border_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
 {
     // suppress zoom
     //if (e.FinalVelocities.ExpansionVelocity.X != 0.0 ||
     //    e.FinalVelocities.ExpansionVelocity.Y != 0.0)
     //    e.Handled = true;
 }
        void btnFull_ManipulationCompleted(object sender, ManipulationCompletedEventArgs args)
        {
            //DeBug...

            /*
             * txImgDetails.Text = "CX: " + (args.ManipulationOrigin.X - m_ptDragStart.X).ToString() +
             *      "\r\n" + "CY: " + (args.ManipulationOrigin.Y - m_ptDragStart.Y).ToString();
             */

            imgFull.Margin = new Thickness(0);

            double dCX = args.ManipulationOrigin.X - m_ptDragStart.X;

            if (dCX > 100)
            {
                if (_Prev())
                {
                    args.Handled = true;
                }
            }
            else if (dCX < -100)
            {
                if (_Next())
                {
                    args.Handled = true;
                }
            }
            else
            {
                //NOP...
            }
        }
Ejemplo n.º 15
0
 private void ListBox_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
 {
     if (IsBouncy)
     {
         IsBouncy = false;
     }
 }
Ejemplo n.º 16
0
        void CalendarManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
        {
            e.Handled = true;
            while (TouchPanel.IsGestureAvailable)
            {
                var gesture = TouchPanel.ReadGesture();
                if (gesture.GestureType == GestureType.Flick)
                {
                    double horizontal = gesture.Delta.X / Factor;
                    double vertical   = gesture.Delta.Y / Factor;

                    if (Math.Abs(vertical) > 1.5 * Math.Abs(horizontal))
                    {
                        if (vertical > 0)
                        {
                            IncrementMonth();
                        }
                        else
                        {
                            DecrementMonth();
                        }
                    }
                }
            }
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Called when the ManipulationCompleted event occurs.
        /// </summary>
        /// <param name="e">Event data for the event.</param>
        protected override void OnManipulationCompleted(ManipulationCompletedEventArgs e)
        {
            if (null == e)
            {
                throw new ArgumentNullException("e");
            }

            base.OnManipulationCompleted(e);

            // Interaction needs to be on the _itemsPresenterHostPart or its children
            DependencyObject element = e.OriginalSource as DependencyObject;

            while (null != element)
            {
                if (_itemsPresenterHostPart == element)
                {
                    // On interaction, switch to Expanded/Full mode
                    if ((ListPickerMode.Normal == ListPickerMode) && (0 < Items.Count))
                    {
                        ListPickerMode = (Items.Count <= ItemCountThreshold) ? ListPickerMode.Expanded : ListPickerMode.Full;
                        e.Handled      = true;
                    }
                    break;
                }
                element = VisualTreeHelper.GetParent(element);
            }
        }
Ejemplo n.º 18
0
        protected override void OnManipulationCompleted(ManipulationCompletedEventArgs e)
        {
            base.OnManipulationCompleted(e);

            // set it back
            this.PanningMode = this.panningMode;
        }
Ejemplo n.º 19
0
 /// <summary>
 /// Converts <see cref="ManipulationCompletedEventArgs" /> to <see cref="OxyMouseEventArgs" /> for a touch completed event.
 /// </summary>
 /// <param name="e">The <see cref="ManipulationCompletedEventArgs" /> instance containing the event data.</param>
 /// <param name="relativeTo">The <see cref="UIElement" /> that the event is relative to.</param>
 /// <returns>A <see cref="OxyMouseEventArgs" /> containing the converted event arguments.</returns>
 public static OxyTouchEventArgs ToTouchEventArgs(this ManipulationCompletedEventArgs e, UIElement relativeTo)
 {
     return(new OxyTouchEventArgs
     {
         Position = e.ManipulationOrigin.ToScreenPoint() + e.TotalManipulation.Translation.ToScreenVector(),
     });
 }
Ejemplo n.º 20
0
 private void Swipable_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
 {
     if (e.FinalVelocities.LinearVelocity.X > 10)
     {
         this.SwipeTransform.TranslateX = 0;
     }
 }
Ejemplo n.º 21
0
        private void Trackpad_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
        {
            var origin = e.ManipulationOrigin;

            ServerManager.CurrentServer.AppleTVTrackpadTouchRelease((short)origin.X, (short)origin.Y);
            _isDragging = false;
        }
Ejemplo n.º 22
0
 private void HomepageTextBlock_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
 {
     new WebBrowserTask
     {
         URL = "http://www.pedrolamas.com"
     }.Show();
 }
Ejemplo n.º 23
0
        private void InkPresenter_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
        {
            double touchX = e.ManipulationOrigin.X + e.TotalManipulation.Translation.X;
            double touchY = e.ManipulationOrigin.Y + e.TotalManipulation.Translation.Y;
#endif
            lastX = touchX;
            lastY = touchY;

            // Create a new path and move to the touched point.
            if (CurrentPath != null)
            {
                CurrentPath.Points.Add(new Point(touchX, touchY));
            }

            Polyline newPath = SmoothedPathWithGranularity(0, CurrentPath.Points);

            newPath.Stroke          = StrokeColor;
            newPath.StrokeThickness = StrokeThickness;

            inkPresenter.Children.Add(newPath);

            CurrentPath.Points.Clear();

            NotifyIsBlankChanged();
        }
 /// <summary>
 /// Converts <see cref="ManipulationCompletedEventArgs" /> to <see cref="OxyMouseEventArgs" /> for a touch completed event.
 /// </summary>
 /// <param name="e">The <see cref="ManipulationCompletedEventArgs" /> instance containing the event data.</param>
 /// <param name="source">The <see cref="FrameworkElement"/> that is event source</param>
 /// <param name="relativeTo">The <see cref="UIElement" /> that the event is relative to.</param>
 /// <param name="offset">The <see cref="Vector" /> offset that event is relative to.</param>
 /// <returns>A <see cref="OxyMouseEventArgs" /> containing the converted event arguments.</returns>
 public static OxyTouchEventArgs ToTouchEventArgs(this ManipulationCompletedEventArgs e, FrameworkElement source, FrameworkElement relativeTo, Vector offset)
 {
     return(new OxyTouchEventArgs
     {
         Position = (source.TranslatePoint(e.ManipulationOrigin, relativeTo) + offset).ToScreenPoint(),
     });
 }
Ejemplo n.º 25
0
        private void mainFragment_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
        {
            // Get left of _listFragment
            var transform = (TranslateTransform)_listFragment.RenderTransform;

            if (transform == null)
            {
                return;
            }
            var left = transform.X;

            // Set snap divider to 1/3 of _mainFragment width
            var snapLimit = _mainFragment.ActualWidth / 3;

            // Get init position of _listFragment
            var initialPosition = -_listFragment.Width;

            // If current left coordinate is smaller than snap limit, close drawer
            if (Math.Abs(initialPosition - left) < snapLimit)
            {
                MoveListFragment(initialPosition, Color.FromArgb(0, 0, 0, 0));

                _shadowFragment.Visibility       = Visibility.Collapsed;
                _shadowFragment.IsHitTestVisible = false;

                _mainFragment.IsHitTestVisible = true;

                _mainFragment.ManipulationDelta     -= mainFragment_ManipulationDelta;
                _mainFragment.ManipulationCompleted -= mainFragment_ManipulationCompleted;
                IsDrawerOpen = false;

                // raise DrawerClosed event
                if (DrawerClosed != null)
                {
                    DrawerClosed(this);
                }
            }
            // else open drawer
            else if (Math.Abs(initialPosition - left) > snapLimit)
            {
                // move drawer to zero
                MoveListFragment(0, Color.FromArgb(190, 0, 0, 0));

                _shadowFragment.Visibility       = Visibility.Visible;
                _shadowFragment.IsHitTestVisible = true;

                _mainFragment.IsHitTestVisible = false;

                _mainFragment.ManipulationDelta     -= mainFragment_ManipulationDelta;
                _mainFragment.ManipulationCompleted -= mainFragment_ManipulationCompleted;
                IsDrawerOpen = true;

                // raise DrawerClosed event
                if (DrawerOpened != null)
                {
                    DrawerOpened(this);
                }
            }
        }
Ejemplo n.º 26
0
        protected internal void websiteClick_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
        {
            var web = new WebBrowserTask {
                Uri = new Uri(WebSiteUrl)
            };

            web.Show();
        }
Ejemplo n.º 27
0
 private void GestureManipulationCompleted(ManipulationCompletedEventArgs args)
 {
     if (CorrectHand(args.source))
     {
         Transmitter.SendButton(_tracker, "manipulation", false);
         SetManipulation(0f, 0f, 0f);
     }
 }
Ejemplo n.º 28
0
    private void OnManipulationComplete(ManipulationCompletedEventArgs obj)
    {
        stopManipulationThisFrame = true;
        isManipulating            = false;

        manipulationFrameDelta = new Vector3(0, 0, 0);
        manipulationFullDelta  = new Vector3(0, 0, 0);
    }
Ejemplo n.º 29
0
        public void Ended(ManipulationCompletedEventArgs e)
        {
            Apply(e.ManipulationOrigin);

            Element = null;
            RaiseElementChanged();
            TargetImage.Invalidate();
        }
Ejemplo n.º 30
0
        private void Items_OnManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
        {
            //if (_lastInvokeTime != null && _lastInvokeTime.Value.AddSeconds(10.0) > DateTime.Now) return;

            //_lastInvokeTime = DateTime.Now;
            //ViewModel.LoadNextSlice();
            this.Focus();
        }
Ejemplo n.º 31
0
 private void canvas_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
 {
     var left = Canvas.GetLeft(LayoutRoot);
     if (_viewMoved)
         return;
     if (Math.Abs(initialPosition - left) < 100)
     {
         //bouncing back
         MoveViewWindow(initialPosition);
         return;
     }
     //change of state
     if (initialPosition - left > 0)
     {
         //slide to the left
         if (initialPosition > -420)
             MoveViewWindow(-420);
         else
             MoveViewWindow(-840);
     }
     else
     {
         //slide to the right
         if (initialPosition < -420)
             MoveViewWindow(-420);
         else
             MoveViewWindow(0);
     }
 }
Ejemplo n.º 32
0
        /*private void newTaskForm_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
        {
        }*/

        private void newTaskForm_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
        {
        }
Ejemplo n.º 33
0
 private void PhoneApplicationPage_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
 {
 }
Ejemplo n.º 34
0
 private void query_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
 {
 }