示例#1
0
 private void SlidePanel_ManipulationCompleted(object sender, Windows.UI.Xaml.Input.ManipulationCompletedRoutedEventArgs e)
 {
     if (e.Position.X > _prePoint.X && _child.Margin.Left < 0)
     {
         e.Handled = true;
         if (System.Math.Abs(_child.Margin.Right) > e.Position.X - _prePoint.X)
         {
             _child.Margin = new Thickness(_child.Margin.Left + (e.Position.X - _prePoint.X), 0, _child.Margin.Right - (e.Position.X - _prePoint.X), 0);
         }
         else
         {
             _child.Margin = new Thickness(0, 0, _child.Margin.Right - System.Math.Abs(_child.Margin.Left), 0);
         }
     }
     else if (e.Position.X < _prePoint.X && _child.Margin.Right < 0)
     {
         e.Handled = true;
         if (e.Position.X - _prePoint.X < _child.Margin.Right)
         {
             _child.Margin = new Thickness(_child.Margin.Left + (e.Position.X - _prePoint.X), 0, _child.Margin.Right - (e.Position.X - _prePoint.X), 0);
         }
         else
         {
             _child.Margin = new Thickness(_child.Margin.Left + _child.Margin.Right, 0, 0, 0);
         }
     }
 }
示例#2
0
        private void LayoutRoot_ManipulationCompleted(object sender, Windows.UI.Xaml.Input.ManipulationCompletedRoutedEventArgs e)
        {
            dragTranslation.Y = 0;
            dragTranslation.X = 0;

            UpdatePosition(0.0f);
        }
 private void LayoutRoot_ManipulationCompleted(object sender, Windows.UI.Xaml.Input.ManipulationCompletedRoutedEventArgs e)
 {
     MultiTouch  = false;
     FingerCount = 0;
     _lastMultiPoint.Clear();
     _currentMutilPoint.Clear();
 }
示例#4
0
        private void Control_ManipulationCompleted(object sender, Windows.UI.Xaml.Input.ManipulationCompletedRoutedEventArgs e)
        {
            if (e.Cumulative.Translation != null)
            {
                Windows.Foundation.Point p = e.Cumulative.Translation;
                if (((p.X * p.X) + (p.Y * p.Y)) > 244)
                {
                    Element element = GetElement(sender);
                    this.RaiseEvent(element, new GestureMonitorEventArgs(element, GestureType.Swipe));

                    if (p.X > 10)
                    {
                        this.RaiseEvent(element, new GestureMonitorEventArgs(element, GestureType.SwipeRight));
                    }
                    if (p.X < -10)
                    {
                        this.RaiseEvent(element, new GestureMonitorEventArgs(element, GestureType.SwipeLeft));
                    }


                    if (p.Y > 10)
                    {
                        this.RaiseEvent(element, new GestureMonitorEventArgs(element, GestureType.SwipeDown));
                    }
                    if (p.Y < -10)
                    {
                        this.RaiseEvent(element, new GestureMonitorEventArgs(element, GestureType.SwipeUp));
                    }
                }
            }
        }
示例#5
0
 private static void FrameworkElement_ManipulationCompleted(object sender, Windows.UI.Xaml.Input.ManipulationCompletedRoutedEventArgs e)
 {
     if (PointerDeviceType.Touch.Equals(e.PointerDeviceType))
     {
         System.Diagnostics.Debug.WriteLine($"ManipulationCompleted{e.Position.X},{e.Position.Y}");
     }
 }
 public UwpRotateEventArgs(Windows.UI.Xaml.FrameworkElement element, Windows.UI.Xaml.Input.ManipulationCompletedRoutedEventArgs args)
 {
     ViewPosition = element.GetXfViewFrame();
     Touches      = new Xamarin.Forms.Point[] { args.Position.ToXfPoint() };
     Angle        = 0;
     TotalAngle   = args.Cumulative.Rotation;
 }
