public async Task ConnectPins() { String result = await remoteVM.SelectedRaspiItem.raspi.ConnectPins ((int)muxModel.ValueX, (int)muxModel.ValueY); debugVM.AddDebugInfo("Connecting pins: ", result); }
public void addRaspberryPi(string Address, string status) { //IsPiConnected = false; IPAddress address; try { address = IPAddress.Parse(Address); } catch (FormatException fx) { debugVM.AddDebugInfo("[ERROR]", "Invalid IP Address Format: " + fx.Message); return; } IPEndPoint endpoint = new IPEndPoint(address, 54321); foreach (var entry in BackendList) { if (entry.endpoint.Equals(endpoint)) { debugVM.AddDebugInfo("addRaspberryPi", "Already in the List"); return; } } RaspberryPi raspi = new RaspberryPi(); SynchronizationContext uiContext = SynchronizationContext.Current; raspi.ConnectionClosed += (object sender, Exception e) => OnConnectionClosed(sender, e, uiContext); RaspberryPiItem raspiItem = new RaspberryPiItem() { endpoint = endpoint, Status = status, raspi = raspi, Connected = false }; BackendList.Add(raspiItem); SelectedRaspiItem = raspiItem; CollectionViewSource.GetDefaultView(BackendList).Refresh(); }