Complete() public method

public Complete ( ) : void
return void
Example #1
0
        private void OnManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            if (_panel.ItemsFitContent)
            {
                return;
            }

            double deltaX = e.Delta.Translation.X;

            if (e.IsInertial)
            {
                e.Complete();
            }
            else
            {
                if (Math.Abs(e.Cumulative.Translation.X) >= this.ItemWidthEx)
                {
                    e.Complete();
                }
                else
                {
                    _headerContainer.TranslateDeltaX(deltaX);
                    _panelContainer.TranslateDeltaX(deltaX);
                    if (Math.Sign(deltaX) > 0)
                    {
                        _tabsContainer.TranslateDeltaX(deltaX * _tabs.PrevTabWidth / this.ItemWidthEx);
                    }
                    else
                    {
                        _tabsContainer.TranslateDeltaX(deltaX * _tabs.SelectedTabWidth / this.ItemWidthEx);
                    }
                }
            }
            e.Handled = true;
        }
Example #2
0
 private void OnManipulationDelta(object Sender, ManipulationDeltaRoutedEventArgs DeltaRoutedEventArgs)
 {
     if (DeltaRoutedEventArgs.IsInertial)
     {
         if (_manipulationStartPoint.X - DeltaRoutedEventArgs.Position.X > 200)
         {
             _gameGrid.HandleMove(MoveDirection.Left);
             DeltaRoutedEventArgs.Complete();
             DeltaRoutedEventArgs.Handled = true;
         }
         else if (DeltaRoutedEventArgs.Position.X - _manipulationStartPoint.X > 200)
         {
             _gameGrid.HandleMove(MoveDirection.Right);
             DeltaRoutedEventArgs.Complete();
             DeltaRoutedEventArgs.Handled = true;
         }
         else if (_manipulationStartPoint.Y - DeltaRoutedEventArgs.Position.Y > 200)
         {
             _gameGrid.HandleMove(MoveDirection.Up);
             DeltaRoutedEventArgs.Complete();
             DeltaRoutedEventArgs.Handled = true;
         }
         else if (DeltaRoutedEventArgs.Position.Y - _manipulationStartPoint.Y > 200)
         {
             _gameGrid.HandleMove(MoveDirection.Down);
             DeltaRoutedEventArgs.Complete();
             DeltaRoutedEventArgs.Handled = true;
         }
     }
 }
Example #3
0
        private void circlePanel_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            rotateTransform.CenterX = circlePanel.X;
            rotateTransform.CenterY = circlePanel.Y;

            storyboard.Begin();
            e.Complete();
        }
Example #4
0
 private async void OnAdornManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
 {
     double delta = e.Delta.Translation.Y;
     await TranslateDelta(delta);
     if (_cancelManipulation)
     {
         e.Complete();
     }
 }
Example #5
0
 private void MapManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
 {
     if (manipulationActive)
     {
         map.TransformMap(e.Position, e.Delta.Translation, e.Delta.Rotation, e.Delta.Scale);
     }
     else
     {
         e.Complete();
     }
 }
Example #6
0
 private void ManipDelta(object sender, ManipulationDeltaRoutedEventArgs e)
 {
     if (e.IsInertial && _manipulating)
     {
         var currentpoint = e.Position;
         if (currentpoint.X - _initialPoint.X >= 70) // swipe right
         {
             e.Complete();
             e.Handled = true;
             _manipulating = false;
             ViewModel.NavigateDetails();
         }
     }
 }
        private void OnManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            if ((Math.Sign(e.Delta.Translation.Y) < 0 && this.SelectedIndex == this.Children.Count - 1))
            {
                e.Complete();
                return;
            }

            _current = _current ?? GetEligibleControl(e.Delta.Translation.Y);

            double deltaY = e.Delta.Translation.Y;
            double translateY = _current.GetTranslateY();
            _lastDeltaSign = Math.Sign(deltaY);

            double y = Math.Max(GetTopBound(), translateY + deltaY);
            y = Math.Min(0, y);
            _current.TranslateY(y);
        }
