Example #1
0
        private void onMove(object sender, DragCompletedGestureEventArgs e)
        {
            if (!verticalMove(e.VerticalVelocity, e.HorizontalVelocity))
            {
                if (e.HorizontalVelocity < 0)
                {
                    //moves left
                    KeyClicked(2);
                }

                // User flicked towards right
                else if (e.HorizontalVelocity > 0)
                {
                    //moves right
                    KeyClicked(3);
                }
            }
            else
            {
                if (e.VerticalVelocity > 0)
                {
                    //Move Down
                    KeyClicked(4);
                }
                else if (e.VerticalVelocity < 0)
                {
                    KeyClicked(1);
                }
            }
        }
        private void GestureListener_DragCompleted(object sender, DragCompletedGestureEventArgs e)
        {
            if (IsDragItem || !IsDragList)
            {
                return;
            }

            _lastDraggedYDist = -1.0;
            if (firstItem != null)
            {
                if (firstItem.Height > 70)
                {
                    firstItem.Height = 100;
                    TransformUtil.setScaleX(firstItem, 1);
                    TransformUtil.setTranslateX(firstItem, 0);
                }
                else
                {
                    //Debug.WriteLine("Delete");
                    CurrItem.Delete(0);
                }
            }
            firstItem  = null;
            IsDragList = false;
        }
Example #3
0
        /// <summary>
        /// Handles completed drags on the root.
        /// </summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event information.</param>
        private void DragCompletedHandler(object sender, DragCompletedGestureEventArgs e)
        {
            e.Handled   = true;
            _isDragging = false;
            bool click = false;

            if (_wasDragged)
            {
                double edge = IsChecked == true ? _checkedTranslation : _uncheckedTranslation;
                if (Translation != edge)
                {
                    click = true;
                }
            }
            else
            {
                click = true;
            }
            if (click)
            {
                OnClick();
                ChangeVisualState(true);
            }
            _wasDragged = false;
        }
        public static void DragCompleted(object sender, DragCompletedGestureEventArgs e)
        {
            FrameworkElement fe     = sender as FrameworkElement;
            double           offset = fe.GetHorizontalOffset().Value + e.HorizontalChange;

            if (e.HorizontalChange < 0.0)
            {
                if (offset < -125)
                {
                    MenuOpen(fe);
                }
                else
                {
                    MenuBounceBack(fe);
                }
            }
            else
            {
                if (offset < -195)
                {
                    MenuOpen(fe);
                }
                else
                {
                    MenuBounceBack(fe);
                }
            }
        }
Example #5
0
 private void GestureListener_DragCompleted(object sender, DragCompletedGestureEventArgs e)
 {
     if (LayoutRoot.Margin.Left >= 200)
     {
         NavDrawMargin.left = 0;
         Deployment.Current.Dispatcher.BeginInvoke(delegate
         {
             while (LayoutRoot.Margin.Left < 400)
             {
                 NavDrawMargin.left = LayoutRoot.Margin.Left + 1;
                 LayoutRoot.Margin  = new Thickness(NavDrawMargin.left, 0, 0, 0);
             }
         });
     }
     else
     {
         NavDrawMargin.left = 0;
         Deployment.Current.Dispatcher.BeginInvoke(delegate
         {
             while (LayoutRoot.Margin.Left > 0)
             {
                 NavDrawMargin.left = LayoutRoot.Margin.Left - 1;
                 LayoutRoot.Margin  = new Thickness(NavDrawMargin.left, 0, 0, 0);
             }
         });
     }
 }
