请教!c#程序运行无反应

happysxm happysxm 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
写了个到点自动关机的程序,运行起来没有反应,请大家帮忙检查下,自己感觉代码没问题,搞不懂了!

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Timers;
using System.Diagnostics;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{ Timer time1=new Timer();
time1.Interval = 60000;
time1.Elapsed += new ElapsedEventHandler(time1_Elapsed);
time1.Enabled = true;
time1.AutoReset = true;
time1.Start();
}
static void time1_Elapsed(object sender, ElapsedEventArgs e)
{
DateTime current = new DateTime();
current = DateTime.Now;
if (current.Hour>=19|current.Hour<6)
{
Process.Start("shutdown", "-s -f -t 60");
}
}
}
}
请大家指教!
...全文

相关推荐

评论 9
收藏 已收藏
分享
返回顶部
happysxm
C# 111,130 成员 642,541 内容