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;
 }
        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);
              }

              IsActive = false;
        }
        private void OnManipulationCompleted(object sender, System.Windows.Input.ManipulationCompletedEventArgs e)
        {
            var control = (FrameworkElement)sender;

            control.ReleaseMouseCapture();

            if (e.IsTapGesture())
            {
                switch (CurrentState)
                {
                case ApplicationBarState.Minimized:
                    CurrentState = ApplicationBarState.Normal;
                    break;

                case ApplicationBarState.Normal:
                    CurrentState = ApplicationBarState.Full;
                    break;

                case ApplicationBarState.Full:
                    CurrentState = ApplicationBarState.Minimized;
                    break;

                default:
                    throw new NotSupportedException();
                }
            }
            else
            {
                GoToNearestState(TranslateTransform.Y + e.FinalVelocities.LinearVelocity.Y / 20);
            }

            e.Handled = true;
        }
示例#4
0
 protected override void OnManipulationCompleted(ManipulationCompletedEventArgs e)
 {
     string dest = "/page2.xaml";
     canvy.Children.Remove(jolidessin);
     this.NavigationService.Navigate(new Uri(dest, UriKind.Relative));
     base.OnManipulationCompleted(e);
 }
        private void CenterGrid_ManipulateCompleted(object sender, ManipulationCompletedEventArgs manipulationCompletedEventArgs)
        {
            double deltaX = TouchDownX - manipulationCompletedEventArgs.ManipulationOrigin.X;
            double deltaY = TouchDownY - manipulationCompletedEventArgs.ManipulationOrigin.Y;

            double absX = Math.Abs(TouchDownX - manipulationCompletedEventArgs.ManipulationOrigin.X);
            double absY = Math.Abs(TouchDownY - manipulationCompletedEventArgs.ManipulationOrigin.Y);

            if (absX > absY) //left or right
            {
                if (deltaX > 0 & deltaX > 12) //right
                {
                    ((StudyFlashCardSetViewModel)ViewModel).FlipCardRightCommand.Execute(null);
                }
                else if (deltaX < -12) //left
                {
                    ((StudyFlashCardSetViewModel)ViewModel).FlipCardLeftCommand.Execute(null);
                }
            }
            else // up or down
            {
                if (deltaY > 0 & deltaY > 12) //up
                {
                    ((StudyFlashCardSetViewModel)ViewModel).CorrectNextCardCommand.Execute(null);
                }
                else if (deltaY < -12) //down
                {
                    ((StudyFlashCardSetViewModel)ViewModel).IncorrectNextCardCommand.Execute(null);
                }
            }
        }
        private void CalendarButton_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
        {
            SolidColorBrush brush = new SolidColorBrush();
            brush.Color = (Color)App.Current.Resources["CalendarBackNormalGray"];

            CalendarButton.Background = brush;
        }
示例#7
0
        void CalendarManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
        {
            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(horizontal) > Math.Abs(vertical))
                    {
                        if ((int)horizontal > 0)
                        {
                            DecrementMonth();
                        }
                        else
                        {
                            IncrementMonth();
                        }
                    }
                    else
                    {
                        if ((int)vertical > 0)
                        {
                            DecrementYear();
                        }
                        else
                        {
                            IncrementYear();

                        }
                    }
                }
            }
        }
示例#8
0
        protected override void OnManipulationCompleted(ManipulationCompletedEventArgs e)
        {
            if (e.TotalManipulation.Translation.X == 0.0 && e.TotalManipulation.Translation.Y == 0.0)
                HandleMouseEvent(e.ManipulationOrigin);

            base.OnManipulationCompleted(e);
        }
示例#9
0
 private void azul_ManipulationCompleted_1(object sender, ManipulationCompletedEventArgs e)
 {
     Ellipse elipse = sender as Ellipse;
     string nombreObjeto = (sender as Ellipse).Name;
     bool entroAnterior=false;
     if (elipse.Name == "negro" || elipse.Name == "blanco" || elipse.Name == "amarillo" || elipse.Name=="verde")
     {
         if ((e.TotalManipulation.Translation.Y * -1) > 127 && (e.TotalManipulation.Translation.Y * -1) < 380)
         {
            entroAnterior= CambiarColores(nombreObjeto);
         }
    }
     else
     {
         if ((e.TotalManipulation.Translation.Y * -1) > 312 && (e.TotalManipulation.Translation.Y * -1) < 560)
         {
           entroAnterior= CambiarColores(nombreObjeto);
         }
     }
     if (!entroAnterior)
     {
         nombreAnterior = (sender as Ellipse).Name;
     }
     elipse.RenderTransform = null;
    
 }
