void Select(Platform.Connection connection) { if (connection != null) { ConnectionVM item = Connections.FirstOrDefault(c => c.Address == connection.Address && c.Port == connection.Port); if (item != null) { Selection = item; return; } } Selection = Connections.FirstOrDefault(); }
public void Update(Platform.Connection connection) { ConnectionVM item = Connections.FirstOrDefault(c => c.Address == connection.Address && c.Port == connection.Port); if (item != null) { item.Name = String.IsNullOrEmpty(connection.Name) ? connection.Target.ToString() : connection.Name; item.Target = connection.Target; if (item.CanEdit) { item.CanEdit = false; item.CanDelete = true; } } else { item = new ConnectionVM(connection); Connections.Add(item); } AddEditableItem(); Selection = item; Task.Run(() => Save()); }