Пример #1
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();
            }
        }
Пример #2
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(); 
            }
        }