示例#10
0
        protected override void OnManipulationCompleted(ManipulationCompletedEventArgs e)
        {
            FrameworkElement _root = Application.Current.RootVisual
               as FrameworkElement;
            myDate = (DateTime)_root.DataContext;

            // swipe to the right (100 pixels to the right
            // and -25 to 25 up or down in the translation)
            // change to nextday
            if (e.TotalManipulation.Translation.X > 100 &&
                (e.TotalManipulation.Translation.Y > -25 &&
                 e.TotalManipulation.Translation.Y < 25))
            {
                _root.DataContext = myDate.AddDays(-1);

                NavigationService.Navigate(new Uri("/Page/DayEvent.xaml?Refresh=" + DateTime.Now, UriKind.Relative));
            }

            // swipe to the left (100 pixels to the left
            // and -25 to 25 up or down in the translation)
            // change to previous day
            if (e.TotalManipulation.Translation.X < -100 &&
                (e.TotalManipulation.Translation.Y > -25 &&
                 e.TotalManipulation.Translation.Y < 25))
            {
                _root.DataContext = myDate.AddDays(1);

                NavigationService.Navigate(new Uri("/Page/DayEvent.xaml?Refresh=" + DateTime.Now, UriKind.Relative));
            }
        }
        protected override void OnManipulationCompleted(ManipulationCompletedEventArgs e)
        {
            base.OnManipulationCompleted(e);

            if(BlockTransitions) return;

            var horizontalVelocity = e.FinalVelocities.LinearVelocity.X;
            var verticalVelocity = e.FinalVelocities.LinearVelocity.Y;

            var direction = GetDirection(horizontalVelocity, verticalVelocity);

            if (direction == Orientation.Horizontal && Math.Abs(horizontalVelocity) > 200)
            {
                if (e.TotalManipulation.Translation.X < 0)
                {
                    if (ShowNextButton)
                        SlideLeft.Begin();
                    else
                        SlideTopLeft.Begin();
                }
                else
                {
                    if (ShowPreviousButton)
                        SlideRight.Begin();
                    else
                        SlideTopRight.Begin();
                }
            }
        }
        void FrontImage_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
        {
            App app = (App)Application.Current;

            if (canBeChanged && app.canPlay)
            {
                Stream stream = TitleContainer.OpenStream("sounds/flip/" + RandomNumber(1, 10) + ".wav");
                SoundEffect effect = SoundEffect.FromStream(stream);
                FrameworkDispatcher.Update();
                effect.Play();
                app.manager.setNextCard(this);
            }
            
            /*
            if (e.OriginalSource == this.FrontImage)
            {
                Console.Write("foo");
                this.FrontImage.Visibility = Visibility.Collapsed;
                this.BackImage.Visibility = Visibility.Visible;
            }
            else if (e.OriginalSource == this.BackImage)
            {
                Console.Write("foo");
                this.BackImage.Visibility = Visibility.Collapsed;
                this.FrontImage.Visibility = Visibility.Visible;
            }*/
            
        }
示例#13
0
 private void ContentPanel_ManipulationCompleted(object sender, System.Windows.Input.ManipulationCompletedEventArgs e)
 {
     if (e.IsInertial)
     {
         this.OnFlick(sender, e);
     }
 }
示例#14
0
        private void OnManipulationCompleted(object sender, Manipulation2DCompletedEventArgs e)
        {
            // Manipulation portion completed.

            if (_manualComplete && !_manualCompleteWithInertia)
            {
                // This is the last event in the sequence.

                ManipulationCompletedEventArgs completedArguments = ConvertCompletedArguments(e);
                RaiseManipulationCompleted(completedArguments);
            }
            else
            {
                // This event will configure inertia, which will start after this event.

                _lastManipulationBeforeInertia = ConvertDelta(e.Total, null);

                ManipulationInertiaStartingEventArgs inertiaArguments = new ManipulationInertiaStartingEventArgs(
                    _manipulationDevice,
                    LastTimestamp,
                    _currentContainer,
                    new Point(e.OriginX, e.OriginY),
                    ConvertVelocities(e.Velocities),
                    false);

                PushEvent(inertiaArguments);
            }

            _manipulationProcessor = null;
        }