Example #6
0
        private void GestureListener_DragCompleted(object sender, DragCompletedGestureEventArgs e)
        {
            var position = e.GetPosition(CalendarViewOnPage);

            if (position.X > 0 && position.Y > 0 &&
                position.X < CalendarViewOnPage.ActualWidth &&
                position.Y < CalendarViewOnPage.ActualHeight &&
                e.Direction == System.Windows.Controls.Orientation.Vertical)
            {
                if (e.VerticalChange > 0)
                {
                    CalendarViewOnPage.Calendar.IncrementMonth();
                }
                else
                {
                    CalendarViewOnPage.Calendar.DecrementMonth();
                }
            }

            double offset = _contentPanel.GetHorizontalOffset().Value;

            if (offset > Constant.DISTANCE_DRAG_COMPLETED_2_OPENCLOSE && !_isMenuOpen)
            {
                OpenSettings();
            }
            else if (offset <= Constant.DISTANCE_DRAG_COMPLETED_2_OPENCLOSE && _isMenuOpen)
            {
                CloseSettings();
            }
            else
            {
                ResetLayoutRoot();
            }
        }
        private void GestureListener_OnDragCompleted(object sender, DragCompletedGestureEventArgs e)
        {
            if (e.Direction == System.Windows.Controls.Orientation.Horizontal && e.HorizontalChange > 0 && !_isSettingsOpen)
            {
                if (e.HorizontalChange < _dragDistanceToOpen)
                {
                    this.ResetLayoutRoot();
                }
                else
                {
                    this.OpenSettings();
                }
            }

            if (e.Direction == System.Windows.Controls.Orientation.Horizontal && e.HorizontalChange < 0 && _isSettingsOpen)
            {
                if (e.HorizontalChange > _dragDistanceNegative)
                {
                    this.ResetLayoutRoot();
                }
                else
                {
                    this.CloseSettings();
                }
            }
        }
Example #8
0
        private void OnDragCompleted(object sender, DragCompletedGestureEventArgs e)
        {
            if (e.Direction == System.Windows.Controls.Orientation.Horizontal)
            {
                if (e.HorizontalChange < 0)
                {
                    GetNextImage();
                }
                else if (e.HorizontalChange > 0)
                {
                    GetLastImage();
                }
            }
            else if (e.Direction == System.Windows.Controls.Orientation.Vertical)
            {
                if (e.VerticalChange > 0)
                {
                    GetNextImage();
                }
                else if (e.VerticalChange < 0)
                {
                    GetLastImage();
                }
            }
            //flickData.Text = string.Format("{0} OnDragCompleted: \nHorizontalChange = {1} ,\nVerticalChange = {2}.",
            //    e.Direction, e.HorizontalChange, e.VerticalChange);

            // Collapse PageTitle
            PageTitleCollapse();
        }
Example #9
0
        private void GestureListener_DragCompleted(object sender, DragCompletedGestureEventArgs e)
        {
            if (marginLeft >= -200)
            {
                Deployment.Current.Dispatcher.BeginInvoke(delegate
                {
                    while (marginLeft < 0)
                    {
                        marginLeft++;

                        NavDrawer.Margin = new Thickness(marginLeft, 0, 0, 0);
                    }
                });
            }
            else
            {
                Deployment.Current.Dispatcher.BeginInvoke(delegate
                {
                    while (marginLeft > -400)
                    {
                        marginLeft--;

                        NavDrawer.Margin = new Thickness(marginLeft, 0, 0, 0);
                    }
                });
            }
        }
Example #10
0
 private void OnGestureListenerDragCompleted(object sender, DragCompletedGestureEventArgs args)
 {
     if (_isDragging)
     {
         TransferTransforms();
         _isDragging = false;
     }
 }
