Compare commits

...

4 Commits

Author SHA1 Message Date
8db7d8e974 Merge branch 'test-2024-02-07-refactor-noapps' into max-min-buttons 2024-02-14 19:20:40 -03:00
6f09367ff1 Merge branch 'test-2024-02-07-refactor-noapps' into max-min-buttons 2024-02-10 11:10:14 -03:00
dfd2125cba Fix some behavior of the buttons 2024-02-10 11:07:22 -03:00
9b87edc10b Add minimize and maximize button
Added an minimize and maximize button to the main window
2024-02-09 22:09:31 -03:00
6 changed files with 98 additions and 14 deletions

View File

@ -0,0 +1,7 @@
function Invoke-WPFMinimizeButton {
<#
.SYNOPSIS
Minimize the application window
#>
$sync["Form"].WindowState = [System.Windows.WindowState]::Minimized
}

View File

@ -52,6 +52,8 @@ function Invoke-WPFButton {
"WPFGetInstalledTweaks" {Invoke-WPFGetInstalled -CheckBox "tweaks"}
"WPFGetIso" {Invoke-WPFGetIso}
"WPFMicrowin" {Invoke-WPFMicrowin}
"WPFMinimizeButton" {Invoke-WPFMinimizeButton}
"WPFMaximizeButton" {Invoke-WPFMaximizeButton}
"WPFCloseButton" {Invoke-WPFCloseButton}
"MicrowinScratchDirBT" {Invoke-ScratchDialog}
}

View File

@ -0,0 +1,11 @@
function Invoke-WPFMaximizeButton {
<#
.SYNOPSIS
Alternates between Maximized and Minimized window
#>
if ($sync["Form"].WindowState -eq [System.Windows.WindowState]::Maximized) {
$sync["Form"].WindowState = [System.Windows.WindowState]::Normal
} else {
$sync["Form"].WindowState = [System.Windows.WindowState]::Maximized
}
}

View File

