mirror of
https://github.com/rbalsleyMSFT/FFU.git
synced 2026-06-14 02:09:35 -06:00
Improve architecture handling for msstore applications
Refactors the application download logic to correctly handle packages from the 'msstore' source, which does not support architecture specification. - The download process no longer passes an architecture parameter for msstore apps. - The architecture selection dropdown in the UI is now disabled for msstore apps to prevent invalid configurations. - Imported or searched msstore apps will display 'NA' for their architecture.
This commit is contained in:
@@ -411,7 +411,7 @@ function Initialize-DynamicUIElements {
|
||||
$comboBoxFactory = New-Object System.Windows.FrameworkElementFactory([System.Windows.Controls.ComboBox])
|
||||
|
||||
# The ItemsSource for the ComboBox
|
||||
$availableArchitectures = @('x86', 'x64', 'arm64', 'x86 x64')
|
||||
$availableArchitectures = @('x86', 'x64', 'arm64', 'x86 x64', 'NA')
|
||||
$comboBoxFactory.SetValue([System.Windows.Controls.ItemsControl]::ItemsSourceProperty, $availableArchitectures)
|
||||
|
||||
# Bind the text property to the 'Architecture' property of the data item.
|
||||
@@ -420,6 +420,18 @@ function Initialize-DynamicUIElements {
|
||||
$binding.Mode = [System.Windows.Data.BindingMode]::TwoWay
|
||||
$comboBoxFactory.SetBinding([System.Windows.Controls.ComboBox]::TextProperty, $binding)
|
||||
|
||||
# Create a style to disable the ComboBox for 'msstore' source
|
||||
$comboBoxStyle = New-Object System.Windows.Style
|
||||
$comboBoxStyle.TargetType = [System.Windows.Controls.ComboBox]
|
||||
|
||||
$dataTrigger = New-Object System.Windows.DataTrigger
|
||||
$dataTrigger.Binding = New-Object System.Windows.Data.Binding("Source")
|
||||
$dataTrigger.Value = "msstore"
|
||||
$dataTrigger.Setters.Add((New-Object System.Windows.Setter([System.Windows.Controls.ComboBox]::IsEnabledProperty, $false)))
|
||||
|
||||
$comboBoxStyle.Triggers.Add($dataTrigger)
|
||||
$comboBoxFactory.SetValue([System.Windows.FrameworkElement]::StyleProperty, $comboBoxStyle)
|
||||
|
||||
$archCellTemplate.VisualTree = $comboBoxFactory
|
||||
$archColumn.CellTemplate = $archCellTemplate
|
||||
$wingetGridView.Columns.Add($archColumn)
|
||||
|
||||
@@ -146,13 +146,14 @@ function Import-WingetList {
|
||||
$defaultArch = $State.Controls.cmbWindowsArch.SelectedItem
|
||||
|
||||
foreach ($appInfo in $importedAppsData.apps) {
|
||||
$arch = if ($appInfo.source -eq 'msstore') { 'NA' } else { if ($appInfo.PSObject.Properties['architecture']) { $appInfo.architecture } else { $defaultArch } }
|
||||
$newAppListForItemsSource.Add([PSCustomObject]@{
|
||||
IsSelected = $true # Imported apps are marked as selected
|
||||
Name = $appInfo.name
|
||||
Id = $appInfo.id
|
||||
Version = "" # Will be populated when searching or if data exists
|
||||
Source = $appInfo.source
|
||||
Architecture = if ($appInfo.PSObject.Properties['architecture']) { $appInfo.architecture } else { $defaultArch }
|
||||
Architecture = $arch
|
||||
DownloadStatus = ""
|
||||
})
|
||||
}
|
||||
@@ -188,13 +189,14 @@ function Search-WingetPackagesPublic {
|
||||
WriteLog "Found $($results.Count) packages matching query '$Query'."
|
||||
WriteLog "Creating output objects for Winget search results, please wait..."
|
||||
$output = $results | ForEach-Object -Parallel {
|
||||
$arch = if ($_.Source -eq 'msstore') { 'NA' } else { $using:DefaultArchitecture }
|
||||
[PSCustomObject]@{
|
||||
IsSelected = [bool]$false
|
||||
Name = [string]$_.Name
|
||||
Id = [string]$_.Id
|
||||
Version = [string]$_.Version
|
||||
Source = [string]$_.Source
|
||||
Architecture = [string]$using:DefaultArchitecture
|
||||
Architecture = [string]$arch
|
||||
DownloadStatus = [string]::Empty
|
||||
}
|
||||
} -ThrottleLimit 20
|
||||
|
||||
Reference in New Issue
Block a user