示例#15
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);
            }

        }
示例#16
0
        // Al soltar el circulo. Comprueba coordenadas.
        private void azul_ManipulationCompleted_1(object sender, ManipulationCompletedEventArgs e)
        {
            Ellipse elipse = sender as Ellipse;
            string nombreObjeto = (sender as Ellipse).Name;
            double elipsex = Canvas.GetLeft(rect) + e.TotalManipulation.Translation.X;
            double elipsey = Canvas.GetTop(rect) + e.TotalManipulation.Translation.Y;
            //Canvas.Left="130" Canvas.Top="138"  Width="187"
            if (elipse.Name == "rojo" || elipse.Name == "azul" || elipse.Name == "amarillo")
            {
                if ((elipsex * -1) > 130 && (elipsex * -1) < 317)
                {
                    CambiarColores(nombreObjeto, nombreAnterior);
                }
            }
                //??
            else
            {
                if ((e.TotalManipulation.Translation.Y * -1) > 312 && (e.TotalManipulation.Translation.Y * -1) < 560)
                {
                    CambiarColores(nombreObjeto, nombreAnterior);
                }
            }

            if (ver == 0)
            {
                nombreAnterior = (sender as Ellipse).Name;
            }
            elipse.RenderTransform = null;
            dragTranslation = new CompositeTransform();
        }
 private void btn_Camera_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
 {
     PhotoChooserTask pcTask = new PhotoChooserTask();
     pcTask.ShowCamera = true;
     pcTask.Completed += new EventHandler<PhotoResult>(pcTask_Completed);
     pcTask.Show();
 }
 private void Slider1ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
 {
     var totalminutes = (int)slider1.Value;
     _hours = totalminutes / 60;
     _minutes = totalminutes - (60 * _hours);
     inpDuration.Value = new TimeSpan(_hours, _minutes, 0);
 }
示例#19
0
        private void OnInertiaCompleted(object sender, Manipulation2DCompletedEventArgs e)
        {
            // Inertia portion completed.

            ClearTimer();

            if (_manualComplete && _manualCompleteWithInertia)
            {
                // Another inertia portion was requested

                _lastManipulationBeforeInertia = ConvertDelta(e.Total, _lastManipulationBeforeInertia);

                ManipulationInertiaStartingEventArgs inertiaArguments = new ManipulationInertiaStartingEventArgs(
                    _manipulationDevice,
                    LastTimestamp,
                    _currentContainer,
                    new Point(e.OriginX, e.OriginY),
                    ConvertVelocities(e.Velocities),
                    true);

                PushEvent(inertiaArguments);
            }
            else
            {
                // This is the last event in the sequence.

                ManipulationCompletedEventArgs completedArguments = ConvertCompletedArguments(e);

                RaiseManipulationCompleted(completedArguments);
            }

            _inertiaProcessor = null;
        }
 private void BackImage_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
 {
     if (m_viewmodel.IsBackEnabled)
     {
         m_viewmodel.LoadViewModel(m_viewmodel.MonthID - 1);
         RenderUI();
     }
 }
示例#21
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Border_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
 {
     // Disable snap zoom
     if (e.FinalVelocities != null && (e.FinalVelocities.ExpansionVelocity.X != 0.0 || e.FinalVelocities.ExpansionVelocity.Y != 0.0))
     {
         e.Handled = true;
     }
 }
示例#22
0
 void obj_Zoom_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
 {
     PanAndZoomImage panAndZoomImage = (PanAndZoomImage)sender;
     if (Math.Abs(panAndZoomImage.Zoom - 1.0) < 0.05)
     {
         panAndZoomImage.Zoom = 1.0;
     }
 }
示例#23
0
 void SlideView_ManipulationCompleted(object sender, System.Windows.Input.ManipulationCompletedEventArgs e)
 {
     if (e.FinalVelocities != null)
     {
         var finalVelocities = e.FinalVelocities.LinearVelocity;
         CompleteManipulation(finalVelocities);
     }
 }
 private void NextImage_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
 {
     if (m_viewmodel.IsForwardEnabled)
     {
         m_viewmodel.LoadViewModel(m_viewmodel.MonthID + 1);
         RenderUI();
     }
 }