Example #8
0
        private void _ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            Point end = e.Position;
            e.Complete();
            if (Math.Abs(end.X - start.X) < 5 && Math.Abs(end.Y - start.Y) < 5)
            {
                return;
            }

            if (Math.Abs(end.X - start.X) > Math.Abs(end.Y - start.Y))
            {
                if (end.X - start.X > 0) { Move(RIGHT); }
                else { Move(LEFT); }
            }
            else
            {
                if (end.Y - start.Y > 0) { Move(DOWN); }
                else { Move(UP); }
            }
        }
        // Process the change resulting from a manipulation
        void ManipulateMe_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            // If the reset button has been pressed, mark the manipulation as completed
            if (forceManipulationsToEnd)
            {
                e.Complete();
                return;
            }

            previousTransform.Matrix = transforms.Value;

            // Get center point for rotation
            Point center = previousTransform.TransformPoint(new Point(e.Position.X, e.Position.Y));
            deltaTransform.CenterX = center.X;
            deltaTransform.CenterY = center.Y;

            // Look at the Delta property of the ManipulationDeltaRoutedEventArgs to retrieve
            // the rotation, scale, X, and Y changes
            deltaTransform.Rotation = e.Delta.Rotation;
            deltaTransform.TranslateX = e.Delta.Translation.X;
            deltaTransform.TranslateY = e.Delta.Translation.Y;
        }
Example #10
0
	    private void ManipulateMe_OnManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
	    {
		    if (_forceManipulationsToEnd)
		    {
			    e.Complete();
			    return;
		    }

		    _previousTransform.Matrix = _transformGroup.Value;

		    Point center = _previousTransform.TransformPoint(new Point(e.Position.X, e.Position.Y));
		    _compositeTransform.CenterX = center.X;
		    _compositeTransform.CenterY = center.Y;
			
		    _compositeTransform.Rotation = e.Delta.Rotation;
		    _compositeTransform.ScaleX = _compositeTransform.ScaleY = e.Delta.Scale;
		    _compositeTransform.TranslateX = e.Delta.Translation.X;
		    _compositeTransform.TranslateY = e.Delta.Translation.Y;


		    e.Handled = true;
	    }
Example #11
0
 void ManipulateMe_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
 {
     if (forceManipulationsToEnd)
     {
         e.Complete();
         return;
     }
     //Set the new transform values based on user action
     previousTransform.Matrix = transformGroup.Value;
     compositeTransform.TranslateX = e.Delta.Translation.X / scrollViewer.ZoomFactor;
     compositeTransform.TranslateY = e.Delta.Translation.Y / scrollViewer.ZoomFactor;
     e.Handled = true;
 }
Example #12
0
        private void ValidatePosition(CompositeTransform ct, ManipulationDeltaRoutedEventArgs deltaEventArgs = null)
        {
            Point point = element.TransformToVisual(Container).TransformPoint(new Point(0, 0));

            if (point.X <= 0)
            {
                if (deltaEventArgs != null) deltaEventArgs.Complete();
                ct.TranslateX = 0;
                Rect rect = element.TransformToVisual(Container).TransformBounds(
                  new Rect(new Point(0, 0), element.RenderSize));
                ct.TranslateX = -rect.Left;
            }
            if (point.X + element.ActualWidth >= Container.ActualWidth)
            {
                if (deltaEventArgs != null) deltaEventArgs.Complete();
                ct.TranslateX = 0;
                Rect rect = element.TransformToVisual(Container).TransformBounds(
                  new Rect(new Point(0, 0), element.RenderSize));
                ct.TranslateX = Container.ActualWidth - rect.Right;
            }
            if (point.Y <= 0)
            {
                if (deltaEventArgs != null) deltaEventArgs.Complete();
                ct.TranslateY = 0;
                Rect rect = element.TransformToVisual(Container).TransformBounds(
                  new Rect(new Point(0, 0), element.RenderSize));
                ct.TranslateY = -rect.Top;
            }
            if (point.Y + element.ActualHeight >= Container.ActualHeight)
            {
                if (deltaEventArgs != null) deltaEventArgs.Complete();
                ct.TranslateY = 0;
                Rect rect = element.TransformToVisual(Container).TransformBounds(
                  new Rect(new Point(0, 0), element.RenderSize));
                ct.TranslateY = Container.ActualHeight - rect.Bottom;
            }
        }
 /// <summary>
 /// Word opgeroepen tijdens het swypen.
 /// er wordt gecontroleerd of de swype beëindigd is of niet (e.IsInertial). Indien wel, dan wordt het eindpunt bepaald
 /// en wordt gekeken of de swype afstand op de X-as ver genoeg was om de menuanimatie te starten.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void PaginaGrid_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
 {
     if (e.IsInertial)
     {
         Point eindPunt = e.Position;
         double afstand = eindPunt.X - beginPunt.X;
         if (afstand >= 500)//500 is the threshold value, where you want to trigger the swipe right event
         {
             e.Complete();
             if (!ucMenu.IsMenuOpen())
                 ucMenu.BeginMenuAnimatie();
         }
         else if (afstand <= -500)
         {
             e.Complete();
             if (ucMenu.IsMenuOpen())
                 ucMenu.BeginMenuAnimatie();
         }
     }
 }
