在WPF空闲检测 [英] Idle Detection in WPF

查看:182
本文介绍了在WPF空闲检测的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用WPF新的,所以我不知道如何来检测空闲时间,并显示闲置5分钟后,主窗口。

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.

推荐答案

您可以做;

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



从的这里

这篇关于在WPF空闲检测的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