示例#25
0
        /// <summary>
        /// Is Tapped.
        /// </summary>
        /// <param name="e"></param>
        /// <returns></returns>
        public static bool IsTapped(ManipulationCompletedEventArgs e)
        {
            if (e.IsInertial)
                return false;

            Point t = e.TotalManipulation.Translation;
            return System.Math.Abs(t.X) <= TAP_THRESHOLD
                && System.Math.Abs(t.Y) <= TAP_THRESHOLD;
        }
示例#26
0
 protected virtual void OnBorderManipulationCompleted(object sender, System.Windows.Input.ManipulationCompletedEventArgs e)
 {
     // suppress zoom
     if (e.FinalVelocities.ExpansionVelocity.X != 0.0 ||
         e.FinalVelocities.ExpansionVelocity.Y != 0.0)
     {
         e.Handled = true;
     }
 }
示例#27
0
        private void TextBlock_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
        {
            IUpdatable upd = ((UserVm)this.DataContext).Photostream as IUpdatable;

            if (upd != null)
            {
                upd.Refresh();
            }
        }
示例#28
0
 private void btn_DIY_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
 {
     btn_DIY.Width = 150;
     btn_DIY.Height = 150;
     PhotoChooserTask pcTask = new PhotoChooserTask();
     pcTask.ShowCamera = true;
     pcTask.Completed += new EventHandler<PhotoResult>(pcTask_Completed);
     pcTask.Show();
 }
示例#29
0
 //load pivot content when it is enable
 void ContentLayout_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
 {
     int currentTab = ContentLayout.SelectedIndex;
     if (listOfPreviews[currentTab] != null)
     {
         AppsPreview currentPreview = listOfPreviews[currentTab];
         //currentPreview.load();
     }
 }
        protected override void ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
        {
            double totalManipulation = (e.TotalManipulation.Translation.X + e.FinalVelocities.LinearVelocity.X/20);
            FlipDirection flipDirection = totalManipulation > DRAG_THRESHOLD
                ? FlipDirection.Backward
                : totalManipulation < -DRAG_THRESHOLD ? FlipDirection.Forward : FlipDirection.Revert;

            DoFlip(flipDirection);
        }
示例#31
0
    private void RadiusSlider_OnValueChanged( object sender,
                                              ManipulationCompletedEventArgs manipulationCompletedEventArgs )
    {
      if(RadiusSlider.Value < 1)
        return;

      _backendlessGeoQuery.Radius = RadiusSlider.Value;
      SearchPoints();
    }
示例#32
0
        /// <summary>
        /// Called when manipulation of the cell is completed.
        /// It's fired when user takes the finger off the screen,
        /// even if the fingers have drifted away from the control.
        /// </summary>
        /// <param name="sender">Sender of the event</param>
        /// <param name="r">Event arguments</param>
        private void UserControl_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
        {
            // Start the fade out animation which returns the cell's color back to original.
            fadeOutAnimation.Begin();

            if (!IsPlayerSettable)
				SoundHelper.PlaySound(SoundHelper.SoundType.CellSelectedSound);
			else
                SoundHelper.PlaySound(SoundHelper.SoundType.NumberChosenSound);
        }
示例#33
0
        protected override void OnManipulationCompleted(ManipulationCompletedEventArgs e)
        {
            Point pt = e.ManipulationOrigin;

            if (pt.X > 0 && pt.X < this.ActualWidth && pt.Y > 0 && pt.Y < this.ActualHeight)
                IsChecked ^= true;

            e.Handled = true;
            base.OnManipulationCompleted(e);
        }
示例#34
0
        /// <summary>
        /// Called when the <see cref="E:System.Windows.UIElement.ManipulationCompleted" /> event occurs.
        /// </summary>
        /// <param name="e">The data for the event.</param>
        protected override void OnManipulationCompleted(ManipulationCompletedEventArgs e)
        {
            base.OnManipulationCompleted(e);
            if (e.Handled)
            {
                return;
            }

            e.Handled = this.Controller.HandleTouchCompleted(this, e.ToTouchEventArgs(this));
        }
		protected internal void email_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
        {
			var email = new EmailComposeTask
			{
				To = EmailAddress,
				Subject = PhoneHelper.GetAppAttribute("Title") + " Feedback"
			};

			email.Show();
		}
