public void PopulateImages() { if (this.SelectedBoard == null) { return; } Guid originallySelected = Guid.Empty; if (this.SelectedFirmware != null) { originallySelected = this.SelectedFirmware.Id; } var images = this.Source.GetCompatibleFirmwareImages(this.SelectedBoard.Id); _imagesSource.Clear(); _imagesSource.AddRange(images); if (this.Source.FirmataAppVersion != null && !string.IsNullOrEmpty(this.Source.FirmataAppName)) { foreach (var item in _images) { item.IsInstalled = (item.ViewSource.AppName == FirmataAppName && item.ViewSource.AppVersion == this.Source.FirmataAppVersion); } } if (originallySelected == Guid.Empty) { if (_images.Any(x => x.IsInstalled)) { this.SelectedFirmware = _images.FirstOrDefault(x => x.IsInstalled); } else { this.SelectedFirmware = _images.FirstOrDefault(); } } else { this.SelectedFirmware = _images.FirstOrDefault(x => x.Id == originallySelected); } }
public void PopulateBoards() { Guid originallySelected = Guid.Empty; if (this.SelectedFirmware != null) { originallySelected = this.SelectedBoard.Id; } var boards = this.Source.GetCandidateBoards(); _boardsSource.Clear(); _boardsSource.AddRange(boards); if (originallySelected == Guid.Empty) { this.SelectedBoard = _boards.FirstOrDefault(); } else { this.SelectedBoard = _boards.FirstOrDefault(x => x.Id == originallySelected); } }