闲置的应用程序 [英] Application that is idle

查看:90
本文介绍了闲置的应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当应用程序闲置大约2分钟时,如何显示类似短语的内容?

解决方案

这实际上比你更难和更多的工作密集想想。

你需要一个计时器,(最好设置一个合理的限制 - 一秒钟是好的)和一个计数器让它达到两分钟。

每次你得到一个Timer.Tick事件,检查计数。如果它为零,则什么也不做。

否则,减少一个。如果它变为零,则显示你的短语。



现在更难的部分。编写一个方法(可能称为Tickle),将计数设置为两分钟。简单。现在决定什么构成不闲置并在每次用户执行时调用Tickle。



看看我的意思?你必须把这个方法调用到任何地方 - 我的意思是无处不在!笑:

How can i display something like a Phrase when an application is idle for about 2 minutes?

解决方案

That's actually a lot harder and more work intensive than you might think.
You need a timer, (preferably set on a sensible limit - one second is good) and a counter to get it to two minutes.
Each time you get a Timer.Tick event, check the count. If it's zero, do nothing.
Otherwise, reduce it by one. If that makes it zero, display your phrase.

Now for the harder part. Write a method (called "Tickle" perhaps) that sets the count to two minutes. Easy. Now decide what constitutes "not being idle" and call Tickle every time the user does it.

See what I mean? You gotta put that method call in everywhere - and I do mean everywhere! laugh:


这篇关于闲置的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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