private void RollAfterDrag() { const double ROLL_THRESHOLD = 1; const double ROLL_FALLOFF = 1.05; current_scroll_gamma.X /= ROLL_FALLOFF; current_scroll_gamma.Y /= ROLL_FALLOFF; Scroll(current_scroll_gamma); // Check if we should keep going // Utilities.LockPerfTimer l1_clk = Utilities.LockPerfChecker.Start(); lock (thread_lock) { // l1_clk.LockPerfTimerStop(); if (Math.Abs(current_scroll_gamma.X) < ROLL_THRESHOLD && Math.Abs(current_scroll_gamma.Y) < ROLL_THRESHOLD) { is_someone_scrolling = false; } else { WPFDoEvents.InvokeAsyncInUIThread(() => RollAfterDrag(), DispatcherPriority.Background); } } }
private void BackgroundQueueRollAfterDrag(Point gamma) { current_scroll_gamma.X = gamma.X; current_scroll_gamma.Y = gamma.Y; // Utilities.LockPerfTimer l1_clk = Utilities.LockPerfChecker.Start(); lock (thread_lock) { // l1_clk.LockPerfTimerStop(); if (!is_someone_scrolling) { is_someone_scrolling = true; WPFDoEvents.InvokeAsyncInUIThread(() => RollAfterDrag(), DispatcherPriority.Background); } } }