There is a code written in Windows Forms:
DateTime TimeToWorkServerTemp; DateTime ServerTemp = DateTime.Now; TimeToWorkServerTemp = new DateTime(ServerTemp.Year, ServerTemp.Month, ServerTemp.Day, ServerTemp.Hour, ServerTemp.Minute, 0); var ServtempDel = new System.Windows.Forms.Timer { Interval = 1000, Enabled = true }; ServtempDel.Tick += delegate { if (TimeToWorkServerTemp < DateTime.Now) { что то делается TimeToWorkServerTemp = TimeToWorkServerTemp.AddMinutes(1); ServtempDel.Enabled = true; } };
The problem is that in the Windows Form it quietly works, and if you use the code in the console, then the code does not work, tell me the reason?