示例#36
0
 private void FrameWork_FlickCompleted (object sender, ManipulationCompletedEventArgs e)
 {
     if (e.TotalManipulation.Translation.X < -50 && WidgetTabControl.SelectedIndex < (WidgetTabControl.Items.Count - 1))
     {
         WidgetTabControl.SelectedIndex++;
     }
     else if (e.TotalManipulation.Translation.X > 50 && WidgetTabControl.SelectedIndex > 0)
     {
         WidgetTabControl.SelectedIndex--;
     }
 }
        private void slider_ManipulationCompleted(object sender, System.Windows.Input.ManipulationCompletedEventArgs e)
        {
            player.Position = TimeSpan.FromSeconds(slider.Value);
            timer.Start();

            player.Markers.Clear();
            player.Markers.Add(new TimelineMarker()
            {
                Time = (player.Position + TimeSpan.FromSeconds(3))
            });
        }
示例#38
0
        private void OnManipulationComPpleted(object sender, System.Windows.Input.ManipulationCompletedEventArgs e)
        {
            int userNum = new DirectionJudge().Direction(xDistance, yDistance);

            if (picTrue == userNum)
            {
                sum      += 10;
                Code.Text = sum.ToString();
                chang();
            }
            else
            {
                //VibrateController.Default.Start(TimeSpan.FromSeconds(1));
                MessageBox.Show("得分:" + sum.ToString());
                chang();
            }
        }
示例#39
0
 private void OnManipulationComPpleted(object sender, System.Windows.Input.ManipulationCompletedEventArgs e)
 {
     if (!isFirst)
     {
         isFirst = true;
         return;
     }
     isFirst = false;
     if (Math.Abs(x1Distance) > 10 || Math.Abs(y1Distance) > 10)
     {
         int userNum = new DirectionJudge().Direction(x1Distance, y1Distance);
         if (pic1True == userNum)
         {
             sum1         += 10;
             DownCode.Text = sum1.ToString();
             chang();
         }
         else
         {
             sum2       += 10;
             UpCode.Text = sum2.ToString();
             chang();
         }
     }
     if (Math.Abs(x2Distance) > 10 || Math.Abs(y2Distance) > 10)
     {
         int userNum = new DirectionJudge().Direction(x2Distance, y2Distance);
         if (pic2True == userNum)
         {
             sum2       += 10;
             UpCode.Text = sum2.ToString();
             chang();
         }
         else
         {
             sum1         += 10;
             DownCode.Text = sum1.ToString();
             chang();
         }
     }
     x1Distance = 0;
     y1Distance = 0;
     x2Distance = 0;
     y2Distance = 0;
 }
示例#40
0
        private void OnManipulationComPpleted(object sender, System.Windows.Input.ManipulationCompletedEventArgs e)
        {
            int userNum = new DirectionJudge().Direction(xDistance, yDistance);

            if (picTrue == userNum)
            {
                sum           += 10;
                time           = 2;
                MyTimeBox.Text = "剩余时间:2s";
                Code.Text      = sum.ToString();
                chang();
            }
            else
            {
                this.NavigationService.Navigate(new Uri("/FailPage.xaml", UriKind.Relative));
                MessageBox.Show("得分:" + sum.ToString());
            }
        }
示例#41
0
        void sv_ManipulationCompleted(object sender, System.Windows.Input.ManipulationCompletedEventArgs e)
        {
            if (e.TotalManipulation.Translation.X == 0)
            {
                return;
            }

            var sc = sender as ScrollViewer;

            this.Points[this.CurrIdx] = false;
            this.CurrIdx += e.TotalManipulation.Translation.X > 0 ? -1 : 1;
            this.Points[this.CurrIdx] = true;

            var t = this.Width * this.CurrIdx;

            Debug.WriteLine(t);
            sc.ScrollToHorizontalOffset(t);
            e.Handled = true;
        }
示例#42
0
        private void canvas_ManipulationCompleted(object sender, System.Windows.Input.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(-230);
                }
                else
                {
                    MoveViewWindow(-840);
                }
            }
            else
            {
                //slide to the right
                if (initialPosition < -420)
                {
                    MoveViewWindow(-420);
                }
                else
                {
                    MoveViewWindow(0);
                }
            }
        }