示例#7
0
        /// <summary>
        /// save pointer state from ManipulationCompletedRoutedEventArgs
        /// </summary>
        /// <param name="e"></param>
        /// <returns></returns>
        public static PointerState _(Windows.UI.Xaml.Input.ManipulationCompletedRoutedEventArgs e, object sender, string remarks)
        {
            var ret = new PointerState
            {
                Sender      = sender,
                Remarks     = remarks,
                Position    = ScreenPos.From(e.Position.X, e.Position.Y),
                IsInContact = false,
                Scale       = e.Cumulative.Scale,
                Rotation    = Angle.FromDeg(e.Cumulative.Rotation),
                Time        = DateTime.Now,
            };

            switch (e.PointerDeviceType)
            {
            case PointerDeviceType.Pen:
                ret.DeviceType = PointerState.DeviceTypes.Pen;
                break;

            case PointerDeviceType.Touch:
                ret.DeviceType = PointerState.DeviceTypes.Touch;
                break;

            case PointerDeviceType.Mouse:
                ret.DeviceType = PointerState.DeviceTypes.Mouse;
                break;
            }
            return(ret);
        }
示例#8
0
 private void Rating_ManipulationCompleted(object sender, Windows.UI.Xaml.Input.ManipulationCompletedRoutedEventArgs e)
 {
     if (!ReadOnly)
     {
         PerformValueCalculation(e.Position, e.Container);
     }
     ChangeDragHelperVisibility(false);
 }
 private async void ImageCropperPreview_ManipulationCompleted(object sender, Windows.UI.Xaml.Input.ManipulationCompletedRoutedEventArgs e)
 {
     await SetSelectedRegionInViewModel();
     await RunOnUIThreadAsync(CoreDispatcherPriority.Normal, () =>
     {
         ImageCropperPreview.Focus(FocusState.Programmatic);
     });
 }
示例#10
0
        public UwpPinchEventArgs(Windows.UI.Xaml.FrameworkElement element, Windows.UI.Xaml.Input.ManipulationCompletedRoutedEventArgs args)
        {
            ElementPosition = element.GetXfViewFrame();
            var point = args.Position;

            ElementTouches = new Xamarin.Forms.Point[] { point.ToXfPoint() };
            WindowTouches  = new Xamarin.Forms.Point[] { element.PointInNativeAppWindowCoord(point).ToXfPoint() };
            TotalScale     = args.Cumulative.Scale;
        }
示例#11
0
        private void MainContent_ManipulationCompleted(object sender, Windows.UI.Xaml.Input.ManipulationCompletedRoutedEventArgs e)
        {
            if (this.shouldAnimate)
            {
                double cumulativeTranslation = 0;
                double animationDistance     = 0;
                switch (this.DrawerLocation)
                {
                case DrawerLocation.Left:
                    cumulativeTranslation = e.Cumulative.Translation.X;
                    animationDistance     = this.drawer.Width;
                    break;

                case DrawerLocation.Right:
                    cumulativeTranslation = -e.Cumulative.Translation.X;
                    animationDistance     = this.drawer.Width;
                    break;

                case DrawerLocation.Top:
                    cumulativeTranslation = e.Cumulative.Translation.Y;
                    animationDistance     = this.drawer.Height;
                    break;

                case DrawerLocation.Bottom:
                    cumulativeTranslation = -e.Cumulative.Translation.Y;
                    animationDistance     = this.drawer.Height;
                    break;
                }

                var offset = (cumulativeTranslation / animationDistance) * this.AnimationDuration.TimeSpan.Milliseconds;

                if (cumulativeTranslation > animationDistance / 3)
                {
                    this.Context.MainContentStoryBoard.Resume();
                    this.Context.DrawerStoryBoard.Resume();

                    this.IsOpen = true;
                }
                else
                {
                    this.Context.MainContentStoryBoardReverse.Begin();
                    this.Context.MainContentStoryBoardReverse.Pause();
                    this.Context.DrawerStoryBoardReverse.Begin();
                    this.Context.DrawerStoryBoardReverse.Pause();

                    this.Context.MainContentStoryBoardReverse.Seek(TimeSpan.FromMilliseconds(this.AnimationDuration.TimeSpan.Milliseconds - offset));
                    this.Context.DrawerStoryBoardReverse.Seek(TimeSpan.FromMilliseconds(this.AnimationDuration.TimeSpan.Milliseconds - offset));

                    this.Context.MainContentStoryBoardReverse.Resume();
                    this.Context.DrawerStoryBoardReverse.Resume();

                    this.IsOpen = false;
                }

                this.shouldAnimate = false;
            }
        }
