private void ConnectDevice() { // Wait for 1 second fX3Connection.WaitForBoard(1); if (fX3Connection.AvailableFX3s.Count == 1) { // MVVM approach boardDataVM.SerialNumber = fX3Connection.AvailableFX3s[0]; // Straightforward approach fX3Connection.Connect(boardDataVM.SerialNumber); CheckIfAttached(); } }
/// <summary> /// Connect to FX3 board /// </summary> private void ConnectToBoard() { FX3.WaitForBoard(2); if (FX3.AvailableFX3s.Count() > 0) { FX3.Connect(FX3.AvailableFX3s[0]); } else if (FX3.BusyFX3s.Count() > 0) { FX3.ResetAllFX3s(); FX3.WaitForBoard(5); ConnectToBoard(); } else { throw new Exception("No FX3 board connected!"); } }
public void Connect() { /* Return if board already connected */ if (FX3.ActiveFX3 != null) { return; } FX3.WaitForBoard(5); if (FX3.AvailableFX3s.Count > 0) { FX3.Connect(FX3.AvailableFX3s[0]); } else if (FX3.BusyFX3s.Count > 0) { FX3.ResetAllFX3s(); FX3.WaitForBoard(5); Connect(); } else { Assert.True(false, "ERROR: No FX3 board connected!"); } }