winform 高手进

sdfgdfgsdfgsfg sdfgdfgsdfgsfg 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
private bool IsRun;
private void stop_Click(object sender, EventArgs e)
{
IsRun = false;
StreamWriter sw = File.AppendText(@"d:\myserver.txt");
sw.WriteLine(string.Format("停止:启动时间{0}", DateTime.Now));
sw.Close();
}

private void begin_Click(object sender, EventArgs e)
{
IsRun = true;
while (IsRun)
{
try
{
StreamWriter sw = File.AppendText(@"d:\myserver.txt");
sw.WriteLine(string.Format("启动:启动时间{0}", DateTime.Now));
sw.Close();
}
catch (Exception ex)
{
throw ex;
}

System.Threading.Thread.Sleep(10000);
}
}
}

当按下按钮beigin后。。为什么stop按钮无法被按下。。好像假死的状态?????????????
...全文
评论 6
收藏 已收藏
分享
返回顶部
sdfgdfgsdfgsfg
C# 111,128 成员 642,537 内容