针对特定时间应用程序警报的最佳实践

编程入门 行业动态 更新时间:2024-10-26 05:23:34
本文介绍了针对特定时间应用程序警报的最佳实践的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

嗨 我一直在网上搜索我的应用程序中实现警报的好方法。我的目标是设置一天中的时间,当它到达时,向用户显示一条消息。 我正在考虑使用一个会睡到的后台工作人员所需的时间和火灾的东西,但我看到各种文章说Thread.Sleep()不是一个好主意。 我不想用某个类中的Timer虽然看起来不太优雅,但认为它可能会干扰应用程序太多在同一个线程上。 即使有人说不使用Thread.Sleep(),似乎也没有任何轻量级解决方案。在这种情况下,Thread.Sleep()可以正常吗,因为所有它必须要等到所需的时间才能做某事吗? 任何建议/想法都会很棒。 干杯 FoZ

解决方案

1) alarm-clock-application-in-net [ ^ ] 检查这个帖子。虽然你提到你不喜欢使用计时器,但是后来看看还有更多,他们还有一些其他解决方案..检查一次。 2)闹钟在C# [ ^ ] 在这里你可以下载样本时钟并检查它们是否能很好地完成贪睡功能。 希望我的链接对你有帮助û

Hi I been scouring the web for a good way to implement an alarm in my application. My aim is to set a time of day and when it is reached, display a message to a user. I was thinking of using a background worker that would Sleep until the required time and fire things on but I've seen various articles saying that Thread.Sleep() is not a good idea. I didn't want to use a Timer in a class somewhere as it didn't seem very elegant and thought it could interfere with the application too much being on the same thread. There didn't seem to be any lightweight solutions even though people were saying not to use Thread.Sleep(). Could Thread.Sleep() be ok in this situation as all it has to do is wait till the desired time to do something? Any suggestions / ideas would be great. Cheers FoZ

解决方案

1)alarm-clock-application-in-net[^] Check this thread.though u mentioned that you don't like to use timer, but then also have a look and more over they have some other solutions also..check them once. 2)Alarm Clock in C#[^] here you can download the sample clock and check as they made the snooze function nicely. Hope my links will be helpful to you

更多推荐

针对特定时间应用程序警报的最佳实践

本文发布于:2023-11-27 05:26:15,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1636780.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:警报   应用程序   时间

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!