[Microwin] Fix & Cleanup UI (#3426)

* hide MicrowinISOPanel on proceeding steps

* fix textbox styling + remove Password text

* MicroWinPanelToggling
This commit is contained in:
MyDrift
2025-06-26 19:21:49 +02:00
committed by GitHub
parent 28958938fc
commit e74258acf4
5 changed files with 74 additions and 4 deletions

View File

@ -472,7 +472,7 @@ public class PowerManagement {
}
}
$sync.MicrowinOptionsPanel.Visibility = 'Collapsed'
Toggle-MicrowinPanel 1
#$sync.MicrowinFinalIsoLocation.Text = "$env:temp\microwin.iso"
$sync.MicrowinFinalIsoLocation.Text = "$($SaveDialog.FileName)"

View File

@ -276,7 +276,8 @@ function Invoke-MicrowinGetIso {
Get-Volume $driveLetter | Get-DiskImage | Dismount-DiskImage
Write-Host "Selected value '$($sync.MicrowinWindowsFlavors.SelectedValue)'....."
$sync.MicrowinOptionsPanel.Visibility = 'Visible'
Toggle-MicrowinPanel 2
} catch {
Write-Host "Dismounting bad image..."
Get-Volume $driveLetter | Get-DiskImage | Dismount-DiskImage

View File

@ -0,0 +1,28 @@
function Toggle-MicrowinPanel {
<#
.SYNOPSIS
Toggles the visibility of the Microwin options and ISO panels in the GUI.
.DESCRIPTION
This function toggles the visibility of the Microwin options and ISO panels in the GUI.
.PARAMETER MicrowinOptionsPanel
The panel containing Microwin options.
.PARAMETER MicrowinISOPanel
The panel containing the Microwin ISO options.
.EXAMPLE
Toggle-MicrowinPanel 1
#>
param (
[Parameter(Mandatory = $true, Position = 0)]
[ValidateSet(1, 2)]
[int]$PanelNumber
)
if ($PanelNumber -eq 1) {
$sync.MicrowinISOPanel.Visibility = 'Visible'
$sync.MicrowinOptionsPanel.Visibility = 'Collapsed'
} elseif ($PanelNumber -eq 2) {
$sync.MicrowinOptionsPanel.Visibility = 'Visible'
$sync.MicrowinISOPanel.Visibility = 'Collapsed'
}
}

View File

@ -62,5 +62,6 @@ function Invoke-WPFButton {
"WPFWinUtilUninstallPSProfile" {Invoke-WinUtilUninstallPSProfile}
"WPFWinUtilSSHServer" {Invoke-WPFSSHServer}
"WPFselectedAppsButton" {$sync.selectedAppsPopup.IsOpen = -not $sync.selectedAppsPopup.IsOpen}
"WPFMicrowinPanelBack" {Toggle-MicrowinPanel 1}
}
}

View File

@ -801,6 +801,7 @@
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="CaretBrush" Value="{DynamicResource MainForegroundColor}"/>
<Setter Property="ContextMenu">
<Setter.Value>
<ContextMenu>
@ -855,6 +856,7 @@
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="CaretBrush" Value="{DynamicResource MainForegroundColor}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="PasswordBox">
@ -1259,7 +1261,7 @@
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch">
<StackPanel Name="MicrowinMain" Background="{DynamicResource MainBackgroundColor}" SnapsToDevicePixels="True" Grid.Column="0" Grid.Row="0">
<StackPanel Background="Transparent" SnapsToDevicePixels="True" Margin="1">
<StackPanel Name="MicrowinISOPanel" Background="Transparent" SnapsToDevicePixels="True" Margin="1">
<CheckBox x:Name="WPFMicrowinDownloadFromGitHub" Content="Download oscdimg.exe from CTT Github repo" IsChecked="True" Margin="{DynamicResource MicrowinCheckBoxMargin}" />
<TextBlock Margin="5" Padding="1" TextWrapping="Wrap" Foreground="{DynamicResource ComboBoxForegroundColor}">
Choose a Windows ISO file that you've downloaded <LineBreak/>
@ -1314,8 +1316,46 @@
</Button.Content>
</Button>
</StackPanel>
<!-- Visibility="Hidden" -->
<StackPanel Name="MicrowinOptionsPanel" HorizontalAlignment="Left" SnapsToDevicePixels="True" Margin="1" Visibility="Hidden">
<Grid Margin="0,0,0,10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Button Name="WPFMicrowinPanelBack"
Grid.Column="0"
Width="30" Height="30"
HorizontalAlignment="Left"
FontFamily="Segoe MDL2 Assets"
FontSize="12"
Content="&#xE76B;"
ToolTip="Back to main view"
Background="{DynamicResource ButtonBackgroundColor}"
Foreground="{DynamicResource ButtonForegroundColor}"
BorderBrush="{DynamicResource ButtonBackgroundColor}"
BorderThickness="1"
Padding="0">
<Button.ContentTemplate>
<DataTemplate>
<TextBlock Text="{Binding}"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</DataTemplate>
</Button.ContentTemplate>
</Button>
<TextBlock Name="MicrowinPanel2Title"
Grid.Column="1"
Text="Configure Windows ISO"
Margin="10,0,0,0"
Foreground="{DynamicResource MainForegroundColor}"
FontSize="16"
VerticalAlignment="Center"/>
</Grid>
<TextBlock Margin="6" Padding="1" TextWrapping="Wrap">Choose Windows SKU</TextBlock>
<ComboBox x:Name = "MicrowinWindowsFlavors" Margin="1" />
<Rectangle Fill="{DynamicResource MainForegroundColor}" Height="2" HorizontalAlignment="Stretch" Margin="0,10,0,10"/>
@ -1343,7 +1383,7 @@
Foreground="{DynamicResource LabelboxForegroundColor}"
MaxLength="20"
/>
<TextBlock Margin="6" Padding="1" TextWrapping="Wrap">Password (characters will not be shown for your security):</TextBlock>
<TextBlock Margin="6" Padding="1" TextWrapping="Wrap">Password:</TextBlock>
<PasswordBox Name="MicrowinUserPassword" Background="Transparent" BorderThickness="1" BorderBrush="{DynamicResource MainForegroundColor}"
Margin="6"
PasswordChar="*"