private void SplashScreen_Shown(object sender, EventArgs e) { try { AsyncRun b = new AsyncRun(UpdateGIG); b.BeginInvoke(null, null); } catch { } }
public void stop() { if (isStarted) { _StopRequest = true; // Boolean assignment is atomic according to C# Language Specification section 12.5 _Worker.EndInvoke(_WorkerResult); _Worker = null; } // Stop acqusition Bird.StopFrameStream(GROUP_ID); Bird.ShutDown(GROUP_ID); }
public void start(ushort ComPort, uint BaudRate) { if (isStarted) return; OnStatus(new StatusEventArgs("Initializing...")); // Start by sending the wake up command to the Flock if (!Bird.RS232WakeUp(GROUP_ID, true, 1, ref ComPort, BaudRate, READ_TIMEOUT, WRITE_TIMEOUT, Bird.GroupModeSettings.GMS_GROUP_MODE_ALWAYS)) { OnStatus(new StatusEventArgs("Bird wake up failed")); return; } // Configure the device ConfigureEventArgs cfg = new ConfigureEventArgs(); if (!Bird.GetSystemConfig(GROUP_ID, ref cfg.SystemConfig, false)) { OnStatus(new StatusEventArgs("Bird system configuration failed")); return; } if (!Bird.GetDeviceConfig(GROUP_ID, 1, ref cfg.DeviceConfig, false)) { OnStatus(new StatusEventArgs("Bird device configuration failed")); return; } OnConfigure(cfg); if (!Bird.SetSystemConfig(GROUP_ID, ref cfg.SystemConfig)) { OnStatus(new StatusEventArgs("Bird system configuration failed")); return; } if (!Bird.SetDeviceConfig(GROUP_ID, 1, ref cfg.DeviceConfig)) { OnStatus(new StatusEventArgs("Bird device configuration failed")); return; } // Start acquisition if (!Bird.StartFrameStream(GROUP_ID)) { OnStatus(new StatusEventArgs("Bird failed to start streaming")); return; } _PosScale = cfg.DeviceConfig.Scaling; // Start receiving frames asynchronously _StopRequest = false; _Worker = new AsyncRun(run); _WorkerResult = _Worker.BeginInvoke(AsyncOperationManager.CreateOperation(this), new SendOrPostCallback(OnPose), new SendOrPostCallback(OnStatus), null, null); OnStatus(new StatusEventArgs("Ok")); }
public static FiberThreadAwaiter <ReturnResult> LogOn(this AsyncRun async, string username) { return(async.CR((int)Cmdtype.LogOn, username)); }
public void start(ushort ComPort, uint BaudRate) { if (isStarted) { return; } OnStatus(new StatusEventArgs("Initializing...")); // Start by sending the wake up command to the Flock if (!Bird.RS232WakeUp(GROUP_ID, true, 1, ref ComPort, BaudRate, READ_TIMEOUT, WRITE_TIMEOUT, Bird.GroupModeSettings.GMS_GROUP_MODE_ALWAYS)) { OnStatus(new StatusEventArgs("Bird wake up failed")); return; } // Configure the device ConfigureEventArgs cfg = new ConfigureEventArgs(); if (!Bird.GetSystemConfig(GROUP_ID, ref cfg.SystemConfig, false)) { OnStatus(new StatusEventArgs("Bird system configuration failed")); return; } if (!Bird.GetDeviceConfig(GROUP_ID, 1, ref cfg.DeviceConfig, false)) { OnStatus(new StatusEventArgs("Bird device configuration failed")); return; } OnConfigure(cfg); if (!Bird.SetSystemConfig(GROUP_ID, ref cfg.SystemConfig)) { OnStatus(new StatusEventArgs("Bird system configuration failed")); return; } if (!Bird.SetDeviceConfig(GROUP_ID, 1, ref cfg.DeviceConfig)) { OnStatus(new StatusEventArgs("Bird device configuration failed")); return; } // Start acquisition if (!Bird.StartFrameStream(GROUP_ID)) { OnStatus(new StatusEventArgs("Bird failed to start streaming")); return; } _PosScale = cfg.DeviceConfig.Scaling; // Start receiving frames asynchronously _StopRequest = false; _Worker = new AsyncRun(run); _WorkerResult = _Worker.BeginInvoke(AsyncOperationManager.CreateOperation(this), new SendOrPostCallback(OnPose), new SendOrPostCallback(OnStatus), null, null); OnStatus(new StatusEventArgs("Ok")); }