Example #14
0
        void SlideView_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
#endif
        {
            if (!IsSlideEnabled)
            {
                e.Complete();
                return;
            }

#if WINDOWS_PHONE
            var deltaManipulation = e.DeltaManipulation;
#elif NETFX_CORE
            var deltaManipulation = e.Delta;
#endif

            var rightOffset = Panel.GetOffset(SelectedIndex + 1);
            var leftOffset = Panel.GetOffset(SelectedIndex - 1);

            double offset = Math.Max(rightOffset, Math.Min(leftOffset, _translate.X + deltaManipulation.Translation.X));
            _translate.X = offset;

#if NETFX_CORE
            if (e.IsInertial)
            {
                e.Complete();
            }
#endif
        }
        protected override void OnManipulationDelta(ManipulationDeltaRoutedEventArgs e)
#endif
        {
#if SILVERLIGHT
            var delta = e.DeltaManipulation.Translation;
            var cumulative = e.CumulativeManipulation.Translation;
#else
            if (e.PointerDeviceType != Windows.Devices.Input.PointerDeviceType.Touch || 
                _parent?.SelectionMode == ListViewSelectionMode.Multiple ||
                _parent?.SelectionMode == ListViewSelectionMode.Extended)
            {
                e.Complete();
                return;
            }

            var delta = e.Delta.Translation;
            var cumulative = e.Cumulative.Translation;
#endif

            var target = ((ActualWidth / 5) * 1);

            if (_direction == SwipeListDirection.None)
            {
                _direction = delta.X > 0 
                    ? SwipeListDirection.Left 
                    : SwipeListDirection.Right;

                DragBackground.Background = _direction == SwipeListDirection.Left 
                    ? LeftBackground 
                    : RightBackground;

                LeftTransform.X = -(LeftContainer.ActualWidth + 20);
                RightTransform.X = (RightContainer.ActualWidth + 20);

                DragClip.Rect = new Rect(_direction == SwipeListDirection.Left ? -ActualWidth : ActualWidth, 0, ActualWidth, ActualHeight);

                if (_direction == SwipeListDirection.Left && LeftBehavior != SwipeListBehavior.Disabled)
                {
                    DragBackground.Background = LeftBackground;

                    LeftContainer.Visibility = Visibility.Visible;
                    RightContainer.Visibility = Visibility.Collapsed;
                }
                else if (_direction == SwipeListDirection.Right && RightBehavior != SwipeListBehavior.Disabled)
                {
                    DragBackground.Background = RightBackground;

                    LeftContainer.Visibility = Visibility.Collapsed;
                    RightContainer.Visibility = Visibility.Visible;
                }
                else
                {
                    e.Complete();
                    return;
                }
            }

            if (_direction == SwipeListDirection.Left)
            {
                var area1 = LeftBehavior == SwipeListBehavior.Collapse ? 1.5 : 2.5;
                var area2 = LeftBehavior == SwipeListBehavior.Collapse ? 2 : 3;

                ContentDragTransform.X = Math.Max(0, Math.Min(cumulative.X, ActualWidth));
                DragClipTransform.X = Math.Max(0, Math.Min(cumulative.X, ActualWidth));

                if (ContentDragTransform.X < target * area1)
                {
                    LeftTransform.X += (delta.X / 1.5);
                }
                else if (ContentDragTransform.X >= target * area1 && ContentDragTransform.X < target * area2)
                {
                    LeftTransform.X += (delta.X * 2.5);
                }
                else
                {
                    LeftTransform.X = Math.Max(0, Math.Min(cumulative.X, ActualWidth)) - LeftContainer.ActualWidth;
                }

                if (ContentDragTransform.X == 0 && delta.X < 0)
                {
                    _direction = SwipeListDirection.None;
                }
            }
            else if (_direction == SwipeListDirection.Right)
            {
                var area1 = RightBehavior == SwipeListBehavior.Collapse ? 1.5 : 2.5;
                var area2 = RightBehavior == SwipeListBehavior.Collapse ? 2 : 3;

                ContentDragTransform.X = Math.Max(-ActualWidth, Math.Min(cumulative.X, 0));
                DragClipTransform.X = Math.Max(-ActualWidth, Math.Min(cumulative.X, 0));

                if (ContentDragTransform.X > -(target * area1))
                {
                    RightTransform.X += (delta.X / 1.5);
                }
                else if (ContentDragTransform.X <= -(target * area1) && ContentDragTransform.X > -(target * area2))
                {
                    RightTransform.X += (delta.X * 2.5);
                }
                else
                {
                    RightTransform.X = Math.Max(-ActualWidth, Math.Min(cumulative.X, 0)) + RightContainer.ActualWidth;
                }

                if (ContentDragTransform.X == 0 && delta.X > 0)
                {
                    _direction = SwipeListDirection.None;
                }
            }

            //e.Handled = true;
            //base.OnManipulationDelta(e);
        }
 private void SlideHandle_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
 {
     if (e.Cumulative.Translation.X >= 25)
     {
         e.Complete();
         IsIndexPanelOpen = !IsIndexPanelOpen;
     }
 }
