mirror of
https://github.com/ChrisTitusTech/winutil
synced 2026-04-06 06:38:31 +00:00
Fix Scrollviewer in Status Log
This commit is contained in:
@@ -178,19 +178,16 @@ function Invoke-WinUtilISOModify {
|
|||||||
$runspace.SessionStateProxy.SetVariable("autounattendContent", $autounattendContent)
|
$runspace.SessionStateProxy.SetVariable("autounattendContent", $autounattendContent)
|
||||||
$runspace.SessionStateProxy.SetVariable("injectDrivers", $injectDrivers)
|
$runspace.SessionStateProxy.SetVariable("injectDrivers", $injectDrivers)
|
||||||
|
|
||||||
$isoScriptFuncDef = "function Invoke-WinUtilISOScript {`n" + ${function:Invoke-WinUtilISOScript}.ToString() + "`n}"
|
$isoScriptFuncDef = "function Invoke-WinUtilISOScript {`n" + ${function:Invoke-WinUtilISOScript}.ToString() + "`n}"
|
||||||
$win11ISOLogFuncDef = "function Write-Win11ISOLog {`n" + ${function:Write-Win11ISOLog}.ToString() + "`n}"
|
$win11ISOLogFuncDef = "function Write-Win11ISOLog {`n" + ${function:Write-Win11ISOLog}.ToString() + "`n}"
|
||||||
$refreshUSBFuncDef = "function Invoke-WinUtilISORefreshUSBDrives {`n" + ${function:Invoke-WinUtilISORefreshUSBDrives}.ToString() + "`n}"
|
|
||||||
$runspace.SessionStateProxy.SetVariable("isoScriptFuncDef", $isoScriptFuncDef)
|
$runspace.SessionStateProxy.SetVariable("isoScriptFuncDef", $isoScriptFuncDef)
|
||||||
$runspace.SessionStateProxy.SetVariable("win11ISOLogFuncDef", $win11ISOLogFuncDef)
|
$runspace.SessionStateProxy.SetVariable("win11ISOLogFuncDef", $win11ISOLogFuncDef)
|
||||||
$runspace.SessionStateProxy.SetVariable("refreshUSBFuncDef", $refreshUSBFuncDef)
|
|
||||||
|
|
||||||
$script = [Management.Automation.PowerShell]::Create()
|
$script = [Management.Automation.PowerShell]::Create()
|
||||||
$script.Runspace = $runspace
|
$script.Runspace = $runspace
|
||||||
$script.AddScript({
|
$script.AddScript({
|
||||||
. ([scriptblock]::Create($isoScriptFuncDef))
|
. ([scriptblock]::Create($isoScriptFuncDef))
|
||||||
. ([scriptblock]::Create($win11ISOLogFuncDef))
|
. ([scriptblock]::Create($win11ISOLogFuncDef))
|
||||||
. ([scriptblock]::Create($refreshUSBFuncDef))
|
|
||||||
|
|
||||||
function Log($msg) {
|
function Log($msg) {
|
||||||
$ts = (Get-Date).ToString("HH:mm:ss")
|
$ts = (Get-Date).ToString("HH:mm:ss")
|
||||||
@@ -215,19 +212,6 @@ function Invoke-WinUtilISOModify {
|
|||||||
$sync["WPFWin11ISOSelectSection"].Visibility = "Collapsed"
|
$sync["WPFWin11ISOSelectSection"].Visibility = "Collapsed"
|
||||||
$sync["WPFWin11ISOMountSection"].Visibility = "Collapsed"
|
$sync["WPFWin11ISOMountSection"].Visibility = "Collapsed"
|
||||||
$sync["WPFWin11ISOModifySection"].Visibility = "Collapsed"
|
$sync["WPFWin11ISOModifySection"].Visibility = "Collapsed"
|
||||||
$expandedHeight = [Math]::Max(400, $sync["Form"].ActualHeight - 100)
|
|
||||||
$sync["WPFWin11ISOStatusLog"].Height = $expandedHeight
|
|
||||||
$sync["Win11ISOLogExpanded"] = $true
|
|
||||||
if (-not $sync["Win11ISOResizeHandlerAdded"]) {
|
|
||||||
$sync["Form"].add_SizeChanged({
|
|
||||||
if ($sync["Win11ISOLogExpanded"]) {
|
|
||||||
$sync["WPFWin11ISOStatusLog"].Height = [Math]::Max(400, $sync["Form"].ActualHeight - 100)
|
|
||||||
$sync["WPFWin11ISOStatusLog"].CaretIndex = $sync["WPFWin11ISOStatusLog"].Text.Length
|
|
||||||
$sync["WPFWin11ISOStatusLog"].ScrollToEnd()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
$sync["Win11ISOResizeHandlerAdded"] = $true
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
Log "Creating working directory: $workDir"
|
Log "Creating working directory: $workDir"
|
||||||
@@ -283,7 +267,6 @@ function Invoke-WinUtilISOModify {
|
|||||||
|
|
||||||
$sync["WPFWin11ISOOutputSection"].Dispatcher.Invoke([action]{
|
$sync["WPFWin11ISOOutputSection"].Dispatcher.Invoke([action]{
|
||||||
$sync["WPFWin11ISOOutputSection"].Visibility = "Visible"
|
$sync["WPFWin11ISOOutputSection"].Visibility = "Visible"
|
||||||
$sync["WPFWin11ISOStatusLog"].Height = 300
|
|
||||||
})
|
})
|
||||||
} catch {
|
} catch {
|
||||||
Log "ERROR during modification: $_"
|
Log "ERROR during modification: $_"
|
||||||
@@ -330,8 +313,6 @@ function Invoke-WinUtilISOModify {
|
|||||||
$sync["WPFWin11ISOMountSection"].Visibility = "Visible"
|
$sync["WPFWin11ISOMountSection"].Visibility = "Visible"
|
||||||
$sync["WPFWin11ISOModifySection"].Visibility = "Visible"
|
$sync["WPFWin11ISOModifySection"].Visibility = "Visible"
|
||||||
}
|
}
|
||||||
$sync["Win11ISOLogExpanded"] = $false
|
|
||||||
$sync["WPFWin11ISOStatusLog"].Height = 140
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}) | Out-Null
|
}) | Out-Null
|
||||||
@@ -357,7 +338,6 @@ function Invoke-WinUtilISOCheckExistingWork {
|
|||||||
$sync["WPFWin11ISOMountSection"].Visibility = "Collapsed"
|
$sync["WPFWin11ISOMountSection"].Visibility = "Collapsed"
|
||||||
$sync["WPFWin11ISOModifySection"].Visibility = "Collapsed"
|
$sync["WPFWin11ISOModifySection"].Visibility = "Collapsed"
|
||||||
$sync["WPFWin11ISOOutputSection"].Visibility = "Visible"
|
$sync["WPFWin11ISOOutputSection"].Visibility = "Visible"
|
||||||
$sync["WPFWin11ISOStatusLog"].Height = 300
|
|
||||||
|
|
||||||
$modified = $existingWorkDir.LastWriteTime.ToString("yyyy-MM-dd HH:mm")
|
$modified = $existingWorkDir.LastWriteTime.ToString("yyyy-MM-dd HH:mm")
|
||||||
Write-Win11ISOLog "Existing working directory found: $($existingWorkDir.FullName)"
|
Write-Win11ISOLog "Existing working directory found: $($existingWorkDir.FullName)"
|
||||||
@@ -498,7 +478,6 @@ function Invoke-WinUtilISOCleanAndReset {
|
|||||||
$sync.progressBarTextBlock.ToolTip = ""
|
$sync.progressBarTextBlock.ToolTip = ""
|
||||||
$sync.ProgressBar.Value = 0
|
$sync.ProgressBar.Value = 0
|
||||||
|
|
||||||
$sync["WPFWin11ISOStatusLog"].Height = 140
|
|
||||||
$sync["WPFWin11ISOStatusLog"].Text = "Ready. Please select a Windows 11 ISO to begin."
|
$sync["WPFWin11ISOStatusLog"].Text = "Ready. Please select a Windows 11 ISO to begin."
|
||||||
})
|
})
|
||||||
} catch {
|
} catch {
|
||||||
@@ -596,23 +575,6 @@ function Invoke-WinUtilISOExport {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
# Expand the log to fill the screen while oscdimg runs
|
|
||||||
$sync["WPFWin11ISOStatusLog"].Dispatcher.Invoke([action]{
|
|
||||||
$expandedHeight = [Math]::Max(400, $sync["Form"].ActualHeight - 100)
|
|
||||||
$sync["WPFWin11ISOStatusLog"].Height = $expandedHeight
|
|
||||||
$sync["Win11ISOLogExpanded"] = $true
|
|
||||||
if (-not $sync["Win11ISOResizeHandlerAdded"]) {
|
|
||||||
$sync["Form"].add_SizeChanged({
|
|
||||||
if ($sync["Win11ISOLogExpanded"]) {
|
|
||||||
$sync["WPFWin11ISOStatusLog"].Height = [Math]::Max(400, $sync["Form"].ActualHeight - 100)
|
|
||||||
$sync["WPFWin11ISOStatusLog"].CaretIndex = $sync["WPFWin11ISOStatusLog"].Text.Length
|
|
||||||
$sync["WPFWin11ISOStatusLog"].ScrollToEnd()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
$sync["Win11ISOResizeHandlerAdded"] = $true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Write-Win11ISOLog "Exporting to ISO: $outputISO"
|
Write-Win11ISOLog "Exporting to ISO: $outputISO"
|
||||||
SetProgress "Building ISO..." 10
|
SetProgress "Building ISO..." 10
|
||||||
@@ -645,7 +607,7 @@ function Invoke-WinUtilISOExport {
|
|||||||
# Flush any stderr after process exits
|
# Flush any stderr after process exits
|
||||||
$stderr = $proc.StandardError.ReadToEnd()
|
$stderr = $proc.StandardError.ReadToEnd()
|
||||||
foreach ($line in ($stderr -split "`r?`n")) {
|
foreach ($line in ($stderr -split "`r?`n")) {
|
||||||
if ($line.Trim()) { Write-Win11ISOLog "[stderr] $line" }
|
if ($line.Trim()) { Write-Win11ISOLog "[stderr]$line" }
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($proc.ExitCode -eq 0) {
|
if ($proc.ExitCode -eq 0) {
|
||||||
@@ -673,8 +635,6 @@ function Invoke-WinUtilISOExport {
|
|||||||
$sync.progressBarTextBlock.Text = ""
|
$sync.progressBarTextBlock.Text = ""
|
||||||
$sync.progressBarTextBlock.ToolTip = ""
|
$sync.progressBarTextBlock.ToolTip = ""
|
||||||
$sync.ProgressBar.Value = 0
|
$sync.ProgressBar.Value = 0
|
||||||
$sync["Win11ISOLogExpanded"] = $false
|
|
||||||
$sync["WPFWin11ISOStatusLog"].Height = 300
|
|
||||||
$sync["WPFWin11ISOChooseISOButton"].IsEnabled = $true
|
$sync["WPFWin11ISOChooseISOButton"].IsEnabled = $true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1361,20 +1361,17 @@
|
|||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem Header="Win11ISO" Visibility="Collapsed" Name="WPFTab5">
|
<TabItem Header="Win11ISO" Visibility="Collapsed" Name="WPFTab5">
|
||||||
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" Margin="{DynamicResource TabContentMargin}">
|
<Grid Name="Win11ISOPanel" Margin="{DynamicResource TabContentMargin}" Background="Transparent">
|
||||||
<Grid Background="Transparent" Name="Win11ISOPanel">
|
<Grid.RowDefinitions>
|
||||||
<Grid.RowDefinitions>
|
<RowDefinition Height="Auto"/> <!-- Steps 1-4 -->
|
||||||
<RowDefinition Height="Auto"/> <!-- Step 1: Select ISO -->
|
<RowDefinition Height="*"/> <!-- Log / Status -->
|
||||||
<RowDefinition Height="Auto"/> <!-- Step 2: Mount & Verify -->
|
</Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto"/> <!-- Step 3: Modify install.wim -->
|
|
||||||
<RowDefinition Height="Auto"/> <!-- Step 4: Output Options -->
|
|
||||||
<RowDefinition Height="Auto"/> <!-- Log / Status -->
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
|
|
||||||
<!-- ═══════════════════════════════════════════════════════════ -->
|
<!-- Steps 1-4 -->
|
||||||
<!-- STEP 1 : Select Windows 11 ISO -->
|
<StackPanel Grid.Row="0">
|
||||||
<!-- ═══════════════════════════════════════════════════════════ -->
|
|
||||||
<Grid Grid.Row="0" Name="WPFWin11ISOSelectSection" Margin="5" HorizontalAlignment="Left" MinWidth="{DynamicResource ButtonWidth}">
|
<!-- ─── STEP 1 : Select Windows 11 ISO ─────────────── -->
|
||||||
|
<Grid Name="WPFWin11ISOSelectSection" Margin="5" HorizontalAlignment="Left" MinWidth="{DynamicResource ButtonWidth}">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="*"/>
|
||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="*"/>
|
||||||
@@ -1460,16 +1457,13 @@
|
|||||||
Height="{DynamicResource ButtonHeight}"/>
|
Height="{DynamicResource ButtonHeight}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<!-- ═══════════════════════════════════════════════════════════ -->
|
<!-- ─── STEP 2 : Mount & Verify ISO ──────────────────── -->
|
||||||
<!-- STEP 2 : Mount & Verify ISO -->
|
<Grid Name="WPFWin11ISOMountSection"
|
||||||
<!-- ═══════════════════════════════════════════════════════════ -->
|
Margin="5"
|
||||||
<Grid Grid.Row="1"
|
Visibility="Collapsed"
|
||||||
Name="WPFWin11ISOMountSection"
|
HorizontalAlignment="Left" MinWidth="{DynamicResource ButtonWidth}">
|
||||||
Margin="5"
|
|
||||||
Visibility="Collapsed"
|
|
||||||
HorizontalAlignment="Left" MinWidth="{DynamicResource ButtonWidth}">
|
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="Auto"/>
|
<ColumnDefinition Width="Auto"/>
|
||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="*"/>
|
||||||
@@ -1530,16 +1524,13 @@
|
|||||||
Margin="0,0,0,0"/>
|
Margin="0,0,0,0"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<!-- ═══════════════════════════════════════════════════════════ -->
|
<!-- ─── STEP 3 : Modify install.wim ───────────────────── -->
|
||||||
<!-- STEP 3 : Modify install.wim -->
|
<StackPanel Name="WPFWin11ISOModifySection"
|
||||||
<!-- ═══════════════════════════════════════════════════════════ -->
|
Margin="5"
|
||||||
<StackPanel Grid.Row="2"
|
Visibility="Collapsed"
|
||||||
Name="WPFWin11ISOModifySection"
|
HorizontalAlignment="Left" MinWidth="{DynamicResource ButtonWidth}">
|
||||||
Margin="5"
|
|
||||||
Visibility="Collapsed"
|
|
||||||
HorizontalAlignment="Left" MinWidth="{DynamicResource ButtonWidth}">
|
|
||||||
<TextBlock FontSize="{DynamicResource FontSize}" FontWeight="Bold"
|
<TextBlock FontSize="{DynamicResource FontSize}" FontWeight="Bold"
|
||||||
Foreground="{DynamicResource MainForegroundColor}" Margin="0,0,0,8">
|
Foreground="{DynamicResource MainForegroundColor}" Margin="0,0,0,8">
|
||||||
Step 3 - Modify install.wim
|
Step 3 - Modify install.wim
|
||||||
@@ -1557,16 +1548,13 @@
|
|||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
Width="Auto" Padding="12,0"
|
Width="Auto" Padding="12,0"
|
||||||
Height="{DynamicResource ButtonHeight}"/>
|
Height="{DynamicResource ButtonHeight}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<!-- ═══════════════════════════════════════════════════════════ -->
|
<!-- ─── STEP 4 : Output Options ───────────────────────── -->
|
||||||
<!-- STEP 4 : Output Options -->
|
<StackPanel Name="WPFWin11ISOOutputSection"
|
||||||
<!-- ═══════════════════════════════════════════════════════════ -->
|
Margin="5"
|
||||||
<StackPanel Grid.Row="3"
|
Visibility="Collapsed"
|
||||||
Name="WPFWin11ISOOutputSection"
|
HorizontalAlignment="Left" MinWidth="{DynamicResource ButtonWidth}">
|
||||||
Margin="5"
|
|
||||||
Visibility="Collapsed"
|
|
||||||
HorizontalAlignment="Left" MinWidth="{DynamicResource ButtonWidth}">
|
|
||||||
<!-- Header row: title + Clean & Reset button -->
|
<!-- Header row: title + Clean & Reset button -->
|
||||||
<Grid Margin="0,0,0,12">
|
<Grid Margin="0,0,0,12">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
@@ -1650,31 +1638,37 @@
|
|||||||
Margin="0,0,0,10"/>
|
Margin="0,0,0,10"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
</StackPanel>
|
|
||||||
|
|
||||||
<!-- ═══════════════════════════════════════════════════════════ -->
|
|
||||||
<!-- Status / Log Output -->
|
|
||||||
<!-- ═══════════════════════════════════════════════════════════ -->
|
|
||||||
<StackPanel Grid.Row="4" Margin="5">
|
|
||||||
<TextBlock FontSize="{DynamicResource FontSize}" FontWeight="Bold"
|
|
||||||
Foreground="{DynamicResource MainForegroundColor}" Margin="0,0,0,6">
|
|
||||||
Status Log
|
|
||||||
</TextBlock>
|
|
||||||
<TextBox Name="WPFWin11ISOStatusLog"
|
|
||||||
IsReadOnly="True"
|
|
||||||
TextWrapping="Wrap"
|
|
||||||
VerticalScrollBarVisibility="Auto"
|
|
||||||
Height="140" Padding="6"
|
|
||||||
Background="{DynamicResource MainBackgroundColor}"
|
|
||||||
Foreground="{DynamicResource MainForegroundColor}"
|
|
||||||
BorderBrush="{DynamicResource BorderColor}"
|
|
||||||
BorderThickness="1"
|
|
||||||
Text="Ready. Please select a Windows 11 ISO to begin."/>
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- Status Log (fills remaining height) -->
|
||||||
|
<Grid Grid.Row="1" Margin="5">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBlock Grid.Row="0"
|
||||||
|
FontSize="{DynamicResource FontSize}" FontWeight="Bold"
|
||||||
|
Foreground="{DynamicResource MainForegroundColor}"
|
||||||
|
Margin="0,0,0,4">
|
||||||
|
Status Log
|
||||||
|
</TextBlock>
|
||||||
|
<TextBox Grid.Row="1"
|
||||||
|
Name="WPFWin11ISOStatusLog"
|
||||||
|
IsReadOnly="True"
|
||||||
|
TextWrapping="Wrap"
|
||||||
|
VerticalScrollBarVisibility="Visible"
|
||||||
|
VerticalAlignment="Stretch"
|
||||||
|
Padding="6"
|
||||||
|
Background="{DynamicResource MainBackgroundColor}"
|
||||||
|
Foreground="{DynamicResource MainForegroundColor}"
|
||||||
|
BorderBrush="{DynamicResource BorderColor}"
|
||||||
|
BorderThickness="1"
|
||||||
|
Text="Ready. Please select a Windows 11 ISO to begin."/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</ScrollViewer>
|
|
||||||
|
</Grid>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
</TabControl>
|
</TabControl>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
Reference in New Issue
Block a user