diff --git a/scripts/main.ps1 b/scripts/main.ps1 index 5fb60838c7..2bdbbe466f 100644 --- a/scripts/main.ps1 +++ b/scripts/main.ps1 @@ -35,12 +35,10 @@ $maxthreads = [int]$env:NUMBER_OF_PROCESSORS # Create a new session state for parsing variables into our runspace $hashVars = New-object System.Management.Automation.Runspaces.SessionStateVariableEntry -ArgumentList 'sync',$sync,$Null -$offlineVar = New-object System.Management.Automation.Runspaces.SessionStateVariableEntry -ArgumentList 'PARAM_OFFLINE',$PARAM_OFFLINE,$Null $InitialSessionState = [System.Management.Automation.Runspaces.InitialSessionState]::CreateDefault() # Add the variable to the session state $InitialSessionState.Variables.Add($hashVars) -$InitialSessionState.Variables.Add($offlineVar) # Get every private function and add them to the session state $functions = Get-ChildItem function:\ | Where-Object { $_.Name -imatch 'winutil|WPF' } @@ -339,34 +337,16 @@ $sync["Form"].Add_ContentRendered({ } } - if ($PARAM_OFFLINE) { + if ($Offline) { # Show offline banner $sync.WPFOfflineBanner.Visibility = [System.Windows.Visibility]::Visible - # Disable the install tab $sync.WPFTab1BT.IsEnabled = $false - $sync.WPFTab1BT.Opacity = 0.5 $sync.WPFTab1BT.ToolTip = "Internet connection required for installing applications." - # Disable install-related buttons - $sync.WPFInstall.IsEnabled = $false - $sync.WPFUninstall.IsEnabled = $false - $sync.WPFInstallUpgrade.IsEnabled = $false - $sync.WPFGetInstalled.IsEnabled = $false - - # Show offline indicator Write-Host "Offline mode detected - Install tab disabled." -ForegroundColor Yellow - - # Optionally switch to a different tab if install tab was going to be default Invoke-WPFTab "WPFTab2BT" # Switch to Tweaks tab instead } - else { - # Online - ensure install tab is enabled - $sync.WPFTab1BT.IsEnabled = $true - $sync.WPFTab1BT.Opacity = 1.0 - $sync.WPFTab1BT.ToolTip = $null - Invoke-WPFTab "WPFTab1BT" # Default to install tab - } $sync["Form"].Focus() }) diff --git a/scripts/start.ps1 b/scripts/start.ps1 index e590a29a94..d76437f548 100644 --- a/scripts/start.ps1 +++ b/scripts/start.ps1 @@ -13,11 +13,6 @@ param ( [switch]$Offline ) -$PARAM_OFFLINE = $false -if ($Offline) { - $PARAM_OFFLINE = $true -} - if ($ExecutionContext.SessionState.LanguageMode -ne 'FullLanguage') { Write-Host "WinUtil is unable to run on your system. PowerShell execution is restricted by security policies." -ForegroundColor Red return