Example #17
0
        protected override void OnManipulationDelta(ManipulationDeltaRoutedEventArgs e)
        {
            if (e.PointerDeviceType != Windows.Devices.Input.PointerDeviceType.Touch)
            {
                e.Complete();
                return;
            }

            var delta = e.Delta.Translation;
            var cumulative = e.Cumulative.Translation;

            var target = int.MaxValue;/*HorizontalMode ? (ActualWidth / 5) : (ActualHeight / 2) * 1;*/

            if (_direction == SwipeListDirection.None)
            {
                _direction = HorizontalMode?(delta.X > 0
                    ? SwipeListDirection.Left
                    : SwipeListDirection.Right): (delta.Y > 0
                    ? SwipeListDirection.Top
                    : SwipeListDirection.Buttom);

                DragClip.Rect = HorizontalMode ? new Rect(_direction == SwipeListDirection.Left ? -ActualWidth : ActualWidth, 0, ActualWidth, ActualHeight)
                    : new Rect(0, _direction == SwipeListDirection.Top ? -ActualHeight : ActualHeight, ActualWidth, ActualHeight);

                if ((_direction == SwipeListDirection.Left || _direction == SwipeListDirection.Top) && LeftOrTopBehavior != SwipeListBehavior.Disabled)
                {
                    DragBackground.Background = LeftOrTopBackground;

                    LeftOrTopContainer.Visibility = Windows.UI.Xaml.Visibility.Visible;
                    RightOrButtomContainer.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                }
                else if ((_direction == SwipeListDirection.Right || _direction == SwipeListDirection.Buttom) && RightOrButtomBehavior != SwipeListBehavior.Disabled)
                {
                    DragBackground.Background = RightOrButtomBackground;

                    LeftOrTopContainer.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                    RightOrButtomContainer.Visibility = Windows.UI.Xaml.Visibility.Visible;
                }
                else
                {
                    e.Complete();
                    return;
                }
            }

            if (_direction == SwipeListDirection.Left || _direction == SwipeListDirection.Top)
            {
                var area1 = LeftOrTopBehavior == SwipeListBehavior.Collapse ? 1.5 : 2.5;
                var area2 = LeftOrTopBehavior == SwipeListBehavior.Collapse ? 2 : 3;

                if(HorizontalMode)
                {
                    ContentDragTransform.X = Math.Max(0, Math.Min(cumulative.X, ActualWidth));
                    DragClipTransform1.X = Math.Max(0, Math.Min(cumulative.X, ActualWidth));

                    if (ContentDragTransform.X < target * area1)
                    {
                        LeftOrTopTransform.X += (delta.X / 1.5);
                    }
                    else if (ContentDragTransform.X >= target * area1 && ContentDragTransform.X < target * area2)
                    {
                        LeftOrTopTransform.X += (delta.X * 2.5);
                    }
                    else
                    {
                        LeftOrTopTransform.X = Math.Max(0, Math.Min(cumulative.X, ActualWidth)) - LeftOrTopContainer.ActualWidth;
                    }

                    if (ContentDragTransform.X == 0 && delta.X < 0)
                    {
                        _direction = SwipeListDirection.None;
                    }
                }
                else
                {
                    ContentDragTransform.Y = Math.Max(0, Math.Min(cumulative.Y, ActualHeight));
                    DragClipTransform1.Y = Math.Max(0, Math.Min(cumulative.Y, ActualHeight));

                    if (ContentDragTransform.Y < target * area1)
                    {
                        LeftOrTopTransform.Y += (delta.Y / 1.5);
                    }
                    else if (ContentDragTransform.Y >= target * area1 && ContentDragTransform.Y < target * area2)
                    {
                        LeftOrTopTransform.Y += (delta.Y * 2.5);
                    }
                    else
                    {
                        LeftOrTopTransform.Y = Math.Max(0, Math.Min(cumulative.Y, ActualHeight)) - LeftOrTopContainer.ActualHeight;
                    }

                    if (ContentDragTransform.Y == 0 && delta.Y < 0)
                    {
                        _direction = SwipeListDirection.None;
                    }
                }

            }
            else if (_direction == SwipeListDirection.Right || _direction == SwipeListDirection.Buttom)
            {
                var area1 = RightOrButtomBehavior == SwipeListBehavior.Collapse ? 1.5 : 2.5;
                var area2 = RightOrButtomBehavior == SwipeListBehavior.Collapse ? 2 : 3;

                if (HorizontalMode)
                {
                    ContentDragTransform.X = Math.Max(-ActualWidth, Math.Min(cumulative.X, 0));
                    DragClipTransform1.X = Math.Max(-ActualWidth, Math.Min(cumulative.X, 0));

                    if (ContentDragTransform.X > -(target * area1))
                    {
                        RightOrButtomTransform.X += (delta.X / 1.5);
                    }
                    else if (ContentDragTransform.X <= -(target * area1) && ContentDragTransform.X > -(target * area2))
                    {
                        RightOrButtomTransform.X += (delta.X * 2.5);
                    }
                    else
                    {
                        RightOrButtomTransform.X = Math.Max(-ActualWidth, Math.Min(cumulative.X, 0)) + RightOrButtomContainer.ActualWidth;
                    }

                    if (ContentDragTransform.X == 0 && delta.X > 0)
                    {
                        _direction = SwipeListDirection.None;
                    }
                }
                else
                {
                    ContentDragTransform.Y = Math.Max(-ActualHeight, Math.Min(cumulative.Y, 0));
                    DragClipTransform1.Y = Math.Max(-ActualHeight, Math.Min(cumulative.Y, 0));

                    if (ContentDragTransform.Y > -(target * area1))
                    {
                        RightOrButtomTransform.Y += (delta.Y / 1.5);
                    }
                    else if (ContentDragTransform.Y <= -(target * area1) && ContentDragTransform.Y > -(target * area2))
                    {
                        RightOrButtomTransform.Y += (delta.Y * 2.5);
                    }
                    else
                    {
                        RightOrButtomTransform.Y = Math.Max(-ActualHeight, Math.Min(cumulative.Y, 0)) + RightOrButtomContainer.ActualHeight;
                    }

                    if (ContentDragTransform.Y == 0 && delta.Y > 0)
                    {
                        _direction = SwipeListDirection.None;
                    }
                }
            }
        }
        public void photoDragged(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            Grid photo = (Grid)sender;
            CompositeTransform transforms = (CompositeTransform)photo.RenderTransform;

            // Move the image
            transforms.TranslateX += e.Delta.Translation.X;
            transforms.TranslateY += e.Delta.Translation.Y;

            // Rotate the image
            double angle = calculateImageAngle(e.Cumulative.Translation);
            transforms.Rotation = angle;

            if (e.IsInertial)
            {
                PhotoPosition m = getPhotoPosition(photo);

                if (m == PhotoPosition.OffscreenLeft)
                {
                    e.Complete();
                    passCurrent();
                }
                else if (m == PhotoPosition.OffscreenTop)
                {
                    e.Complete();
                    superlikeCurrent();
                }
                else if (m == PhotoPosition.OffscreenRight)
                {
                    e.Complete();
                    likeCurrent();
                }
            }
        }
