mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-11-14 14:45:52 -06:00
refractor PR
- remove "Segoe Fluent Icons" changes - add Invoke-WPFGetIso improvements from #2731 > read image once, then take info from the result of that.
This commit is contained in:
parent
affedd3cab
commit
125e78be96
@ -19,7 +19,7 @@
|
|||||||
"IconFontSize": "14",
|
"IconFontSize": "14",
|
||||||
"IconButtonSize": "35",
|
"IconButtonSize": "35",
|
||||||
"SettingsIconFontSize": "18",
|
"SettingsIconFontSize": "18",
|
||||||
"CloseIconFontSize": "12",
|
"CloseIconFontSize": "18",
|
||||||
"MicroWinLogoSize": "10",
|
"MicroWinLogoSize": "10",
|
||||||
"MicrowinCheckBoxMargin": "-10,5,0,0",
|
"MicrowinCheckBoxMargin": "-10,5,0,0",
|
||||||
"GroupBorderBackgroundColor": "#232629",
|
"GroupBorderBackgroundColor": "#232629",
|
||||||
|
@ -260,19 +260,33 @@ function Invoke-WPFGetIso {
|
|||||||
$wimFile = $wimFile.Replace(".wim", ".esd").Trim()
|
$wimFile = $wimFile.Replace(".wim", ".esd").Trim()
|
||||||
}
|
}
|
||||||
$sync.MicrowinWindowsFlavors.Items.Clear()
|
$sync.MicrowinWindowsFlavors.Items.Clear()
|
||||||
Get-WindowsImage -ImagePath $wimFile | ForEach-Object {
|
|
||||||
|
# Store the results of Get-WindowsImage in a variable
|
||||||
|
$images = Get-WindowsImage -ImagePath $wimFile
|
||||||
|
|
||||||
|
$proEditionIndex = -1
|
||||||
|
$proeditionfound = $false
|
||||||
|
|
||||||
|
# Populate the list of Windows flavors and find the Pro edition
|
||||||
|
$images | ForEach-Object {
|
||||||
$imageIdx = $_.ImageIndex
|
$imageIdx = $_.ImageIndex
|
||||||
$imageName = $_.ImageName
|
$imageName = $_.ImageName
|
||||||
$sync.MicrowinWindowsFlavors.Items.Add("$imageIdx : $imageName")
|
$sync.MicrowinWindowsFlavors.Items.Add("$imageIdx : $imageName")
|
||||||
}
|
|
||||||
$sync.MicrowinWindowsFlavors.SelectedIndex = 0
|
# Check if the image name contains 'Pro'
|
||||||
Write-Host "Finding suitable Pro edition. This can take some time. Do note that this is an automatic process that might not select the edition you want."
|
if ($imageName -like "*Pro*" -and !$proeditionfound) {
|
||||||
Get-WindowsImage -ImagePath $wimFile | ForEach-Object {
|
$proEditionIndex = $imageIdx
|
||||||
if ((Get-WindowsImage -ImagePath $wimFile -Index $_.ImageIndex).EditionId -eq "Professional") {
|
$proeditionfound = $true
|
||||||
# We have found the Pro edition
|
|
||||||
$sync.MicrowinWindowsFlavors.SelectedIndex = $_.ImageIndex - 1
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Set the selected index to the Pro edition if found, otherwise default to the first item
|
||||||
|
if ($proEditionIndex -ne -1) {
|
||||||
|
$sync.MicrowinWindowsFlavors.SelectedIndex = $proEditionIndex - 1
|
||||||
|
} else {
|
||||||
|
$sync.MicrowinWindowsFlavors.SelectedIndex = 0
|
||||||
|
}
|
||||||
|
|
||||||
Get-Volume $driveLetter | Get-DiskImage | Dismount-DiskImage
|
Get-Volume $driveLetter | Get-DiskImage | Dismount-DiskImage
|
||||||
Write-Host "Selected value '$($sync.MicrowinWindowsFlavors.SelectedValue)'....."
|
Write-Host "Selected value '$($sync.MicrowinWindowsFlavors.SelectedValue)'....."
|
||||||
|
|
||||||
|
@ -617,22 +617,9 @@
|
|||||||
<ControlTemplate TargetType="ContextMenu">
|
<ControlTemplate TargetType="ContextMenu">
|
||||||
<Border Background="{DynamicResource MainBackgroundColor}" BorderBrush="{DynamicResource BorderColor}" BorderThickness="1" CornerRadius="5" Padding="5">
|
<Border Background="{DynamicResource MainBackgroundColor}" BorderBrush="{DynamicResource BorderColor}" BorderThickness="1" CornerRadius="5" Padding="5">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<MenuItem Command="Cut" Header="Cut">
|
<MenuItem Command="Cut" Header="Cut"/>
|
||||||
<MenuItem.Icon>
|
<MenuItem Command="Copy" Header="Copy"/>
|
||||||
<TextBlock Text="" FontSize="14" FontFamily="Segoe Fluent Icons"/>
|
<MenuItem Command="Paste" Header="Paste"/>
|
||||||
</MenuItem.Icon>
|
|
||||||
</MenuItem>
|
|
||||||
<MenuItem Command="Copy" Header="Copy">
|
|
||||||
<MenuItem.Icon>
|
|
||||||
<TextBlock Text="" FontSize="14" FontFamily="Segoe Fluent Icons"/>
|
|
||||||
</MenuItem.Icon>
|
|
||||||
</MenuItem>
|
|
||||||
<MenuItem Command="Paste" Header="Paste">
|
|
||||||
<MenuItem.Icon>
|
|
||||||
<TextBlock Text="" FontSize="14" FontFamily="Segoe Fluent Icons"/>
|
|
||||||
</MenuItem.Icon>
|
|
||||||
</MenuItem>
|
|
||||||
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
@ -887,7 +874,7 @@
|
|||||||
Width="{DynamicResource IconButtonSize}" Height="{DynamicResource IconButtonSize}"
|
Width="{DynamicResource IconButtonSize}" Height="{DynamicResource IconButtonSize}"
|
||||||
HorizontalAlignment="Right" VerticalAlignment="Top"
|
HorizontalAlignment="Right" VerticalAlignment="Top"
|
||||||
Margin="5,5,5,0"
|
Margin="5,5,5,0"
|
||||||
FontFamily="Segoe Fluent Icons"
|
FontFamily="Segoe MDL2 Assets"
|
||||||
Content=""/>
|
Content=""/>
|
||||||
<Popup Grid.Column="3" Name="SettingsPopup"
|
<Popup Grid.Column="3" Name="SettingsPopup"
|
||||||
IsOpen="False"
|
IsOpen="False"
|
||||||
@ -914,13 +901,13 @@
|
|||||||
|
|
||||||
<Button
|
<Button
|
||||||
Grid.Column="4"
|
Grid.Column="4"
|
||||||
Content="" BorderThickness="0"
|
Content="×" BorderThickness="0"
|
||||||
BorderBrush="Transparent"
|
BorderBrush="Transparent"
|
||||||
Background="{DynamicResource MainBackgroundColor}"
|
Background="{DynamicResource MainBackgroundColor}"
|
||||||
Width="{DynamicResource IconButtonSize}" Height="{DynamicResource IconButtonSize}"
|
Width="{DynamicResource IconButtonSize}" Height="{DynamicResource IconButtonSize}"
|
||||||
HorizontalAlignment="Right" VerticalAlignment="Top"
|
HorizontalAlignment="Right" VerticalAlignment="Top"
|
||||||
Margin="0,5,5,0"
|
Margin="0,5,5,0"
|
||||||
FontFamily="Segoe Fluent Icons"
|
FontFamily="{DynamicResource FontFamily}"
|
||||||
Foreground="{DynamicResource MainForegroundColor}" FontSize="{DynamicResource CloseIconFontSize}" Name="WPFCloseButton" />
|
Foreground="{DynamicResource MainForegroundColor}" FontSize="{DynamicResource CloseIconFontSize}" Name="WPFCloseButton" />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user