Example #11
0
        protected virtual void RaiseClose(DragCompletedGestureEventArgs e)
        {
            var handler = Close;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Example #12
0
 private void GestureListener_OnDragCompleted(object sender, DragCompletedGestureEventArgs e)
 {
     _verticalCompression = 0;
     if (!IsArrowDown && PullToRefresh != null && !IsLoading)
     {
         PullToRefresh.Invoke(this, new EventArgs());
         IsArrowDown = true;
     }
 }
        private void GestureListener_OnDragCompleted(object sender, DragCompletedGestureEventArgs e)
        {
            if (e.Direction == Orientation.Horizontal)
            {
                return;
            }

            SelectedDate = e.VerticalChange > 0 ? SelectedDate.AddMonths(-1) : SelectedDate.AddMonths(1);
        }
        private void Pushpin_OnDragCompleted(object sender, DragCompletedGestureEventArgs e)
        {
            DraggingPin.Location = PushPin_GeoCoordinate;

            DraggingPin.Name = PinName;//移動中に表示させていた経緯度を消す。
            MyMap.IsEnabled  = true;

            //DB.SaveInfoToIsoStrage(PushPinView);
        }
 void listener_DragCompleted(object sender, DragCompletedGestureEventArgs e)
 {
     //Debug.WriteLine("listener_DragCompleted");
     if (_state == State.Dragging)
     {
         SelectAndSnapToClosest();
     }
     _state = State.Expanded;
 }
Example #16
0
 private void GestureListener_DragCompleted(object sender, DragCompletedGestureEventArgs e)
 {
     if (e.Direction == System.Windows.Controls.Orientation.Horizontal)
     {
         if (e.HorizontalChange < 0)
         {
             int random = new Random().Next();
             NavigationService.Navigate(new Uri("/RandomPage.xaml?r=" + random, UriKind.Relative));
         }
     }
 }
        private void GestureListener_DragCompleted(object sender, DragCompletedGestureEventArgs e)
        {
            Rectangle rect = sender as Rectangle;

            _isDrag = false;
            rect.ReleaseMouseCapture();

            if (CollisionDetected())
            {
                MessageBox.Show("Collision detected!");
            }
        }
Example #18
0
        private void onMove(object sender, DragCompletedGestureEventArgs e)
        {
            if (e.HorizontalVelocity < 0)
            {
                Move move1 = Move.left;
                BlockerMove(move1);
            }

            // User flicked towards right
            else if (e.HorizontalVelocity > 0)
            {
                Move move = Move.right;
                BlockerMove(move);
                //moves right
            }
        }
Example #19
0
        private void GestureListener_DragCompleted(object sender, DragCompletedGestureEventArgs e)
        {
            if ((ImageTransformation.ScaleX - 1.08) > 0 || (ImageTransformation.ScaleY - 1.08) > 0)
            {
                return;
            }
            var distance = firstPos.X - e.GetPosition(LayoutRoot).X;

            if (distance < -100)
            {
                FlipLeft();
            }
            else if (distance > 100)
            {
                FlipRight();
            }
        }
Example #20
0
 private void myGridGestureListener_DragCompleted(object sender, DragCompletedGestureEventArgs e)
 {
     if (!UserFlick)
     {
         var topImg = Images.First(i => i.Item2.IsOnTop);
         while (!(Math.Abs(topImg.Item2.ImageShift) < 1))
         {
             if (topImg.Item2.ImageShift > 0)
             {
                 Images.ToList().ForEach(i => i.Item2.ImageShift--);
             }
             if (topImg.Item2.ImageShift < 0)
             {
                 Images.ToList().ForEach(i => i.Item2.ImageShift++);
             }
             Images.ToList().ForEach(i => i.Item1.RefreshSettings(i.Item2));
         }
     }
     UserFlick = false;
 }
Example #21
0
        void RecoverDiag_DragEnd(object sender, DragCompletedGestureEventArgs e)
        {
            if (e.Direction == System.Windows.Controls.Orientation.Horizontal && e.HorizontalChange > 0)
            {
                // Nice, it was a flick which moved the dialog to the right. Now, let's see if the user moved it enough to hide it.
                var moveNeeded = 0.40; // 40% of the dialog must have been moved to the right.
                var actualMove = e.HorizontalChange / RecoverDialog.Width;


                if (actualMove >= moveNeeded)
                {
                    HideResumePositionPrompt(false);
                }
                else
                {
                    SbShowDialog.BeginTime = TimeSpan.FromSeconds(0);
                    SbShowDialog.Begin();
                }

                e.Handled = true;
            }
        }
Example #22
0
 private void GestureListener_OnDragCompleted(object sender, DragCompletedGestureEventArgs e)
 {
     if (e.Direction == 1 && e.HorizontalChange > 0 && !this._isSettingsOpen)
     {
         if (e.HorizontalChange >= this._dragDistanceToOpen)
         {
             this.OpenSettings();
         }
         else
         {
             this.ResetLayoutRoot();
         }
     }
     if (e.Direction == 1 && e.HorizontalChange < 0 && this._isSettingsOpen)
     {
         if (e.HorizontalChange > this._dragDistanceNegative)
         {
             this.ResetLayoutRoot();
             return;
         }
         this.CloseSettings();
     }
 }
 private void OnDragCompleted(object sender, DragCompletedGestureEventArgs e)
 {
     border.Background = normalBrush;
 }
Example #24
0
 void gestureListener_DragCompleted(object sender, DragCompletedGestureEventArgs e)
 {
     this.SlideToCentralMeasurement();
 }
Example #25
0
 private void Gesture_DragCompleted(object sender, DragCompletedGestureEventArgs e)
 {
 }
 void listener_DragCompleted(object sender, DragCompletedGestureEventArgs e)
 {
     //Debug.WriteLine("listener_DragCompleted");
     if (_state == State.Dragging)
     {
         SelectAndSnapToClosest();
     }
     _state = State.Expanded;
 }
Example #27
0
 private void GestureListener_DragCompleted(object sender, DragCompletedGestureEventArgs e)
 {
     SwipeMenu.DragCompleted(sender, e);
 }
Example #28
0
 private void OnDragCompleted(object sender, DragCompletedGestureEventArgs e)
 {
     CutImage.Opacity = 1.0;
 }
 /// <summary>
 /// Handles completed drags on the root.
 /// </summary>
 /// <param name="sender">The event sender.</param>
 /// <param name="e">The event information.</param>
 private void DragCompletedHandler(object sender, DragCompletedGestureEventArgs e)
 {
     e.Handled = true;
     _isDragging = false;
     bool click = false;
     if (_wasDragged)
     {
         double edge = IsChecked == true ? _checkedTranslation : _uncheckedTranslation;
         if (Translation != edge)
         {
             click = true;
         }
     }
     else
     {
         click = true;
     }
     if (click)
     {
         OnClick();
     }
     _wasDragged = false;
 }
Example #30
0
 private void gesture_DragCompleted(object sender, DragCompletedGestureEventArgs e)
 {
     message.Text = string.Format("drag completed with total change ({0},{1}) in the {2} direction ",
                                  e.HorizontalChange, e.VerticalChange, e.Direction, e.HorizontalVelocity, e.VerticalVelocity);
 }
Example #31
0
        private void OnDragCompleted(object sender, DragCompletedGestureEventArgs e)
        {
            if (CurrentScaleX != 1.0)
            {
                return;
            }

            var frameworkElement = sender as FrameworkElement;
            var transform        = frameworkElement.RenderTransform as CompositeTransform;

            if (DebugText != null)
            {
                DebugText.Text = string.Format("DragCompleted TranslateX={0} TranslateY={1}", transform.TranslateX, transform.TranslateY);
            }

            if (_direction == Orientation.Vertical)
            {
                if (Math.Abs(transform.TranslateY) > 100)
                {
                    RaiseClose(e);
                    return;
                }
                else
                {
                    var storyboard = new Storyboard();

                    var translateAnimation = new DoubleAnimationUsingKeyFrames();
                    translateAnimation.KeyFrames.Add(new EasingDoubleKeyFrame {
                        KeyTime = TimeSpan.FromSeconds(0.25), Value = 0.0, EasingFunction = new ExponentialEase {
                            EasingMode = EasingMode.EaseOut, Exponent = 6.0
                        }
                    });
                    Storyboard.SetTarget(translateAnimation, frameworkElement);
                    Storyboard.SetTargetProperty(translateAnimation, new PropertyPath("(UIElement.RenderTransform).(CompositeTransform.TranslateY)"));
                    storyboard.Children.Add(translateAnimation);

                    storyboard.Begin();

                    if (BackgroundPanel != null)
                    {
                        BackgroundPanel.Opacity = 1.0;
                        //BackgroundPanel.Background = new SolidColorBrush(Colors.Black);
                    }
                }
            }
            //else if (_direction == Orientation.Horizontal && Math.Abs(transform.TranslateX) < 150)
            //{
            //    var storyboard = new Storyboard();

            //    var translateAnimation = new DoubleAnimationUsingKeyFrames();
            //    translateAnimation.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = TimeSpan.FromSeconds(0.15), Value = 0.0, EasingFunction = new ExponentialEase { EasingMode = EasingMode.EaseOut, Exponent = 6.0 } });
            //    Storyboard.SetTarget(translateAnimation, img);
            //    Storyboard.SetTargetProperty(translateAnimation, new PropertyPath("(UIElement.RenderTransform).(CompositeTransform.TranslateX)"));
            //    storyboard.Children.Add(translateAnimation);

            //    storyboard.Begin();
            //}


            _direction = null;
        }
 private void GestureListener_DragCompleted(object sender, DragCompletedGestureEventArgs e)
 {
     ReportGesture("Drag Completed");
 }