Timer to close the application

前端 未结 7 1889
离开以前
离开以前 2021-01-12 02:40

How to make a timer which forces the application to close at a specified time in C#? I have something like this:

void  myTimer_Elapsed(object sender, System.         


        
7条回答
  •  我在风中等你
    2021-01-12 02:58

    void myTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
    {
        if (DateTime.Now.Hour >= 23)
        {
            this.Close();
        }
    }
    

提交回复
热议问题