private static bool tmlock = false; //lock for timer handler void uiTimer_Tick(object sender, EventArgs e) { if (tmlock) { return; } tmlock = true; if (DeviceMgr.Loaded && statusBar1.status == RUN_STATE.DISABLED) { statusBar1.status = RUN_STATE.IDLE; } if (lastcall != "") { if (lastcall == "newtime") { lastcall = ""; Program.kbd.Init(StringResource.str("enter_newtime"), "newtime", false, KbdData); } tmlock = false; return; } else { if (task.bRunning) { task.Step(); statusBar1.pause = task.bPaused; statusBar1.waiting = task.waiting; if (!task.bRunning) { statusBar1.status = RUN_STATE.IDLE; DeviceMgr.Log("测量结束..."); } } } tmlock = false; }
private static bool tmlock = false; //lock for timer handler void uiTimer_Tick(object sender, EventArgs e) { if (tmlock) { return; } tmlock = true; if (DeviceMgr.Loaded && status == RUN_STATE.DISABLED) { status = RUN_STATE.IDLE; } if (task.bRunning) { task.Step(); if (!task.bRunning) { status = RUN_STATE.IDLE; DeviceMgr.Log("Measurement Stopped..."); } } tmlock = false; }