private ManipulationDevice(UIElement element) : base() { _target = element; _activeSource = PresentationSource.CriticalFromVisual(element); _inputManager = InputManager.UnsecureCurrent; _inputManager.PostProcessInput += new ProcessInputEventHandler(PostProcessInput); _manipulationLogic = new ManipulationLogic(this); }
internal void OnManipulatorUpdated(object sender, EventArgs e) { // After a period of inactivity, the ManipulationDevice will stop polling at the screen framerate // to stop wasting CPU usage. This notification will tell the device that activity is happening // so that it can know to poll. LastUpdatedTimestamp = ManipulationLogic.GetCurrentTimestamp(); ResumeAllTicking(); // Resumes the ticking of all the suspended devices on the thread StartTicking(); // Ensures that we continue ticking or restart ticking for this device }
private void OnRendering(object sender, EventArgs e) { ReportFrame(); // If Manipulation didn't activate or becomes disabled, then stop ticking. // If we've exceeded the timeout without any manipulators updating, then stop ticking // to save energy. If a manipulator updates, we'll start ticking again. if (!IsManipulationActive || (ManipulationLogic.GetCurrentTimestamp() - LastUpdatedTimestamp) > ThrottleTimeout) { _wasTicking = _ticking; // ReportFrame could have stopped the ticking, hence take the latest value. StopTicking(); } }