Example #19
0
        private void LargeAlbumCover_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            LargeAlbumCoverTranslateTransform.X += e.Delta.Translation.X;

            if (isManipulationCanceled)
                return;

            if (Math.Abs(e.Cumulative.Translation.X) > 250)
            {
                isManipulationCanceled = true;
                e.Complete();

                if (e.Cumulative.Translation.X > 0)
                    ViewModel.Instance.PreviousSongCommand.Execute(null);
                else
                    ViewModel.Instance.NextSongCommand.Execute(null);

                var duration = 500;

                var offset = duration * e.Velocities.Linear.X;
                EasingFunctionBase easing = null;
                if (offset < 100)
                {
                    offset = 100;

                }

                var animation = new DoubleAnimationUsingKeyFrames();
                animation.KeyFrames.Add(new EasingDoubleKeyFrame()
                {
                    KeyTime = TimeSpan.Zero,
                    Value = e.Cumulative.Translation.X,
                    EasingFunction = easing
                });
                animation.KeyFrames.Add(new EasingDoubleKeyFrame()
                {
                    KeyTime = TimeSpan.FromMilliseconds(duration),
                    Value = e.Cumulative.Translation.X + (duration * e.Velocities.Linear.X),
                    EasingFunction = easing
                });
                animation.KeyFrames.Add(new EasingDoubleKeyFrame()
                {
                    KeyTime = TimeSpan.FromMilliseconds(duration + 1),
                    Value = 0,
                    EasingFunction = easing
                });

                Storyboard.SetTarget(animation, this.LargeAlbumCoverTranslateTransform);
                Storyboard.SetTargetProperty(animation, "X");

                var fadeAnimation = new DoubleAnimationUsingKeyFrames();
                fadeAnimation.KeyFrames.Add(new EasingDoubleKeyFrame()
                {
                    KeyTime = TimeSpan.FromMilliseconds(duration - 100),
                    Value = 1,
                });
                fadeAnimation.KeyFrames.Add(new EasingDoubleKeyFrame()
                {
                    KeyTime = TimeSpan.FromMilliseconds(duration),
                    Value = 0,
                });
                fadeAnimation.KeyFrames.Add(new EasingDoubleKeyFrame()
                {
                    KeyTime = TimeSpan.FromMilliseconds(duration * 2),
                    Value = 1,
                });

                Storyboard.SetTarget(fadeAnimation, this.LargeAlbumCover);
                Storyboard.SetTargetProperty(fadeAnimation, "Opacity");

                var storyboard = new Storyboard();
                storyboard.Children.Add(animation);
                storyboard.Children.Add(fadeAnimation);
                storyboard.Begin();
            }
        }
 private void ScrollContentPresenter_OnManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
 {
     if (e.PointerDeviceType != PointerDeviceType.Touch) return;
     // 境界エフェクトを出す距離を計算
     var overhangX = _startingOffsetX - e.Cumulative.Translation.X;
     var overhangY = _startingOffsetY - e.Cumulative.Translation.Y;
     var tr = _presenter.RenderTransform as TranslateTransform;
     // 更新中のヘッダオフセットを計算
     var refreshingOffset = _isRefreshing ? IndicatorHeight : 0;
     // ScrollViewerを正しい位置へスクロール
     _scrollViewer.ChangeView(overhangX, overhangY, null);
     // 境界エフェクトの計算をします。
     // スクロールが無効の時は処理しない
     if (_scrollViewer.HorizontalScrollMode == ScrollMode.Disabled) { }
     // 左端よりさらにスクロールされた場合は、距離の1/4を境界エフェクトとして表示
     else if (overhangX < 0) { tr.X = (-overhangX) / 4; }
     // 右端よりさらにスクロールされた場合は、同様に距離の1/4を境界エフェクトとして表示
     else if (overhangX > _scrollViewer.ScrollableWidth) { tr.X = (_scrollViewer.ScrollableWidth - overhangX) / 4; }
     // どちらでもない場合はRenderTransformを初期化
     else { tr.X = 0; }
     // 水平スクロールと同じ感じ
     if (_scrollViewer.VerticalScrollMode == ScrollMode.Disabled) { }
     // 更新中のヘッダオフセットを考慮して境界エフェクトを表示
     else if (_isRefreshing && overhangY < -IndicatorHeight) { tr.Y = refreshingOffset + (-overhangY) / 4; }
     // ヘッダを追い出す処理
     else if (_isRefreshing && overhangY < 0) { tr.Y = -overhangY; }
     // 更新中のヘッダオフセットを考慮して境界エフェクトを表示
     else if (overhangY < 0) { tr.Y = refreshingOffset + (-overhangY) / 4; }
     // 下端の処理
     else if (overhangY > _scrollViewer.ScrollableHeight) { tr.Y = (_scrollViewer.ScrollableHeight - overhangY) / 4; }
     // どちらでもなく、更新処理中でなければRenderTransformを初期化
     else if (!_isRefreshing) { tr.Y = 0; }
     // 引っ張って更新のインジケータを更新する
     ((TranslateTransform)_indicator.RenderTransform).Y = -IndicatorHeight + tr.Y;
     if (!_isRefreshing)
     {
         _indicator.Value = tr.Y / Threshold;
     }
     // 慣性スクロール中で、境界エフェクトを表示すべき条件が整った
     if ((Math.Abs(tr.X) > 0 || tr.Y > refreshingOffset || tr.Y < 0) && e.IsInertial)
     {
         // 初回は時刻を記録
         if (_inertiaStarted == 0)
         {
             _inertiaStarted = DateTime.UtcNow.Ticks;
         }
         // 慣性スクロールで境界エフェクトを100ms以上表示した場合Manipulationを終了
         if ((DateTime.UtcNow.Ticks - _inertiaStarted) > 1000000) // 100ms
         {
             e.Complete();
         }
     }
 }
