[問題] 重複IF的情況
現在會自動在duration時間完結後關掉USB.EXE 但duration時間後 IF還會一直執行
USB.EXE 然後ELSE會一直把USB.EXE殺掉 USB.EXE一直打開重關掉
是那裡出現了問題
bool usbStarted = false;
if (span.Seconds > 0 && span.Seconds < duration)
{
if (!usbStarted)
{
Process.Start(@"C:\Users\USER\Desktop\usb.exe");
usbStarted = true;
}
else
{
timer2.Interval = duration * 60;
timer1.Start();
foreach (Process prc in Process.GetProcessesByName("usb"))
{
prc.Kill();
}
usbStarted = false;
}
}
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 123.192.192.62
※ 文章網址: https://www.ptt.cc/bbs/C_Sharp/M.1479839195.A.0FC.html
→
11/23 09:56, , 1F
11/23 09:56, 1F
→
11/23 09:56, , 2F
11/23 09:56, 2F
推
11/23 16:01, , 3F
11/23 16:01, 3F
推
11/24 20:08, , 4F
11/24 20:08, 4F
推
11/25 10:36, , 5F
11/25 10:36, 5F
推
11/25 14:29, , 6F
11/25 14:29, 6F
C_Sharp 近期熱門文章
PTT數位生活區 即時熱門文章