如何提醒 [英] how to make reminder

查看:89
本文介绍了如何提醒的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用1个组合框和计时器。在这个组合框中,ı有5分钟,10分钟和15分钟。当ı将在组合索引中选择它会提醒我,选择了几分钟后?

ı m useing 1 combobox and timer.In this combobox , ı have 5minutes,10minutes and 15 minutes.when ı will select in combo index it will reminder me ,After which minutes selected?

推荐答案

这听起来像是作业,所以我不会给你代码。

但它并不复杂:



处理 ComboBox.SelectedIndexChanged事件 [ ^ ]并获取新值。

将新值转换为秒数,并将其添加到当前DateTime。

将其保存在类级变量alarmTime中。

将计时器设置为每秒触发一次。

在Timer.Tick事件中,比较alarmTime和当前时间。如果现在是在alarmTime之后,请将alarmTime设置为DateTime.MaxValue并发出提醒。
This sounds like homework, so I won't give you code.
But it's not complex:

Handle the ComboBox.SelectedIndexChanged event[^] and get the new value.
Convert the new value to a number of seconds, and add it to the current DateTime.
Save this in a class level variable alarmTime.
Set your timer to fire once per second.
In the Timer.Tick event, compare the alarmTime and the current time. If it is now after the alarmTime, set alarmTime to DateTime.MaxValue and issue your reminder.


        private void Display()
        {
            MessageBox.Show("Time start now");
           //5000 is the number of miliseconds you want to pause.
            System.Threading.Thread.Sleep(5000);

            MessageBox.Show("Time Stop now");
        
        }

//On selected index Change
 Thread t = new Thread(Display);
            t.Start();


这篇关于如何提醒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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