示例#43
0
        private void Image_ManipulationCompleted(object sender, System.Windows.Input.ManipulationCompletedEventArgs e)
        {
            // The IsGestureAvailable property will tell us if a gesture
            // has been recognised. It's possible there's more than one
            while (TouchPanel.IsGestureAvailable)
            {
                // Read and respond to the current gesture
                GestureSample gesture = TouchPanel.ReadGesture();

                if (gesture.GestureType == GestureType.Flick)
                {
                    // determine direction
                    var modifier = gesture.Delta.Y > 0 ? -1 : 1;
                    if (modifier == 1)
                    {
                        PictureViewViewModel.instance.NextImage();
                    }
                    else
                    {
                        PictureViewViewModel.instance.PreImage();
                    }
                }
            }
        }
示例#44
0
        /// <summary>
        ///     Starts the inertia phase based on the results of a ManipulationInertiaStarting event.
        /// </summary>
        internal void BeginInertia(ManipulationInertiaStartingEventArgs e)
        {
            if (e.CanBeginInertia())
            {
                _inertiaProcessor            = new InertiaProcessor2D();
                _inertiaProcessor.Delta     += OnManipulationDelta;
                _inertiaProcessor.Completed += OnInertiaCompleted;

                e.ApplyParameters(_inertiaProcessor);

                // Setup a timer to tick the inertia to completion
                _inertiaTimer          = new DispatcherTimer();
                _inertiaTimer.Interval = TimeSpan.FromMilliseconds(15);
                _inertiaTimer.Tick    += new EventHandler(OnInertiaTick);
                _inertiaTimer.Start();
            }
            else
            {
                // This is the last event in the sequence.
                ManipulationCompletedEventArgs completedArguments = GetManipulationCompletedArguments(e);
                RaiseManipulationCompleted(completedArguments);
                PushEventsToDevice();
            }
        }
        /// <summary>
        /// Step: 6
        /// Use the ManipulationCompleted event to determine the total amount the position of the manipulation changed.
        /// Use the stored value cumulativeDeltaX to determine if the movement is from left-to-right or right-to-left.
        /// Also call the isSwipeGesture function to determine if the manipulation formed a Swipe gesture or not.
        /// We need to show the next image when the photo app recognizes a swipe from right-to-left.
        /// So set the current index of the list view to next image.
        /// Similarly, when the photo app recognizes a swipe from left-to-right,
        /// it should set the current index of the list view to the previous image.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void centerImageView_ManipulationCompleted(object sender, System.Windows.Input.ManipulationCompletedEventArgs e)
        {
            bool isRightToLeftSwipe = false; //to determine swipe direction

            if (cumulativeDeltaX < 0)
            {
                //moving from right to left
                isRightToLeftSwipe = true;
            }
            //check if this is swipe gesture
            if (isSwipeGesture(cumulativeDeltaX, cumulativeDeltaY, linearVelocity))
            {
                if (isRightToLeftSwipe)
                {
                    //show previous image
                    this.imagesListBox.SelectedIndex = imagesListBox.SelectedIndex - 1;
                }
                else
                {
                    //show next image
                    this.imagesListBox.SelectedIndex = imagesListBox.SelectedIndex + 1;
                }
            }
        }
