mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-04-01 17:12:09 +00:00
Merge f8b7f626d8
into 698f1644c3
This commit is contained in:
commit
43ba74d0dd
@ -2382,13 +2382,7 @@
|
||||
Set-ItemProperty -Path \"HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SystemRestore\" -Name \"SystemRestorePointCreationFrequency\" -Value \"0\" -Type DWord -Force -ErrorAction Stop | Out-Null
|
||||
}
|
||||
|
||||
# Attempt to load the required module for Get-ComputerRestorePoint
|
||||
try {
|
||||
Import-Module Microsoft.PowerShell.Management -ErrorAction Stop
|
||||
} catch {
|
||||
Write-Host \"Failed to load the Microsoft.PowerShell.Management module: $_\"
|
||||
return
|
||||
}
|
||||
Invoke-WinUtilInitializeModule -module \"Microsoft.PowerShell.Management\"
|
||||
|
||||
# Get all the restore points for the current day
|
||||
try {
|
||||
|
@ -62,5 +62,10 @@ function Invoke-WPFButton {
|
||||
"WPFWinUtilInstallPSProfile" {Invoke-WinUtilInstallPSProfile}
|
||||
"WPFWinUtilUninstallPSProfile" {Invoke-WinUtilUninstallPSProfile}
|
||||
"WPFWinUtilSSHServer" {Invoke-WPFSSHServer}
|
||||
"WPFScanUpdates" {Invoke-WPFUpdateScan -type "updates"}
|
||||
"WPFShowUpdateHistory" { Invoke-WPFUpdateHistoryToggle }
|
||||
"WPFUpdateSelectedInstall" {Invoke-WPFUpdateMGMT -Selected}
|
||||
"WPFUpdateAllInstall" {Invoke-WPFUpdateMGMT -All}
|
||||
"WPFUpdateScanHistory" {Invoke-WPFUpdateScan -type "history"}
|
||||
}
|
||||
}
|
||||
|
127
functions/public/Invoke-WPFUpdateMGMT.ps1
Normal file
127
functions/public/Invoke-WPFUpdateMGMT.ps1
Normal file
@ -0,0 +1,127 @@
|
||||
|
||||
function Invoke-WinUtilUpdateInstall {
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Installs Windows updates using the Initialize-WindowsUpdateModule and Install-WindowsUpdate cmdlets.
|
||||
|
||||
.PARAMETER Params
|
||||
A hashtable containing the parameters for the Install-WindowsUpdate cmdlet.
|
||||
|
||||
#>
|
||||
|
||||
param (
|
||||
[Parameter(Mandatory=$true)]
|
||||
[hashtable]$Params
|
||||
)
|
||||
|
||||
try {
|
||||
Initialize-WindowsUpdateModule
|
||||
Install-WindowsUpdate @Params
|
||||
Set-WinUtilTaskbaritem -state "None" -overlay "checkmark"
|
||||
}
|
||||
catch {
|
||||
Write-Host "Error installing updates: $_" -ForegroundColor Red
|
||||
Set-WinUtilTaskbaritem -state "Error" -overlay "warning"
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-WPFUpdateMGMT {
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Manages Windows Update Installation
|
||||
|
||||
.PARAMETER Selected
|
||||
A switch parameter that indicates whether to install only selected updates.
|
||||
|
||||
.PARAMETER All
|
||||
A switch parameter that indicates whether to install all available updates.
|
||||
|
||||
#>
|
||||
|
||||
param (
|
||||
[switch]$Selected,
|
||||
[switch]$All
|
||||
)
|
||||
|
||||
# Prepare common installation parameters
|
||||
$params = @{
|
||||
Confirm = $false
|
||||
IgnoreReboot = $true
|
||||
IgnoreRebootRequired = $true
|
||||
}
|
||||
|
||||
if ($sync["WPFUpdateVerbose"].IsChecked) {
|
||||
$params['Verbose'] = $true
|
||||
}
|
||||
|
||||
try {
|
||||
if ($All) {
|
||||
Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo"
|
||||
Invoke-WinUtilUpdateControls -state $false
|
||||
Invoke-WPFRunspace -ArgumentList $params -DebugPreference $DebugPreference -ScriptBlock {
|
||||
param ($params)
|
||||
|
||||
try {
|
||||
Write-Host "Installing all available updates..."
|
||||
Invoke-WinUtilUpdateInstall -Params $params
|
||||
Write-Host "All available updates installed successfully"
|
||||
$sync.form.Dispatcher.Invoke([action] { Set-WinUtilTaskbaritem -state "None" -overlay "checkmark" })
|
||||
} catch {
|
||||
Write-Host "Error installing updates: $_" -ForegroundColor Red
|
||||
$sync.form.Dispatcher.Invoke([action] { Set-WinUtilTaskbaritem -state "Error" -overlay "warning" })
|
||||
}
|
||||
}
|
||||
Invoke-WinUtilUpdateControls -state $true
|
||||
} elseif ($Selected -and $sync["WPFUpdatesList"].SelectedItems.Count -gt 0) {
|
||||
Write-Host "Installing selected updates..."
|
||||
|
||||
# Get selected updates
|
||||
$selectedUpdates = $sync["WPFUpdatesList"].SelectedItems | ForEach-Object {
|
||||
[PSCustomObject]@{
|
||||
ComputerName = $_.ComputerName
|
||||
Title = $_.LongTitle
|
||||
KB = $_.KB
|
||||
}
|
||||
}
|
||||
|
||||
# Install selected updates
|
||||
Invoke-WPFRunspace -ParameterList @(("selectedUpdates", $selectedUpdates),("params", $params)) -DebugPreference $DebugPreference -ScriptBlock {
|
||||
param ($selectedUpdates, $params)
|
||||
|
||||
$sync.form.Dispatcher.Invoke([action] {
|
||||
Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo"
|
||||
Invoke-WinUtilUpdateControls -state $false
|
||||
})
|
||||
|
||||
foreach ($update in $selectedUpdates) {
|
||||
Write-Host "Installing update $($update.Title) on $($update.ComputerName)"
|
||||
|
||||
# Prepare update-specific parameters
|
||||
$updateParams = $params.Clone()
|
||||
$updateParams['ComputerName'] = $update.ComputerName
|
||||
|
||||
# Install update based on KB or Title
|
||||
if ($update.KB) {
|
||||
Get-WindowsUpdate -KBArticleID $update.KB -Install @updateParams
|
||||
} else {
|
||||
Get-WindowsUpdate -Title $update.Title -Install @updateParams
|
||||
}
|
||||
}
|
||||
|
||||
$sync.form.Dispatcher.Invoke([action] {
|
||||
Set-WinUtilTaskbaritem -state "None" -overlay "checkmark"
|
||||
Invoke-WinUtilUpdateControls -state $true
|
||||
})
|
||||
Write-Host "Selected updates installed successfully"
|
||||
}
|
||||
} else {
|
||||
Write-Host "No updates selected"
|
||||
}
|
||||
|
||||
} catch {
|
||||
Write-Host "Error installing updates: $_" -ForegroundColor Red
|
||||
Set-WinUtilTaskbaritem -state "Error" -overlay "warning"
|
||||
}
|
||||
}
|
122
functions/public/Invoke-WPFUpdateScan.ps1
Normal file
122
functions/public/Invoke-WPFUpdateScan.ps1
Normal file
@ -0,0 +1,122 @@
|
||||
function Invoke-WPFUpdateHistoryToggle {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Toggles the visibility of the Windows update history and available updates.
|
||||
#>
|
||||
|
||||
$showHistory = $sync["WPFShowUpdateHistory"].Content -eq "Show History"
|
||||
|
||||
$sync["WPFShowUpdateHistory"].Content = if ($showHistory) { "Show available Updates" } else { "Show History" }
|
||||
$sync["HistoryGrid"].Visibility = if ($showHistory) { "Visible" } else { "Collapsed" }
|
||||
$sync["UpdatesGrid"].Visibility = if ($showHistory) { "Collapsed" } else { "Visible" }
|
||||
}
|
||||
|
||||
function Invoke-WinUtilUpdateControls {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Disables or enables the update controls based on the specified state.
|
||||
|
||||
.PARAMETER state
|
||||
The state to set the controls to.
|
||||
#>
|
||||
|
||||
param (
|
||||
[boolean]$state
|
||||
)
|
||||
|
||||
$sync["WPFScanUpdates"].IsEnabled = $state
|
||||
$sync["WPFUpdateScanHistory"].IsEnabled = $state
|
||||
$sync["WPFUpdateSelectedInstall"].IsEnabled = $state
|
||||
$sync["WPFUpdateAllInstall"].IsEnabled = $state
|
||||
}
|
||||
|
||||
|
||||
function Invoke-WPFUpdateScan {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Scans for Windows updates and history and builds the DataGrids for the UI.
|
||||
|
||||
.PARAMETER type
|
||||
The type of scan to perform.
|
||||
|
||||
#>
|
||||
|
||||
param (
|
||||
[string]$type
|
||||
)
|
||||
|
||||
Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo"
|
||||
Invoke-WinUtilUpdateControls -state $false
|
||||
|
||||
Invoke-WPFRunspace -ArgumentList $type -DebugPreference $DebugPreference -ScriptBlock {
|
||||
param ($type)
|
||||
try {
|
||||
Invoke-WinUtilInitializeModule -module "PSWindowsUpdate"
|
||||
switch ($type) {
|
||||
"updates" {
|
||||
$sync.form.Dispatcher.Invoke([action] { $sync["WPFUpdatesList"].ItemsSource = $null })
|
||||
Write-Host "Scanning for Windows updates..."
|
||||
$updates = Get-WindowsUpdate -ErrorAction SilentlyContinue
|
||||
Write-Host "Found $($updates.Count) updates."
|
||||
|
||||
# Build the list of items first
|
||||
$items = foreach ($update in $updates) {
|
||||
[PSCustomObject]@{
|
||||
LongTitle = $update.Title
|
||||
ComputerName = $update.ComputerName
|
||||
KB = $update.KB
|
||||
Size = $update.Size
|
||||
Title = $update.Title -replace '\s*\(KB\d+\)', '' -replace '\s*KB\d+\b', ''
|
||||
Status = "Not Installed"
|
||||
}
|
||||
}
|
||||
|
||||
$Computers = $updates.ComputerName | Select-Object -Unique
|
||||
|
||||
# Update the DataGrid at once
|
||||
$sync.form.Dispatcher.Invoke([action] {
|
||||
$sync["WPFUpdatesList"].ItemsSource = $items
|
||||
$sync["WPFUpdatesList"].Columns[0].Visibility = if ($Computers.Count -gt 1) { "Visible" } else { "Collapsed" }
|
||||
})
|
||||
}
|
||||
"history" {
|
||||
$sync.form.Dispatcher.Invoke([action] { $sync["WPFUpdateHistory"].ItemsSource = $null })
|
||||
Write-Host "Scanning for Windows update history..."
|
||||
$history = Get-WUHistory -Last 50 -ErrorAction Stop
|
||||
if (!$history) {
|
||||
Write-Host "No update history available."
|
||||
return
|
||||
}
|
||||
|
||||
# Build the list of history items first
|
||||
$items = foreach ($update in $history) {
|
||||
[PSCustomObject]@{
|
||||
ComputerName = $update.ComputerName
|
||||
Result = $update.Result
|
||||
Title = $update.Title -replace '\s*\(KB\d+\)', '' -replace '\s*KB\d+\b', ''
|
||||
KB = $update.KB
|
||||
Date = $update.Date
|
||||
}
|
||||
}
|
||||
|
||||
$Computers = $history.ComputerName | Select-Object -Unique
|
||||
|
||||
# Update the DataGrid at once
|
||||
$sync.form.Dispatcher.Invoke([action] {
|
||||
$sync["WPFUpdateHistory"].ItemsSource = $items
|
||||
$sync["WPFUpdateHistory"].Columns[0].Visibility = if ($Computers.Count -gt 1) { "Visible" } else { "Collapsed" }
|
||||
})
|
||||
Write-Host "Scanning for Windows update history completed"
|
||||
}
|
||||
}
|
||||
|
||||
$sync.form.Dispatcher.Invoke([action] { Set-WinUtilTaskbaritem -state "None" -overlay "checkmark" })
|
||||
}
|
||||
catch {
|
||||
$sync.form.Dispatcher.Invoke([action] { Set-WinUtilTaskbaritem -state "Error" -overlay "warning" })
|
||||
Write-Host "Error during scan: $_" -ForegroundColor Red
|
||||
} finally {
|
||||
$sync.form.Dispatcher.Invoke([action] { Invoke-WinUtilUpdateControls -state $true })
|
||||
}
|
||||
}
|
||||
}
|
28
functions/public/Invoke-WinUtilInitializeModule.ps1
Normal file
28
functions/public/Invoke-WinUtilInitializeModule.ps1
Normal file
@ -0,0 +1,28 @@
|
||||
function Invoke-WinUtilInitializeModule {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Initializes and imports a specified PowerShell module.
|
||||
|
||||
.PARAMETER module
|
||||
The name of the module to be installed and imported. If the module is not already available, it will be installed for the current user.
|
||||
|
||||
#>
|
||||
|
||||
param (
|
||||
[string]$module
|
||||
)
|
||||
|
||||
Invoke-WPFRunspace -ArgumentList $module -DebugPreference $DebugPreference -ScriptBlock {
|
||||
param ($module)
|
||||
try {
|
||||
if (-not (Get-Module -ListAvailable -Name $module)) {
|
||||
Write-Host "Installing $module module..."
|
||||
Install-Module -Name $module -Force -Scope CurrentUser
|
||||
}
|
||||
Import-Module $module -ErrorAction Stop
|
||||
Write-Host "Imported $module module successfully"
|
||||
} catch {
|
||||
Write-Host "Error importing $module module: $_" -ForegroundColor Red
|
||||
}
|
||||
}
|
||||
}
|
@ -842,6 +842,182 @@
|
||||
</MultiDataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<Style TargetType="DataGrid">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource MainForegroundColor}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderColor}" />
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
<Setter Property="FontSize" Value="{DynamicResource FontSize}" />
|
||||
<Setter Property="FontFamily" Value="{DynamicResource FontFamily}" />
|
||||
<Setter Property="RowBackground" Value="Transparent" />
|
||||
<Setter Property="AlternatingRowBackground" Value="{DynamicResource AlternatingRowBackgroundColor}" />
|
||||
<Setter Property="GridLinesVisibility" Value="None" />
|
||||
<Setter Property="HeadersVisibility" Value="Column" />
|
||||
<Setter Property="HorizontalScrollBarVisibility" Value="Auto" />
|
||||
<Setter Property="VerticalScrollBarVisibility" Value="Auto" />
|
||||
<Setter Property="SelectionMode" Value="Extended" />
|
||||
<Setter Property="SelectionUnit" Value="FullRow" />
|
||||
<Setter Property="CanUserAddRows" Value="False" />
|
||||
<Setter Property="CanUserDeleteRows" Value="False" />
|
||||
<Setter Property="CanUserReorderColumns" Value="False" />
|
||||
<Setter Property="CanUserResizeRows" Value="True" />
|
||||
<Setter Property="CanUserSortColumns" Value="True" />
|
||||
<Setter Property="AutoGenerateColumns" Value="False" />
|
||||
<Setter Property="Margin" Value="0,10,0,10" />
|
||||
<Setter Property="CellStyle">
|
||||
<Setter.Value>
|
||||
<Style TargetType="DataGridCell">
|
||||
<Setter Property="Padding" Value="10,6" />
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="DataGridCell">
|
||||
<Border Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="4"
|
||||
Margin="2,1"
|
||||
Padding="{TemplateBinding Padding}">
|
||||
<ContentPresenter VerticalAlignment="Center" />
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonBackgroundMouseoverColor}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource MainForegroundColor}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonBackgroundSelectedColor}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource MainForegroundColor}" />
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="RowStyle">
|
||||
<Setter.Value>
|
||||
<Style TargetType="DataGridRow">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource MainForegroundColor}" />
|
||||
<Setter Property="MinHeight" Value="35" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
<Setter Property="Margin" Value="0,1" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="DataGridRow">
|
||||
<Border x:Name="RowBorder"
|
||||
BorderThickness="0"
|
||||
BorderBrush="{DynamicResource BorderColor}"
|
||||
Background="{TemplateBinding Background}"
|
||||
CornerRadius="6"
|
||||
Margin="4,2"
|
||||
SnapsToDevicePixels="True">
|
||||
<SelectiveScrollingGrid>
|
||||
<SelectiveScrollingGrid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</SelectiveScrollingGrid.ColumnDefinitions>
|
||||
<SelectiveScrollingGrid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</SelectiveScrollingGrid.RowDefinitions>
|
||||
<DataGridCellsPresenter Grid.Column="1"
|
||||
ItemsPanel="{TemplateBinding ItemsPanel}"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||
<DataGridDetailsPresenter Grid.Column="1" Grid.Row="1"
|
||||
Visibility="{TemplateBinding DetailsVisibility}"
|
||||
SelectiveScrollingGrid.SelectiveScrollingOrientation="{Binding AreRowDetailsFrozen,
|
||||
RelativeSource={RelativeSource AncestorType={x:Type DataGrid}},
|
||||
Converter={x:Static DataGrid.RowDetailsScrollingConverter},
|
||||
ConverterParameter={x:Static SelectiveScrollingOrientation.Vertical}}"/>
|
||||
<DataGridRowHeader Grid.RowSpan="2"
|
||||
SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical"
|
||||
Visibility="{Binding HeadersVisibility,
|
||||
RelativeSource={RelativeSource AncestorType={x:Type DataGrid}},
|
||||
Converter={x:Static DataGrid.HeadersVisibilityConverter},
|
||||
ConverterParameter={x:Static DataGridHeadersVisibility.Row}}"/>
|
||||
</SelectiveScrollingGrid>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonBackgroundMouseoverColor}" />
|
||||
<Setter Property="Effect">
|
||||
<Setter.Value>
|
||||
<DropShadowEffect ShadowDepth="0" BlurRadius="5" Opacity="0.2" Color="#000000" />
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Trigger>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource ButtonBackgroundSelectedColor}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource MainForegroundColor}" />
|
||||
<Setter Property="Effect">
|
||||
<Setter.Value>
|
||||
<DropShadowEffect ShadowDepth="1" BlurRadius="7" Opacity="0.3" Color="#000000" />
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="ColumnHeaderStyle">
|
||||
<Setter.Value>
|
||||
<Style TargetType="DataGridColumnHeader">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource ButtonForegroundColor}" />
|
||||
<Setter Property="FontSize" Value="{DynamicResource FontSize}" />
|
||||
<Setter Property="FontFamily" Value="{DynamicResource FontFamily}" />
|
||||
<Setter Property="FontWeight" Value="SemiBold" />
|
||||
<Setter Property="Padding" Value="10,8" />
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Left" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
<Setter Property="Margin" Value="2,0" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="DataGridColumnHeader">
|
||||
<Grid>
|
||||
<Border Background="{TemplateBinding Background}"
|
||||
BorderBrush="{DynamicResource BorderColor}"
|
||||
BorderThickness="0,0,0,1"
|
||||
Padding="{TemplateBinding Padding}">
|
||||
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
SnapsToDevicePixels="True" />
|
||||
</Border>
|
||||
<Path x:Name="SortArrow" Visibility="Collapsed"
|
||||
HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||
Margin="0,0,5,0" Fill="{DynamicResource ButtonForegroundColor}"
|
||||
Width="8" Height="6" Stretch="Fill" />
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="SortDirection" Value="Ascending">
|
||||
<Setter TargetName="SortArrow" Property="Visibility" Value="Visible"/>
|
||||
<Setter TargetName="SortArrow" Property="Data" Value="M 0,5 L 8,5 L 4,0 Z"/>
|
||||
</Trigger>
|
||||
<Trigger Property="SortDirection" Value="Descending">
|
||||
<Setter TargetName="SortArrow" Property="Visibility" Value="Visible"/>
|
||||
<Setter TargetName="SortArrow" Property="Data" Value="M 0,0 L 8,0 L 4,5 Z"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Foreground" Value="{DynamicResource LinkHoverForegroundColor}" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</Window.Resources>
|
||||
<Grid Background="{DynamicResource MainBackgroundColor}" ShowGridLines="False" Name="WPFMainGrid" Width="Auto" Height="Auto" HorizontalAlignment="Stretch">
|
||||
<Grid.RowDefinitions>
|
||||
@ -1132,100 +1308,232 @@
|
||||
</ScrollViewer>
|
||||
</TabItem>
|
||||
<TabItem Header="Updates" Visibility="Collapsed" Name="WPFTab4">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" Margin="{DynamicResource TabContentMargin}">
|
||||
<!-- <ScrollViewer VerticalScrollBarVisibility="Auto" Margin="{DynamicResource TabContentMargin}"> -->
|
||||
<Grid Background="Transparent">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/> <!-- Row for the 3 columns -->
|
||||
<RowDefinition Height="Auto"/> <!-- Row for Windows Version -->
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Three columns container -->
|
||||
<Grid Grid.Row="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="200"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- Default Settings -->
|
||||
<Border Grid.Column="0" Style="{StaticResource BorderStyle}">
|
||||
<StackPanel>
|
||||
<!-- Left Column - Update Options -->
|
||||
<Border Grid.Column="0" Style="{StaticResource BorderStyle}" VerticalAlignment="Stretch">
|
||||
<StackPanel Margin="5">
|
||||
<TextBlock Text="Update Presets" Margin="0,0,0,5"/>
|
||||
<Button Name="WPFFixesUpdate"
|
||||
FontSize="{DynamicResource ConfigTabButtonFontSize}"
|
||||
Content="Default Settings"
|
||||
Margin="10,5"
|
||||
Padding="10"/>
|
||||
<TextBlock Margin="10"
|
||||
TextWrapping="Wrap"
|
||||
Foreground="{DynamicResource MainForegroundColor}">
|
||||
<Run FontWeight="Bold">Default Windows Update Configuration</Run>
|
||||
<LineBreak/>
|
||||
- No modifications to Windows defaults
|
||||
<LineBreak/>
|
||||
- Removes any custom update settings
|
||||
<LineBreak/><LineBreak/>
|
||||
<Run FontStyle="Italic" FontSize="11">Note: This resets your Windows Update settings to default out of the box settings. It removes ANY policy or customization that has been done to Windows Update.</Run>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
Content="Default"
|
||||
Width="Auto"
|
||||
Margin="0,2"
|
||||
ToolTip="Default Windows Update Configuration
- No modifications to Windows defaults
- Removes any custom update settings

Note: This resets your Windows Update settings to default out of the box settings. It removes ANY policy or customization that has been done to Windows Update."/>
|
||||
|
||||
<!-- Security Settings -->
|
||||
<Border Grid.Column="1" Style="{StaticResource BorderStyle}">
|
||||
<StackPanel>
|
||||
<Button Name="WPFUpdatessecurity"
|
||||
FontSize="{DynamicResource ConfigTabButtonFontSize}"
|
||||
Content="Security Settings"
|
||||
Margin="10,5"
|
||||
Padding="10"/>
|
||||
<TextBlock Margin="10"
|
||||
TextWrapping="Wrap"
|
||||
Foreground="{DynamicResource MainForegroundColor}">
|
||||
<Run FontWeight="Bold">Balanced Security Configuration</Run>
|
||||
<LineBreak/>
|
||||
- Feature updates delayed by 2 years
|
||||
<LineBreak/>
|
||||
- Security updates installed after 4 days
|
||||
<LineBreak/><LineBreak/>
|
||||
<Run FontWeight="SemiBold">Feature Updates:</Run> New features and potential bugs
|
||||
<LineBreak/>
|
||||
<Run FontWeight="SemiBold">Security Updates:</Run> Critical security patches
|
||||
<LineBreak/><LineBreak/>
|
||||
<Run FontStyle="Italic" FontSize="11">Note: This only applies to Pro systems that can use group policy.</Run>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
Content="Security"
|
||||
Width="Auto"
|
||||
Margin="0,2"
|
||||
ToolTip="Balanced Security Configuration
- Feature updates delayed by 2 years
- Security updates installed after 4 days

Feature Updates: New features and potential bugs
Security Updates: Critical security patches

Note: This only applies to Pro systems that can use group policy."/>
|
||||
|
||||
<!-- Disable Updates -->
|
||||
<Border Grid.Column="2" Style="{StaticResource BorderStyle}">
|
||||
<StackPanel>
|
||||
<Button Name="WPFUpdatesdisable"
|
||||
FontSize="{DynamicResource ConfigTabButtonFontSize}"
|
||||
Content="Disable All Updates"
|
||||
Content="Disable"
|
||||
Width="Auto"
|
||||
Foreground="Red"
|
||||
Margin="10,5"
|
||||
Padding="10"/>
|
||||
<TextBlock Margin="10"
|
||||
TextWrapping="Wrap"
|
||||
Foreground="{DynamicResource MainForegroundColor}">
|
||||
<Run FontWeight="Bold" Foreground="Red">!! Not Recommended !!</Run>
|
||||
<LineBreak/>
|
||||
- Disables ALL Windows Updates
|
||||
<LineBreak/>
|
||||
- Increases security risks
|
||||
<LineBreak/>
|
||||
- Only use for isolated systems
|
||||
<LineBreak/><LineBreak/>
|
||||
<Run FontStyle="Italic" FontSize="11">Warning: Your system will be vulnerable without security updates.</Run>
|
||||
</TextBlock>
|
||||
Margin="0,2"
|
||||
ToolTip="!! Not Recommended !!
- Disables ALL Windows Updates
- Increases security risks
- Only use for isolated systems

Warning: Your system will be vulnerable without security updates."/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- Right Column - Updates List -->
|
||||
<Border Grid.Column="1" Style="{StaticResource BorderStyle}" VerticalAlignment="Stretch">
|
||||
<Grid Margin="5,0,0,0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Toggle button at the top -->
|
||||
<StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Right" Margin="5">
|
||||
<ToggleButton Name="WPFShowUpdateHistory"
|
||||
Content="Show History"
|
||||
Style="{StaticResource ToggleButtonStyle}"
|
||||
Margin="5"
|
||||
Padding="10,5"
|
||||
ToolTip="Toggle between pending updates and update history"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Updates Grid - Visible by default -->
|
||||
<Grid Grid.Row="1" Name="UpdatesGrid" Visibility="Visible">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Button Name="WPFScanUpdates"
|
||||
Content="Scan for Updates"
|
||||
Grid.Row="0"
|
||||
Margin="5"
|
||||
HorizontalAlignment="Left"
|
||||
Padding="10,5"/>
|
||||
|
||||
<DataGrid Name="WPFUpdatesList"
|
||||
Grid.Row="1"
|
||||
Margin="5"
|
||||
AutoGenerateColumns="False"
|
||||
Background="Transparent"
|
||||
IsReadOnly="True"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="LongTitle"
|
||||
Binding="{Binding LongTitle}"
|
||||
Width="Auto"
|
||||
Visibility="Collapsed"/>
|
||||
<DataGridTextColumn Header="ComputerName"
|
||||
Binding="{Binding ComputerName}"
|
||||
Width="Auto"
|
||||
Visibility="Collapsed"/>
|
||||
<DataGridTextColumn Header="Title"
|
||||
Binding="{Binding Title}"
|
||||
Width="*"
|
||||
MinWidth="100"/>
|
||||
<DataGridTextColumn Header="KB"
|
||||
Binding="{Binding KB}"
|
||||
Width="Auto"
|
||||
MinWidth="100">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="TextAlignment" Value="Center"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Header="Size"
|
||||
Binding="{Binding Size}"
|
||||
Width="Auto"
|
||||
MinWidth="80">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="TextAlignment" Value="Center"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Header="Status"
|
||||
Binding="{Binding Status}"
|
||||
Width="Auto"
|
||||
MinWidth="100">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="TextAlignment" Value="Center"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
<StackPanel Grid.Row="2"
|
||||
Orientation="Horizontal"
|
||||
HorizontalAlignment="Right"
|
||||
Margin="5">
|
||||
<StackPanel VerticalAlignment="Center">
|
||||
<CheckBox x:Name="WPFUpdateVerbose"
|
||||
Content="Verbose Output"
|
||||
Margin="5"
|
||||
Padding="10,5"
|
||||
ToolTip="Verbose output for update installation"
|
||||
IsChecked="True"/>
|
||||
</StackPanel>
|
||||
<Button Name="WPFUpdateSelectedInstall"
|
||||
Content="Install Selected"
|
||||
Margin="5"
|
||||
Padding="10,5"/>
|
||||
<Button Name="WPFUpdateAllInstall"
|
||||
Content="Install All"
|
||||
Margin="5"
|
||||
Padding="10,5"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<!-- History Grid - Collapsed by default -->
|
||||
<Grid Grid.Row="1" Name="HistoryGrid" Visibility="Collapsed">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Button Name="WPFUpdateScanHistory"
|
||||
Content="Scan History"
|
||||
Grid.Row="0"
|
||||
Margin="5"
|
||||
HorizontalAlignment="Left"
|
||||
Padding="10,5"/>
|
||||
|
||||
<DataGrid Name="WPFUpdateHistory"
|
||||
Grid.Row="1"
|
||||
Margin="5"
|
||||
AutoGenerateColumns="False"
|
||||
Background="Transparent"
|
||||
IsReadOnly="True"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="ComputerName"
|
||||
Binding="{Binding ComputerName}"
|
||||
Width="Auto"
|
||||
Visibility="Collapsed"/>
|
||||
|
||||
<DataGridTextColumn Header="Result"
|
||||
Binding="{Binding Result}"
|
||||
Width="Auto"
|
||||
MinWidth="100">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="TextAlignment" Value="Center"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Header="Title"
|
||||
Binding="{Binding Title}"
|
||||
Width="*"/>
|
||||
|
||||
<DataGridTextColumn Header="KB"
|
||||
Binding="{Binding KB}"
|
||||
Width="Auto"
|
||||
MinWidth="100">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="TextAlignment" Value="Center"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn Header="Date"
|
||||
Binding="{Binding Date}"
|
||||
Width="Auto"
|
||||
MinWidth="160">
|
||||
</DataGridTextColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
<!-- Future Implementation: Add Windows Version to updates panel -->
|
||||
<Grid Name="updatespanel" Grid.Row="1" Background="Transparent">
|
||||
</Grid>
|
||||
<Border Grid.Row="1" Style="{StaticResource BorderStyle}">
|
||||
<StackPanel Background="{DynamicResource MainBackgroundColor}" Orientation="Horizontal" HorizontalAlignment="Left">
|
||||
<TextBlock Padding="10">
|
||||
Note: Updates may require a system restart to complete installation. Make sure to save any work before proceeding.
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
<!-- </ScrollViewer> -->
|
||||
</TabItem>
|
||||
<TabItem Header="MicroWin" Visibility="Collapsed" Name="WPFTab5">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" Margin="{DynamicResource TabContentMargin}">
|
||||
|
Loading…
Reference in New Issue
Block a user