diff --git a/docs/content/dev/tweaks/z--Advanced-Tweaks---CAUTION/OOSUbutton.md b/docs/content/dev/tweaks/z--Advanced-Tweaks---CAUTION/OOSUbutton.md index af396e8c..3230c222 100644 --- a/docs/content/dev/tweaks/z--Advanced-Tweaks---CAUTION/OOSUbutton.md +++ b/docs/content/dev/tweaks/z--Advanced-Tweaks---CAUTION/OOSUbutton.md @@ -5,15 +5,53 @@ description: "" ```powershell {filename="functions/public/Invoke-WPFOOSU.ps1",linenos=inline,linenostart=1} function Invoke-WPFOOSU { - try { - $ProgressPreference = 'SilentlyContinue' + if ($sync.ProcessRunning) { + Show-WinUtilMessage -Message "Another process is currently running." -Title "WinUtil" -Button "OK" -Icon "Warning" + return + } - Invoke-WebRequest -Uri https://dl5.oo-software.com/files/ooshutup10/OOSU10.exe -OutFile "$winutildir\ooshutup10.exe" - Start-Process -FilePath "$winutildir\ooshutup10.exe" + $downloadPath = Join-Path $sync.winutildir "ooshutup10.exe" + $sync.ProcessRunning = $true - $ProgressPreference = 'Continue' - } catch { - Write-Error "Couldn't download O&O ShutUp10. Please make sure you have an active Internet connection." + Invoke-WPFRunspace -ParameterList @(,("downloadPath", $downloadPath)) -ScriptBlock { + param($downloadPath) + + $hasUI = $null -ne $sync.Form -and $null -ne $sync.Form.Dispatcher + + try { + Write-WinUtilLog -Component "OOSU" -Message "Downloading O&O ShutUp10++." + if ($hasUI) { + Set-WinUtilTweaksProgressIndicator -Visible $true -Label "Downloading O&O ShutUp10++ (0%)" -Percent 0 + } + + Save-WinUtilFile -Uri "https://dl5.oo-software.com/files/ooshutup10/OOSU10.exe" -DestinationPath $downloadPath -ProgressCallback { + param($percent) + + if ($hasUI) { + Set-WinUtilTweaksProgressIndicator -Visible $true -Label "Downloading O&O ShutUp10++ ($percent%)" -Percent $percent + } + } + + if ($hasUI) { + Set-WinUtilTweaksProgressIndicator -Visible $true -Label "Launching O&O ShutUp10++" -Percent 100 + } + Start-Process -FilePath $downloadPath + + Write-WinUtilLog -Component "OOSU" -Message "O&O ShutUp10++ launched." + if ($hasUI) { + Set-WinUtilTweaksProgressIndicator -Visible $true -Label "O&O ShutUp10++ launched" -Percent 100 + } + } + catch { + Write-WinUtilLog -Level "ERROR" -Component "OOSU" -Message "O&O ShutUp10++ download failed: $($_.Exception.Message)" + if ($hasUI) { + Set-WinUtilTweaksProgressIndicator -Visible $true -Label "O&O ShutUp10++ download failed" -Percent 100 + } + Write-Error "Couldn't download O&O ShutUp10. Please make sure you have an active Internet connection." + } + finally { + $sync.ProcessRunning = $false + } } } ``` diff --git a/docs/content/dev/tweaks/z--Advanced-Tweaks---CAUTION/xboxremoval.md b/docs/content/dev/tweaks/z--Advanced-Tweaks---CAUTION/xboxremoval.md deleted file mode 100644 index 05330b4e..00000000 --- a/docs/content/dev/tweaks/z--Advanced-Tweaks---CAUTION/xboxremoval.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: "Xbox and Gaming Components - Removal" -description: "Xbox package management has moved to AppX Removal." ---- - -The former Xbox Removal tweak has been replaced by the AppX Removal tool. - -Open **Tweaks**, select **AppX Removal**, and choose the Xbox or gaming packages you want to remove or reinstall. See the [AppX Packages guide](/userguide/tweaks/#appx-packages) for details.