示例#12
0
 private void border_ManipulationCompleted(object sender, Windows.UI.Xaml.Input.ManipulationCompletedRoutedEventArgs e)
 {
     e.Handled = true;
     if (isX)
     {
         media.Play();
         icon.Symbol = Symbol.Pause;
     }
 }
        private void TimelinePanel_ManipulationCompleted(object sender, Windows.UI.Xaml.Input.ManipulationCompletedRoutedEventArgs e)
        {
            if (IsLocked)
            {
                return;
            }

            _manipulating = false;
            InvalidateArrange();
        }
示例#14
0
 private void StrengthIndicator_ManipulationCompleted(object sender, Windows.UI.Xaml.Input.ManipulationCompletedRoutedEventArgs e)
 {
     if (e.Cumulative.Translation.X > 30)
     {
         InteractiveIndicator.Value++;
     }
     else if (e.Cumulative.Translation.X < -30)
     {
         InteractiveIndicator.Value--;
     }
 }
 void toastGrid_ManipulationCompleted(object sender, Windows.UI.Xaml.Input.ManipulationCompletedRoutedEventArgs e)
 {
     if (e.Cumulative.Translation.X < 60)
     {
         toastTransform.X = 0;
     }
     else
     {
         HideStoryboard(toastTransform.X);
     }
 }
示例#16
0
        private void ListViewItem_ManipulationCompleted(object sender, Windows.UI.Xaml.Input.ManipulationCompletedRoutedEventArgs e)
        {
            SwipeableListViewItem listViewItem = sender as SwipeableListViewItem;

            if (listViewItem != null)
            {
                listViewItem.CheckSwipeStatus();
                listViewItem.HideLeftContentPresenter();
                listViewItem.HideRightContentPresenter();
            }
        }
示例#17
0
 private void UpdatePanel_ManipulationCompleted(object sender, Windows.UI.Xaml.Input.ManipulationCompletedRoutedEventArgs e)
 {
     e.Handled = true;
     if (UpdatePanelTrans.X >= UpdatePanel.ActualWidth / 5)
     {
         HideUpdateButton_Click(null, null);
     }
     else
     {
         ShowUpdateDetailAni.Begin();
     }
 }
 private void Sv_ManipulationCompleted(object sender, Windows.UI.Xaml.Input.ManipulationCompletedRoutedEventArgs e)
 {
     movedX = e.Position.X;
     movedY = e.Position.Y;
     if (xsv.Orientation == ScrollOrientation.Horizontal)
     {
         xsv.ScrollToAsync((movedX - currentX) * -1, 0, true);
     }
     else
     {
         xsv.ScrollToAsync(0, (movedY + currentY) * -1, true);
     }
 }
示例#19
0
        private async void image_ManipulationCompleted(object sender, Windows.UI.Xaml.Input.ManipulationCompletedRoutedEventArgs e)
        {
            var deltaX = e.Cumulative.Translation.X;

            if (deltaX > 5)
            {
                await AdvanceImage(-1);
            }
            else if (deltaX < -5)
            {
                await AdvanceImage(1);
            }
        }
