@@ -37,6 +37,8 @@ $Script:DESKTOP_WAU_APPINSTALLER = "${env:Public}\Desktop\WAU App Installer.lnk"
3737$Script :STARTMENU_WAU_DIR = " ${env: PROGRAMDATA} \Microsoft\Windows\Start Menu\Programs\Winget-AutoUpdate"
3838$Script :COLOR_ENABLED = " #228B22" # Forest green
3939$Script :COLOR_DISABLED = " #FF6666" # Light red
40+ $Script :COLOR_INACTIVE = " Gray" # Grey
41+ $Script :STATUS_READY_TEXT = " Ready"
4042
4143# Get current script directory
4244$Script :WorkingDir = $PSScriptRoot
@@ -617,7 +619,7 @@ function Show-WAUSettingsGUI {
617619 <TextBlock Text="Schedule:" VerticalAlignment="Center" Margin="0,0,10,0"/>
618620 <TextBlock x:Name="StatusText" Text="Enabled" Foreground="Green" FontWeight="Bold" VerticalAlignment="Center"/>
619621 </StackPanel>
620- <TextBlock x:Name="StatusDescription" Text="WAU will check for updates according to the schedule below" FontSize="10" Foreground="Gray " Margin="0,5,0,0"/>
622+ <TextBlock x:Name="StatusDescription" Text="WAU will check for updates according to the schedule below" FontSize="10" Foreground="$ Script :COLOR_INACTIVE " Margin="0,5,0,0"/>
621623 </StackPanel>
622624 </GroupBox>
623625
@@ -639,7 +641,7 @@ function Show-WAUSettingsGUI {
639641 <ComboBoxItem Content="Never (Disable)" Tag="Never"/>
640642 </ComboBox>
641643 <TextBlock Text="How often WAU checks for updates"
642- FontSize="10" Foreground="Gray " Margin="0,5,0,0"
644+ FontSize="10" Foreground="$ Script :COLOR_INACTIVE " Margin="0,5,0,0"
643645 TextWrapping="Wrap"/>
644646 </StackPanel>
645647 <!-- Notification Level Column -->
@@ -650,7 +652,7 @@ function Show-WAUSettingsGUI {
650652 <ComboBoxItem Content="None" Tag="None"/>
651653 </ComboBox>
652654 <TextBlock Text="Level of notifications"
653- FontSize="10" Foreground="Gray " Margin="0,5,0,0"
655+ FontSize="10" Foreground="$ Script :COLOR_INACTIVE " Margin="0,5,0,0"
654656 TextWrapping="Wrap"/>
655657 </StackPanel>
656658 </Grid>
@@ -667,17 +669,17 @@ function Show-WAUSettingsGUI {
667669 <StackPanel Grid.Column="0" Margin="0,0,5,0">
668670 <StackPanel Orientation="Horizontal">
669671 <TextBox x:Name="UpdateTimeTextBox" Width="80" Height="25" Text="06:00:00" VerticalContentAlignment="Center"/>
670- <TextBlock Text="(HH:mm:ss format)" VerticalAlignment="Center" Margin="10,0,0,0" FontSize="10" Foreground="Gray "/>
672+ <TextBlock Text="(HH:mm:ss format)" VerticalAlignment="Center" Margin="10,0,0,0" FontSize="10" Foreground="$ Script :COLOR_INACTIVE "/>
671673 </StackPanel>
672- <TextBlock Text="Time of day when updates are checked" FontSize="10" Foreground="Gray " Margin="0,5,0,0"/>
674+ <TextBlock Text="Time of day when updates are checked" FontSize="10" Foreground="$ Script :COLOR_INACTIVE " Margin="0,5,0,0"/>
673675 </StackPanel>
674676 <!-- Random Delay Column -->
675677 <StackPanel Grid.Column="1" Margin="5,0,0,0">
676678 <StackPanel Orientation="Horizontal">
677679 <TextBox x:Name="RandomDelayTextBox" Width="60" Height="25" Text="00:00" VerticalContentAlignment="Center"/>
678- <TextBlock Text="(HH:mm format)" VerticalAlignment="Center" Margin="10,0,0,0" FontSize="10" Foreground="Gray "/>
680+ <TextBlock Text="(HH:mm format)" VerticalAlignment="Center" Margin="10,0,0,0" FontSize="10" Foreground="$ Script :COLOR_INACTIVE "/>
679681 </StackPanel>
680- <TextBlock Text="Maximum random delay after scheduled time" FontSize="10" Foreground="Gray " Margin="0,5,0,0"/>
682+ <TextBlock Text="Maximum random delay after scheduled time" FontSize="10" Foreground="$ Script :COLOR_INACTIVE " Margin="0,5,0,0"/>
681683 </StackPanel>
682684 </Grid>
683685 </GroupBox>
@@ -772,9 +774,9 @@ function Show-WAUSettingsGUI {
772774 </TextBlock>
773775 </ComboBox.ToolTip>
774776 </ComboBox>
775- <TextBlock Text="(0-99, default 3)" VerticalAlignment="Center" Margin="10,0,0,0" FontSize="10" Foreground="Gray "/>
777+ <TextBlock Text="(0-99, default 3)" VerticalAlignment="Center" Margin="10,0,0,0" FontSize="10" Foreground="$ Script :COLOR_INACTIVE "/>
776778 </StackPanel>
777- <TextBlock Text="Number of allowed log files" FontSize="10" Foreground="Gray " Margin="0,5,0,0"/>
779+ <TextBlock Text="Number of allowed log files" FontSize="10" Foreground="$ Script :COLOR_INACTIVE " Margin="0,5,0,0"/>
778780 </StackPanel>
779781 <!-- MaxLogSize column -->
780782 <StackPanel Grid.Column="1" Margin="5,0,0,0">
@@ -796,9 +798,9 @@ function Show-WAUSettingsGUI {
796798 <ComboBoxItem Content="9 MB" Tag="9437184"/>
797799 <ComboBoxItem Content="10 MB" Tag="10485760"/>
798800 </ComboBox>
799- <TextBlock Text="(1-10 MB, default 1 MB)" VerticalAlignment="Center" Margin="10,0,0,0" FontSize="10" Foreground="Gray "/>
801+ <TextBlock Text="(1-10 MB, default 1 MB)" VerticalAlignment="Center" Margin="10,0,0,0" FontSize="10" Foreground="$ Script :COLOR_INACTIVE "/>
800802 </StackPanel>
801- <TextBlock Text="Size of the log file before rotating" FontSize="10" Foreground="Gray " Margin="0,5,0,0"/>
803+ <TextBlock Text="Size of the log file before rotating" FontSize="10" Foreground="$ Script :COLOR_INACTIVE " Margin="0,5,0,0"/>
802804 </StackPanel>
803805 </Grid>
804806 </GroupBox>
@@ -813,7 +815,7 @@ function Show-WAUSettingsGUI {
813815 </GroupBox>
814816
815817 <!-- Status Bar -->
816- <TextBlock Grid.Row="8" x:Name="StatusBarText" Text="Ready " FontSize="10" Foreground="Gray " VerticalAlignment="Bottom"/>
818+ <TextBlock Grid.Row="8" x:Name="StatusBarText" Text="$ Script :STATUS_READY_TEXT " FontSize="10" Foreground="$ Script :COLOR_INACTIVE " VerticalAlignment="Bottom"/>
817819
818820 <!-- Buttons -->
819821 <StackPanel Grid.Row="9" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,10,0,0">
@@ -881,8 +883,8 @@ function Show-WAUSettingsGUI {
881883 }
882884 catch {
883885 [System.Windows.MessageBox ]::Show(" Invalid time format. Please use HH:mm:ss format (e.g., 06:00:00)" , " Error" , " OK" , " Error" )
884- $controls.StatusBarText.Text = " Ready "
885- $controls.StatusBarText.Foreground = " Gray "
886+ $controls.StatusBarText.Text = " $ Script :STATUS_READY_TEXT "
887+ $controls.StatusBarText.Foreground = " $ Script :COLOR_INACTIVE "
886888 return
887889 }
888890
@@ -892,8 +894,8 @@ function Show-WAUSettingsGUI {
892894 }
893895 catch {
894896 [System.Windows.MessageBox ]::Show(" Invalid time format. Please use HH:mm format (e.g., 00:00)" , " Error" , " OK" , " Error" )
895- $controls.StatusBarText.Text = " Ready "
896- $controls.StatusBarText.Foreground = " Gray "
897+ $controls.StatusBarText.Text = " $ Script :STATUS_READY_TEXT "
898+ $controls.StatusBarText.Foreground = " $ Script :COLOR_INACTIVE "
897899 return
898900 }
899901
@@ -932,18 +934,18 @@ function Show-WAUSettingsGUI {
932934 # Updating settings in-place
933935 Update-WAUGUIFromConfig - Controls $controls
934936
935- # Create timer to reset status back to "Ready " after 1 second
937+ # Create timer to reset status back to "$Script:STATUS_READY_TEXT " after 1 second
936938 # Use Invoke-Async to avoid blocking
937939 $window.Dispatcher.BeginInvoke ([System.Windows.Threading.DispatcherPriority ]::Background, [Action ]{
938940 Start-Sleep - Milliseconds 1000
939- $controls.StatusBarText.Text = " Ready "
940- $controls.StatusBarText.Foreground = " Gray "
941+ $controls.StatusBarText.Text = " $ Script :STATUS_READY_TEXT "
942+ $controls.StatusBarText.Foreground = " $ Script :COLOR_INACTIVE "
941943 })
942944
943945 } else {
944946 [System.Windows.MessageBox ]::Show(" Failed to save settings." , " Error" , " OK" , " Error" )
945- $controls.StatusBarText.Text = " Ready "
946- $controls.StatusBarText.Foreground = " Gray "
947+ $controls.StatusBarText.Text = " $ Script :STATUS_READY_TEXT "
948+ $controls.StatusBarText.Foreground = " $ Script :COLOR_INACTIVE "
947949 }
948950 })
949951
@@ -956,8 +958,8 @@ function Show-WAUSettingsGUI {
956958 $timer = New-Object System.Windows.Threading.DispatcherTimer
957959 $timer.Interval = [TimeSpan ]::FromSeconds(1 )
958960 $timer.Add_Tick ({
959- $controls.StatusBarText.Text = " Ready "
960- $controls.StatusBarText.Foreground = " Gray "
961+ $controls.StatusBarText.Text = " $ Script :STATUS_READY_TEXT "
962+ $controls.StatusBarText.Foreground = " $ Script :COLOR_INACTIVE "
961963 $timer.Stop ()
962964 $window.Close ()
963965 })
@@ -966,6 +968,17 @@ function Show-WAUSettingsGUI {
966968
967969 $controls.RunNowButton.Add_Click ({
968970 Start-WAUManually
971+ # Update status to "Done"
972+ $controls.StatusBarText.Text = " Done"
973+ $controls.StatusBarText.Foreground = $Script :COLOR_ENABLED
974+
975+ # Create timer to reset status back to "$Script:STATUS_READY_TEXT" after 1 second
976+ # Use Invoke-Async to avoid blocking
977+ $window.Dispatcher.BeginInvoke ([System.Windows.Threading.DispatcherPriority ]::Background, [Action ]{
978+ Start-Sleep - Milliseconds 1000
979+ $controls.StatusBarText.Text = " $Script :STATUS_READY_TEXT "
980+ $controls.StatusBarText.Foreground = " $Script :COLOR_INACTIVE "
981+ })
969982 })
970983
971984 # Handle Enter key to save settings
@@ -986,8 +999,8 @@ function Show-WAUSettingsGUI {
986999 $timer = New-Object System.Windows.Threading.DispatcherTimer
9871000 $timer.Interval = [TimeSpan ]::FromSeconds(1 )
9881001 $timer.Add_Tick ({
989- $controls.StatusBarText.Text = " Ready "
990- $controls.StatusBarText.Foreground = " Gray "
1002+ $controls.StatusBarText.Text = " $ Script :STATUS_READY_TEXT "
1003+ $controls.StatusBarText.Foreground = " $ Script :COLOR_INACTIVE "
9911004 $timer.Stop ()
9921005 $window.Close ()
9931006 })
@@ -1000,6 +1013,17 @@ function Show-WAUSettingsGUI {
10001013 $logPath = Join-Path $currentConfig.InstallLocation " logs"
10011014 if (Test-Path $logPath ) {
10021015 Start-Process " explorer.exe" - ArgumentList $logPath
1016+ # Update status to "Done"
1017+ $controls.StatusBarText.Text = " Done"
1018+ $controls.StatusBarText.Foreground = $Script :COLOR_ENABLED
1019+
1020+ # Create timer to reset status back to "$Script:STATUS_READY_TEXT" after 1 second
1021+ # Use Invoke-Async to avoid blocking
1022+ $window.Dispatcher.BeginInvoke ([System.Windows.Threading.DispatcherPriority ]::Background, [Action ]{
1023+ Start-Sleep - Milliseconds 1000
1024+ $controls.StatusBarText.Text = " $Script :STATUS_READY_TEXT "
1025+ $controls.StatusBarText.Foreground = " $Script :COLOR_INACTIVE "
1026+ })
10031027 } else {
10041028 [System.Windows.MessageBox ]::Show(" Log directory not found: $logPath " , " Error" , " OK" , " Error" )
10051029 }
0 commit comments