Example #21
0
        private void SideBarGrid_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            _triggerCompleted = true;

            double finalLeft = Canvas.GetLeft(SideBarGrid) + e.Delta.Translation.X;
            if (finalLeft < SideMenuCollapsedLeft || finalLeft > 0)
                return;

            if (CanOpenSideBar)
            {
                Canvas.SetLeft(SideBarGrid, finalLeft);
            }

            if (e.IsInertial && e.Velocities.Linear.X > 1)
            {
                _triggerCompleted = false;
                e.Complete();
                OpenSideBar();
            }

            if (e.IsInertial && e.Velocities.Linear.X < -1)
            {
                _triggerCompleted = false;
                e.Complete();
                CloseSideBar();
            }

            if (e.IsInertial && Math.Abs(e.Velocities.Linear.X) <= 1)
                e.Complete();
        }
        private void OnManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            if (_isPaused)
                return;

            e.Handled = true;

            if (e.Cumulative.Translation.X > 0 && IsFirstPage ||
                e.Cumulative.Translation.X < 0 && IsLastPage)
            {
               CancelNextEvent();
                e.Complete();
            }
            else
            {
                if ((_mode & FlippingMode.Slide) == FlippingMode.Slide)
                    ManipulationDelta(sender, e);
            }
        }
Example #23
0
        void LOReaderView_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            if (_forcemanipulation2end || e.IsInertial)
            {
                e.Complete();
            }

            if (_ismanipulationenable)
                if (_pointers < 2)
                {
                    if (_deltatested)
                    {
                        //_ctrasnform.TranslateX += e.Delta.Translation.X;
                        if (_currentposition < _initthreshold && _currentposition > _finalthreshold)
                        {
                            _currentposition += e.Delta.Translation.X;
                            _page_translation += e.Delta.Translation.X;
                        }
                        else
                        {
                            _currentposition += (e.Delta.Translation.X * 0.4);
                            _page_translation += (e.Delta.Translation.X * 0.4);
                        }

                    }
                    else
                    {
                        if (Math.Abs(e.Delta.Translation.Y / 2  ) < Math.Abs(e.Delta.Translation.X))
                        {
                            _deltatested = true;
                            _currentposition += e.Delta.Translation.X;
                            _page_translation += e.Delta.Translation.X;
                        }
                        else
                        {
                            _ismanipulationenable = false;
                            // _forcemanipulation2end = true;
                        }
                    }
                    _ctrasnform.TranslateX = _currentposition;
                    _pagetransform.TranslateX = _page_translation;
                }
                else
                {
                   //manipulation for the element to thumb
                }
        }
		private void DragLetter_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
		{
			if (!e.IsInertial)
			{
				TileControl dragableItem = sender as TileControl;
				TranslateTransform tileRenderTransform = dragableItem.RenderTransform as TranslateTransform;

				tileRenderTransform.X += e.Delta.Translation.X;
				if (m_turnState == eTurnState.PlayersTurn)
				{
					tileRenderTransform.Y += e.Delta.Translation.Y;
				}

				Canvas.SetZIndex(dragableItem, 100);
			}
			else
			{
				e.Complete();
			}
		}
        private void LOReaderView_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
        {
            if (_forcemanipulation2end || (e.IsInertial && is_horizontal)) e.Complete();
            if (_ismanipulationenable && !_islocked)
            {
                if (_pointers < 2)
                {
                    if (!_deltatested)
                    {
                        _deltatested = true;
                        if (Math.Abs(e.Delta.Translation.Y / 2) < Math.Abs(e.Delta.Translation.X)) { is_horizontal = true; }
                        else { is_vertical = true; _ismanipulationenable = false; }
                    }

                    if (is_horizontal)
                    { 
                        if (_currentposition < _initthreshold && _currentposition > _finalthreshold) { delta_proportion = 1.0; }
                        else { delta_proportion = 0.4; }
                        _currentposition += (e.Delta.Translation.X * delta_proportion);
                        _page_translation += (e.Delta.Translation.X * delta_proportion);
                        _ctrasnform.TranslateX = _currentposition; 
                    }

                    if (is_vertical)
                    {
                        //_elementslist[_currentindex].DeltaY = e.Delta.Translation.Y;
                    }
                }
                else 
                {
                    //manipulation for the element to thumb
                    /*this.Opacity = 0.0;
                    _elementtransform.TranslateX += e.Delta.Translation.X;
                    _elementtransform.TranslateY += e.Delta.Translation.Y;
                    _elementtransform.ScaleX *= e.Delta.Scale;
                    _elementtransform.ScaleY *= e.Delta.Scale;
                    _elementtransform.Rotation += e.Delta.Rotation;*/
                }
            }
        }
 private void AppBarHintButton_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
 {
     e.Handled = true;
     if (e.Cumulative.Translation.Y < -25)
     {
         e.Complete();
         AppBarHint_Click(sender, null);
     }
 }