@ -10,7 +10,6 @@
Author : Chris Titus @christitustech
Runspace Author: @DeveloperDurp
GitHub : https://github.com/ChrisTitusTech
Version : 24.02.12
#>
param (
[switch]$Debug,
@ -47,7 +46,6 @@ Add-Type -AssemblyName System.Windows.Forms
# Variable to sync between runspaces
$sync = [Hashtable]::Synchronized(@{})
$sync.PSScriptRoot = $PSScriptRoot
$sync.version = "24.02.12"
$sync.configs = @{}
$sync.ProcessRunning = $false
@ -2336,6 +2334,13 @@ Function Update-WinUtilProgramWinget {
$global:WinGetInstall = Start-Process -Verb runas powershell -ArgumentList "-command invoke-command -scriptblock {$wingetinstall} -argumentlist '$($ProgramsToInstall -join ",")'" -PassThru
}
function Invoke-WPFMinimizeButton {
<#
.SYNOPSIS
Minimize the application window
#>
$sync["Form"].WindowState = [System.Windows.WindowState]::Minimized
}
function Invoke-ScratchDialog {
@ -2419,6 +2424,8 @@ function Invoke-WPFButton {
"WPFGetInstalledTweaks" {Invoke-WPFGetInstalled -CheckBox "tweaks"}
"WPFGetIso" {Invoke-WPFGetIso}
"WPFMicrowin" {Invoke-WPFMicrowin}
"WPFMinimizeButton" {Invoke-WPFMinimizeButton}
"WPFMaximizeButton" {Invoke-WPFMaximizeButton}
"WPFCloseButton" {Invoke-WPFCloseButton}
"MicrowinScratchDirBT" {Invoke-ScratchDialog}
}
@ -3243,6 +3250,17 @@ function Invoke-WPFInstallUpgrade {
Write-Host "-- You can close this window if desired ---"
Write-Host "==========================================="
}
function Invoke-WPFMaximizeButton {
<#
.SYNOPSIS
Alternates between Maximized and Minimized window
#>
if ($sync["Form"].WindowState -eq [System.Windows.WindowState]::Maximized) {
$sync["Form"].WindowState = [System.Windows.WindowState]::Normal
} else {
$sync["Form"].WindowState = [System.Windows.WindowState]::Maximized
}
}
function Invoke-WPFMicrowin {
<#
.DESCRIPTION
@ -4463,6 +4481,7 @@ $inputXML = '<Window x:Class="WinUtility.MainWindow"
Background="{MainBackgroundColor}"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
Name="MainWindow"
Title="Chris Titus Tech''s Windows Utility" Height="800" Width="1280">
<WindowChrome.WindowChrome>
<WindowChrome CaptionHeight="0" CornerRadius="10"/>
@ -4708,13 +4727,13 @@ $inputXML = '<Window x:Class="WinUtility.MainWindow"
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="BackgroundBorder" Property="Background" Value="{ButtonBackgroundPressedColor}"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsMouseOver" Value="True"/>
<Condition Property="IsPressed" Value="False"/>
</MultiTrigger.Conditions>
<Setter TargetName="BackgroundBorder" Property="Background" Value="{ButtonBackgroundMouseoverColor}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="BackgroundBorder" Property="Background" Value="{ButtonBackgroundSelectedColor}"/>
<Setter Property="Foreground" Value="DimGray"/>
</Trigger>
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
@ -5074,6 +5093,8 @@ $inputXML = '<Window x:Class="WinUtility.MainWindow"
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="50px"/>
<ColumnDefinition Width="50px"/>
<ColumnDefinition Width="50px"/>
<ColumnDefinition Width="50px"/>
</Grid.ColumnDefinitions>
<TextBox
@ -5124,6 +5145,26 @@ $inputXML = '<Window x:Class="WinUtility.MainWindow"
<Button
Grid.Column="2"
Content="&#x2D;" BorderThickness="0"
BorderBrush="Transparent"
Background="{MainBackgroundColor}"
Width="35" Height="35"
HorizontalAlignment="Right" VerticalAlignment="Top"
Margin="0,5,5,0"
FontFamily="Arial"
Foreground="{MainForegroundColor}" FontSize="18" Name="WPFMinimizeButton" />
<Button
Grid.Column="3"
Content="&#9633;" BorderThickness="0"
BorderBrush="Transparent"
Background="{MainBackgroundColor}"
Width="35" Height="35"
HorizontalAlignment="Right" VerticalAlignment="Top"
Margin="0,5,5,0"
FontFamily="Arial"
Foreground="{MainForegroundColor}" FontSize="18" Name="WPFMaximizeButton" />
<Button
Grid.Column="4"
Content="&#xD7;" BorderThickness="0"
BorderBrush="Transparent"
Background="{MainBackgroundColor}"

View File

@ -8,6 +8,7 @@
Background="{MainBackgroundColor}"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
Name="MainWindow"
Title="Chris Titus Tech's Windows Utility" Height="800" Width="1280">
<WindowChrome.WindowChrome>
<WindowChrome CaptionHeight="0" CornerRadius="10"/>
@ -253,13 +254,13 @@
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="BackgroundBorder" Property="Background" Value="{ButtonBackgroundPressedColor}"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsMouseOver" Value="True"/>
<Condition Property="IsPressed" Value="False"/>
</MultiTrigger.Conditions>
<Setter TargetName="BackgroundBorder" Property="Background" Value="{ButtonBackgroundMouseoverColor}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="BackgroundBorder" Property="Background" Value="{ButtonBackgroundSelectedColor}"/>
<Setter Property="Foreground" Value="DimGray"/>
</Trigger>
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
@ -619,6 +620,8 @@
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="50px"/>
<ColumnDefinition Width="50px"/>
<ColumnDefinition Width="50px"/>
<ColumnDefinition Width="50px"/>
</Grid.ColumnDefinitions>
<TextBox
@ -669,6 +672,26 @@
<Button
Grid.Column="2"
Content="&#x2D;" BorderThickness="0"
BorderBrush="Transparent"
Background="{MainBackgroundColor}"
Width="35" Height="35"
HorizontalAlignment="Right" VerticalAlignment="Top"
Margin="0,5,5,0"
FontFamily="Arial"
Foreground="{MainForegroundColor}" FontSize="18" Name="WPFMinimizeButton" />
<Button
Grid.Column="3"
Content="&#9633;" BorderThickness="0"
BorderBrush="Transparent"
Background="{MainBackgroundColor}"
Width="35" Height="35"
HorizontalAlignment="Right" VerticalAlignment="Top"
Margin="0,5,5,0"
FontFamily="Arial"
Foreground="{MainForegroundColor}" FontSize="18" Name="WPFMaximizeButton" />
<Button
Grid.Column="4"
Content="&#xD7;" BorderThickness="0"
BorderBrush="Transparent"
Background="{MainBackgroundColor}"