This is one of the last key features in the actual case: Reminder notifications
The strange situation encountered
The current setup is to combine a Timer with a Windows Form, which is the download for sending notifications
As we all know, there are three built-in timer available in C # Environment: Windows Form Timer, System.timer, Threading.timer
The strange things that are encountered, mainly in System.timer this section
The codes are as follows:
usingSystem;usingSystem.Drawing;usingSystem.Text;usingSystem.Threading;usingsystem.timers;usingSystem.Windows.Forms;namespacesystemtimer{ Public Partial classForm1:form {intNumber =0; DateTime DT1=NewDateTime (); DateTime DT2=NewDateTime (); System.Timers.Timer TM; PublicForm1 () {InitializeComponent (); } Private voidForm1_Load (Objectsender, EventArgs e) { } Private voidB1_click (Objectsender, EventArgs e) {TM=NewSystem.Timers.Timer (); Tm. Interval= -; Tm. Enabled=true; TM. Elapsed + = new System.Timers.ElapsedEventHandler (tm_elapsed); Tm. Start (); DT1=DateTime.Now; } Private voidB2_click (Objectsender, EventArgs e) {TM. Enabled=false; DT2=DateTime.Now; MessageBox.Show (convert.tostring (DT2-dt1)); } Private voidTm_elapsed (Objectsender, System.Timers.ElapsedEventHandler e) {lbmsg. Text= convert.tostring (+ +Number ); Thread.Sleep ( the); } }}
When you edit the red line, you are prompted to do something wrong, so you can take a look at the official information of the software.
Back to the prototype of the function
Public Delegate void elapsedeventhandler ( Object sender, elapsedeventargs e)
So just put
Private void tm_elapsed (objectSystem.Timers.ElapsedEventHandler e) { = convert.tostring (+ + number); Thread.Sleep (+); }
Change into
Private void tm_elapsed (objectSystem.Timers.ElapsedEventArgs e) { = Convert.ToString (+ + number); Thread.Sleep (+); }
You can do it.
Troubleshooting: No multiple downloads are eligible for System.Timers.ElapsedEventHandler delegation