简体   繁体   中英

c# metro style app user inactive time trigering

i need to launch method when user is not active for specific amount of time

i have a timer which trigger the method, but i was trying to reset it in actions like:

ManipulationStarted, PointerPressed, SelectionChanged, Holding, ItemClick

here is my timer:

but nothing resets the timer:

public void timer_start()
{
    DownloadPromoted();
    timer.Interval = new TimeSpan(0, 0, 15);
    timer.Start();
}

here i reset my timer:

public void timer_stop()
{
    timer.Stop();
    timer_start();
}

is there a way to understand if user is doing something in metro app?

This has not been tested but i think you could do this.

Window.Current.CoreWindow.PointerPressed += InputRecieved();

private Windows.Foundation.TypedEventHandler<Windows.UI.Core.CoreWindow, Windows.UI.Core.PointerEventArgs> InputRecieved()
{
    IsActive = true;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM