Added warning before removing Microsoft Store

This commit is contained in:
Raphire
2024-09-17 15:06:18 +02:00
parent 6b7c4dba7b
commit 4ad3d84286

View File

@@ -75,6 +75,14 @@ function ShowAppSelectionForm {
# saveButton eventHandler # saveButton eventHandler
$handler_saveButton_Click= $handler_saveButton_Click=
{ {
if ($selectionBox.CheckedItems -contains "Microsoft.WindowsStore" -and -not $Silent) {
$warningSelection = [System.Windows.Forms.Messagebox]::Show('Are you sure you wish to uninstall the Microsoft Store? This app cannot easily be reinstalled.', 'Are you sure?', 'YesNo', 'Warning')
if ($warningSelection -eq 'No') {
return
}
}
$global:SelectedApps = $selectionBox.CheckedItems $global:SelectedApps = $selectionBox.CheckedItems
# Create file that stores selected apps if it doesn't exist # Create file that stores selected apps if it doesn't exist
@@ -84,6 +92,7 @@ function ShowAppSelectionForm {
Set-Content -Path "$PSScriptRoot/CustomAppsList" -Value $global:SelectedApps Set-Content -Path "$PSScriptRoot/CustomAppsList" -Value $global:SelectedApps
$form.DialogResult = [System.Windows.Forms.DialogResult]::OK
$form.Close() $form.Close()
} }
@@ -219,7 +228,6 @@ function ShowAppSelectionForm {
$button1.TabIndex = 4 $button1.TabIndex = 4
$button1.Name = "saveButton" $button1.Name = "saveButton"
$button1.DialogResult = [System.Windows.Forms.DialogResult]::OK
$button1.UseVisualStyleBackColor = $True $button1.UseVisualStyleBackColor = $True
$button1.Text = "Confirm" $button1.Text = "Confirm"
$button1.Location = New-Object System.Drawing.Point(27,472) $button1.Location = New-Object System.Drawing.Point(27,472)