示例#20
0
        private void AssociatedObject_ManipulationCompleted(object sender, Windows.UI.Xaml.Input.ManipulationCompletedRoutedEventArgs e)
        {
            NowSwiping = false;

            if (_IsSkipSwipe)
            {
                return;
            }

            UpdateSwipe(e.Cumulative);

            CompleteSwipe(e.Position);
            e.Handled = true;
        }
示例#21
0
        private void OnListViewItemManipulationCompleted(object sender, Windows.UI.Xaml.Input.ManipulationCompletedRoutedEventArgs e)
        {
            Point currentpoint = e.Position;

            var firstPosition = _initialpoint.X;
            var lastPosition  = currentpoint.X;

            if (Math.Abs(firstPosition - lastPosition) > 200)
            {
                SwipeMessage message = firstPosition - lastPosition > 200
                                        ? SwipeMessage.Left as SwipeMessage
                                        : SwipeMessage.Right as SwipeMessage;

                Messenger.Default.Send(message);
            }
        }
示例#22
0
        private async void SplitviewLayer_ManipulationCompleted(object sender, Windows.UI.Xaml.Input.ManipulationCompletedRoutedEventArgs e)
        {
            HamburgerListBox.IsEnabled = false;
            double v = e.Velocities.Linear.X;

            if (v < 0)
            {
                ClosePane();
                await Task.Delay(150);
            }
            else if (v >= 0)
            {
                OpenPane();
                await Task.Delay(150);
            }
            HamburgerListBox.IsEnabled = true;
        }
示例#23
0
        private void GestureRect_ManipulationCompleted(object sender, Windows.UI.Xaml.Input.ManipulationCompletedRoutedEventArgs e)
        {
            double speed = e.Velocities.Linear.X;
            double delta = e.Cumulative.Translation.X;

            IsCoreCompleteChanged = true;
            if (ContentGrid != null && delta < ContentGrid.ActualWidth / 3 && speed < 0.5)
            {
                IsOpen = true;
            }
            else
            {
                IsOpen = false;
            }
            IsCoreCompleteChanged = false;
            UpdateIsOpen(true, delta);
        }
示例#24
0
        private void OnPicturesContainerControlManipulationCompleted(Object sender, Windows.UI.Xaml.Input.ManipulationCompletedRoutedEventArgs args)
        {
            if (DetailsControl.Opacity == 1)
            {
                return;
            }

            if (BackgroundControl.Opacity < 0.5)
            {
                Close(skipAnimation: false);
            }
            else
            {
                var storyboard = CreateSlideBackTransition((FrameworkElement)sender, BackgroundControl);
                storyboard.Begin();
                CommandBar.Visibility = Visibility.Visible;
            }
        }
示例#25
0
        private void ScrollViewer_ManipulationCompleted(object sender, Windows.UI.Xaml.Input.ManipulationCompletedRoutedEventArgs e)
        {
            var contentPresenter = sender as ScrollContentPresenter;

            if (contentPresenter == null)
            {
                return;
            }
            Windows.Foundation.Point v = e.Velocities.Linear;
            double m = v.GetMagnitude();
            double a = Math.Abs(v.X);

            // If it's an intertal manipulation, and it's 80% in the X direction
            // and the total manipulitation is greater than 400
            if (e.IsInertial && (a / m) > 0.8 && m > 400)
            {
                this.OnSwipe();
            }
        }
示例#26
0
        private async void Grid_ManipulationCompleted(object sender, Windows.UI.Xaml.Input.ManipulationCompletedRoutedEventArgs e)
        {
            Debug.WriteLine("Manipulation Completed : " + e.Position.X.ToString());
            Point currentpoint = e.Position;

            if (currentpoint.X - initialpoint.X >= 10)
            {
                Debug.WriteLine("Swipe Right");
                await this.show_next_image();
            }
            if (initialpoint.X - currentpoint.X >= 10)
            {
                Debug.WriteLine("Swipe Left");
                await this.show_previous_image();
            }
            // Restert timer after user operation
            timer.Stop();
            timer.Start();
        }