示例#46
0
        private void PostProcessInput(object sender, ProcessInputEventArgs e)
        {
            InputEventArgs inputEventArgs = e.StagingItem.Input;

            if (inputEventArgs.Device == this)
            {
                RoutedEvent routedEvent = inputEventArgs.RoutedEvent;
                if (routedEvent == Manipulation.ManipulationDeltaEvent)
                {
                    ManipulationDeltaEventArgs deltaEventArgs = inputEventArgs as ManipulationDeltaEventArgs;
                    if (deltaEventArgs != null)
                    {
                        // During deltas, see if panning feedback is needed on the window
                        ManipulationDelta unusedManipulation = deltaEventArgs.UnusedManipulation;
                        _manipulationLogic.RaiseBoundaryFeedback(unusedManipulation, deltaEventArgs.RequestedComplete);
                        _manipulationLogic.PushEventsToDevice();

                        // If a Complete is requested, then pass it along to the manipulation processor
                        if (deltaEventArgs.RequestedComplete)
                        {
                            _manipulationLogic.Complete(/* withInertia = */ deltaEventArgs.RequestedInertia);
                            _manipulationLogic.PushEventsToDevice();
                        }
                        else if (deltaEventArgs.RequestedCancel)
                        {
                            Debug.Assert(!deltaEventArgs.IsInertial);
                            OnManipulationCancel();
                        }
                    }
                }
                else if (routedEvent == Manipulation.ManipulationStartingEvent)
                {
                    ManipulationStartingEventArgs startingEventArgs = inputEventArgs as ManipulationStartingEventArgs;
                    if (startingEventArgs != null && startingEventArgs.RequestedCancel)
                    {
                        OnManipulationCancel();
                    }
                }
                else if (routedEvent == Manipulation.ManipulationStartedEvent)
                {
                    ManipulationStartedEventArgs startedEventArgs = inputEventArgs as ManipulationStartedEventArgs;
                    if (startedEventArgs != null)
                    {
                        if (startedEventArgs.RequestedComplete)
                        {
                            // If a Complete is requested, pass it along to the manipulation processor
                            _manipulationLogic.Complete(/* withInertia = */ false);
                            _manipulationLogic.PushEventsToDevice();
                        }
                        else if (startedEventArgs.RequestedCancel)
                        {
                            OnManipulationCancel();
                        }
                        else
                        {
                            // Start ticking to produce delta events
                            ResumeAllTicking(); // Resumes the ticking of all the suspended devices on the thread
                            StartTicking();     // Ensures that we continue ticking or restart ticking for this device
                        }
                    }
                }
                else if (routedEvent == Manipulation.ManipulationInertiaStartingEvent)
                {
                    // Switching from using rendering for ticking to a timer at lower priority (handled by ManipulationLogic)
                    StopTicking();

                    // Remove all the manipulators so that we dont re-start manipulations accidentally
                    RemoveAllManipulators();

                    // Initialize inertia
                    ManipulationInertiaStartingEventArgs inertiaEventArgs = inputEventArgs as ManipulationInertiaStartingEventArgs;
                    if (inertiaEventArgs != null)
                    {
                        if (inertiaEventArgs.RequestedCancel)
                        {
                            OnManipulationCancel();
                        }
                        else
                        {
                            _manipulationLogic.BeginInertia(inertiaEventArgs);
                        }
                    }
                }
                else if (routedEvent == Manipulation.ManipulationCompletedEvent)
                {
                    _manipulationLogic.OnCompleted();
                    ManipulationCompletedEventArgs completedEventArgs = inputEventArgs as ManipulationCompletedEventArgs;
                    if (completedEventArgs != null)
                    {
                        if (completedEventArgs.RequestedCancel)
                        {
                            Debug.Assert(!completedEventArgs.IsInertial);
                            OnManipulationCancel();
                        }
                        else if (!(completedEventArgs.IsInertial && _ticking))
                        {
                            // Remove the manipulation device only if
                            // another manipulation didnot start
                            OnManipulationComplete();
                        }
                    }
                }
                else if (routedEvent == Manipulation.ManipulationBoundaryFeedbackEvent)
                {
                    ManipulationBoundaryFeedbackEventArgs boundaryEventArgs = inputEventArgs as ManipulationBoundaryFeedbackEventArgs;
                    if (boundaryEventArgs != null)
                    {
                        _compensateForBoundaryFeedback = boundaryEventArgs.CompensateForBoundaryFeedback;
                    }
                }
            }
        }
示例#47
0
 private void OnManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
 {
 }
示例#48
0
 private void viewport_ManipulationCompleted(object sender, System.Windows.Input.ManipulationCompletedEventArgs e)
 {
     m_Zoom = image.Width / m_Width;
 }
示例#49
0
 public virtual void ManipulationCompleted(System.Windows.Input.ManipulationCompletedEventArgs e)
 {
 }
        void Button_ManipulationCompleted(object sender, System.Windows.Input.ManipulationCompletedEventArgs e)
        {
            e.Handled = true;

            Button_Click(this, e);
        }
示例#51
0
 private void Border_ManipulationCompleted(object sender, System.Windows.Input.ManipulationCompletedEventArgs e)
 {
     this.OnFlick(sender, e);
 }
示例#52
0
 private void RaiseManipulationCompleted(ManipulationCompletedEventArgs e)
 {
     PushEvent(e);
 }
示例#53
0
 void element_ManipulationCompleted(object sender, System.Windows.Input.ManipulationCompletedEventArgs e)
 {
 }
示例#54
0
 private void IntervalSlider_ManipulationCompleted(object sender, System.Windows.Input.ManipulationCompletedEventArgs e)
 {
     _dispatcherTimer.Interval = new TimeSpan(0, 0, GetSliderValue());
 }