Example #27
0
        /// <summary>
        /// Called before the ManipulationDelta event occurs.
        /// </summary>
        /// <param name="e">Event data for the event.</param>
        /// <remarks>
        /// This is used for touch scrolling.
        /// </remarks>
        protected override void OnManipulationDelta(ManipulationDeltaRoutedEventArgs e)
        {
            this.scroller += e.Delta.Translation.Y;
            e.Handled = true;
            if (ProcessScroller() && e.IsInertial)
            {
                e.Complete();
            }

            base.OnManipulationDelta(e);
        }
        void ManipulableScroll_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
        { 
            if (_ismanipulationenable)
                if (_pointers < 2)
                {
                    if (!_deltatested)
                        if (Math.Abs(e.Delta.Translation.X ) < Math.Abs(e.Delta.Translation.Y))
                        {
                            _deltatested = true; _isvertical = true;
                            if (MLManipulationCompleted != null) MLManipulationCompleted(this, -1);
                        }
                        else
                        { _deltatested = true; _ishorizontal = true; }

                    if (_isvertical)
                    {
                        _actualdelta += e.Delta.Translation.Y;
                        if (_actualdelta > _threshold && _actualdelta < 0.0)
                            ThresholdDelta += e.Delta.Translation.Y;
                        else TranslateDelta += e.Delta.Translation.Y;
                        _paneltransform.TranslateY = _currenttranslate + TranslateDelta;
                    }
                    else
                    //if (_ishorizontal)
                    {
                        //if(MLManipulationDelta!=null)
                        //{
                            var args_1 = new MLManipulationArgs() { 
                                X=e.Delta.Translation.X,
                                Y =e.Delta.Translation.Y,
                                Scale = e.Delta.Scale ,
                                Rotate = e.Delta.Rotation
                            };
                            MLManipulationDelta(this, args_1);
                        //}
                    }  
                    
                }
                else
                {
                    //if (MLManipulationDelta != null)
                    //{
                        var args_1 = new MLManipulationArgs()
                        {
                            X = e.Delta.Translation.X,
                            Y = e.Delta.Translation.Y,
                            Scale = e.Delta.Scale,
                            Rotate = e.Delta.Rotation
                        };
                        MLManipulationDelta(this, args_1);
                    //}
                }

            if(e.IsInertial) //(_forcemanipulation2end || (e.IsInertial && TranslateDelta != 0.0))
            {
                e.Complete();
            }
        }
 private void IndexPanel_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
 {
     if (e.Cumulative.Translation.X <= -25)
     {
         e.Complete();
         IsIndexPanelOpen = false;
     }
 }
Example #30
0
 private void Border_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
 {
     var transform = (sender as FrameworkElement).RenderTransform as CompositeTransform;
     transform.Rotation += (e.Delta.Translation.X / ScreenWidth) * 16;
     if (Math.Abs(transform.Rotation) > 15)
         e.Complete();
 }