示例#27
0
        private async void LayoutController_ManipulationCompleted(object sender, Windows.UI.Xaml.Input.ManipulationCompletedRoutedEventArgs e)
        {
            if (!_manipulationsEnabled)
            {
                return;
            }
            double v = e.Velocities.Linear.X;

            if (v < 0)
            {
                ClosePane();
                await Task.Delay(150);
            }
            else if (v >= 0)
            {
                OpenPane();
                await Task.Delay(150);
            }
        }
        private void ThreadAndReplyPage_ManipulationCompleted(object sender, Windows.UI.Xaml.Input.ManipulationCompletedRoutedEventArgs e)
        {
            if (ActualWidth > 720)
            {
                _tt.X = 0;
                return;
            }

            double abs_delta = Math.Abs(e.Cumulative.Translation.X);
            double speed     = Math.Abs(e.Velocities.Linear.X);
            double delta     = e.Cumulative.Translation.X;
            double to        = 0;

            if (abs_delta < ActualWidth / 3 && speed < 0.5)
            {
                _tt.X = 0;
                return;
            }

            if (delta > 0)
            {
                to = ActualWidth;
            }
            else if (delta < 0)
            {
                return;
            }

            var s = new Storyboard();
            var doubleanimation = new DoubleAnimation()
            {
                Duration = new Duration(TimeSpan.FromMilliseconds(120)), From = _tt.X, To = to
            };

            Storyboard.SetTarget(doubleanimation, _tt);
            Storyboard.SetTargetProperty(doubleanimation, "X");
            s.Children.Add(doubleanimation);
            s.Begin();
        }
示例#29
0
        private void LaunchPokeballButton_ManipulationCompleted(object sender, Windows.UI.Xaml.Input.ManipulationCompletedRoutedEventArgs e)
        {
            Logger.Write("Manipulation Completed...");

            // Disable the pokeball so that we can't try and throw it again
            LaunchPokeballButton.IsEnabled = false;

            var EndingX = (float)PokeballTransform.TranslateX;
            var EndingY = (float)PokeballTransform.TranslateY;

            // Pull out of the history where our finger was ~300ms ago
            var start     = PastPositions.Peek();
            var startTime = start.Item2;
            var startPos  = start.Item1;

            // TODO: Use PastPositions to determine if this is a curve ball, and if it is
            // apply a force in the direction of the curve

            // Get some details that we will need to do math with
            var displacement   = new Vector2(EndingX - startPos.X, EndingY - startPos.Y);
            var distance       = displacement.Length();
            var throwDirection = Vector3.Normalize(new Vector3(displacement.X, displacement.Y, 100.0f));
            var timeDelta      = (DateTime.Now - startTime).Milliseconds;

            // Set our initial position and velocity in world space
            ThrowItemPosition = new Vector3(EndingX, EndingY, 0);
            ThrowItemVelocity = ((distance * 100.0f) / timeDelta) * throwDirection;

            /*
             * Logger.Write("Init throwDirection " + throwDirection.X + ", " + throwDirection.X + ", " + throwDirection.Z);
             * Logger.Write("Init TimeDelta " + timeDelta);
             * Logger.Write("Init Position " + ThrowItemPosition.X + ", " + ThrowItemPosition.Y + ", " + ThrowItemPosition.Z);
             * Logger.Write("Init Velocity " + ThrowItemVelocity.X + ", " + ThrowItemVelocity.Y + ", " + ThrowItemVelocity.Z);
             */

            prevTime = DateTime.Now;
            ThreadPoolTimer.CreatePeriodicTimer(PokeballUpdateLoop, TimeSpan.FromMilliseconds(20));
        }
示例#30
0
 private void SwapChainBackgroundPanel_ManipulationCompleted(object sender, Windows.UI.Xaml.Input.ManipulationCompletedRoutedEventArgs e)
 {
     // TODO: Add event handler implementation here.
 }