Idle Detection in WPF

与世无争的帅哥 提交于 2019-11-27 16:29:53

问题


I'm new in using WPF so I have no Idea how to detect Idle time and show the main window after 5mins of Idle.

Can anyone help me? Thank you so much.


回答1:


You can do;

var timer = new DispatcherTimer
    (
    TimeSpan.FromMinutes(5),
    DispatcherPriority.ApplicationIdle,// Or DispatcherPriority.SystemIdle
    (s, e) => { mainWindow.Activate(); }, // or something similar
    Application.Current.Dispatcher
    );

picked up from here



来源:https://stackoverflow.com/questions/23286766/idle-detection-in-wpf

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!