// FUNCTION: timer1_Tick: Main tick handler // // private void timer1_Tick(object sender, EventArgs e) { // we need avoid re-entry when busy. if (fRecordingImageToDisk || fReadingImage) { return; } // update the current image display fReadingImage = true; DownloadImage(); // this sets bitmap_Current & bitmap_CurrentRed fReadingImage = false; // Now execute the state machine if (statemach.Step(recparamSet, FCathodeDetected())) { RecordImage(); bitmap_LastSavedRed = bitmap_CurrentRed.Clone(rectRed, pixelformat); // copy the current image to last saved; pictBox_LastSaved.Image = bitmap_LastSavedRed; // and display them both } // And update the display UpdateDisplay(); }