private void btnTakeSeries_Click(object sender, EventArgs e) { double phaseShift = 0; double phaseShiftStep = GetPhaseShiftStep(); Action takePictureAction = () => { Thread.Sleep(PICTURE_TAKEN_DELAY); SynchronizationManager.SetSignal(HoloCommon.Synchronization.Events.Camera.TAKE_PICTURE); }; Action pictureTakenAction = () => { if (phaseShift < 2 * Math.PI) { CreateInterferogram(phaseShift); phaseShift += phaseShiftStep; } }; Thread thread1 = SynchronizationManager.RunActionOnSignal(pictureTakenAction, HoloCommon.Synchronization.Events.Image.IMAGE_SAVED); Thread thread2 = SynchronizationManager.RunActionOnSignal(takePictureAction, HoloCommon.Synchronization.Events.Image.IMAGE_UPDATED); SynchronizationManager.SetSignal(HoloCommon.Synchronization.Events.Image.IMAGE_UPDATED); }
static void Main(string[] args) { SynchronizationManager.RunActionOnSignal(PictureTakenHandler, Events.Camera.PICTURE_TAKEN); string command = null; while (!String.Equals(command, "q", StringComparison.OrdinalIgnoreCase)) { command = Console.ReadLine(); if (command == "sync") { SynchronizationManager.SetSignal(Events.Camera.TAKE_PICTURE); } } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); CameraForm cameraForm = new CameraForm(); Action takePictureAction = () => { cameraForm.TakePhoto(); }; Thread thread = SynchronizationManager.RunActionOnSignal(takePictureAction, Events.Camera.TAKE_PICTURE); cameraForm.FormClosed += (object sender, FormClosedEventArgs e) => { thread.Abort(); }; Application.Run(cameraForm); }
static void Main(string[] args) { SynchronizationManager.RunActionOnSignal(Process, Events.Camera.TAKE_PICTURE); }