我如何捕获全局触摸事件?

How can i capture a global touch event?

我在 UWP 中有一个 Xamarin 应用程序,它有多个屏幕,在使用时会逐渐增加。每个屏幕上都有多个控件,他们可以在其中输入信息。我想做的是 - 如果屏幕没有以用户触摸/点击的方式进行任何交互,则超时并返回到开头。我当然可以捕获每个已被触摸和重置的控件的事件,但我想知道是否有 'Global' 触摸事件会在触摸屏幕时触发。

if there is like a 'Global' touch event that will fire when the screen is touched.

当然,对于 UWP,您可以为当前 CoreWindow 添加 PointerEntered 事件处理程序,它是顶层的 Global。请参考以下步骤。

public MainPage()
{
    this.InitializeComponent();
    Window.Current.CoreWindow.PointerEntered += CoreWindow_PointerEntered;
}

private void CoreWindow_PointerEntered(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.PointerEventArgs args)
{
    // do some stuff
}