mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-07-01 18:42:35 -05:00
Merge branch 'Progress-bar' of https://github.com/MyDrift-user/winutil into Progress-bar
This commit is contained in:
@ -70,15 +70,16 @@ $inputXML = Set-WinUtilUITheme -inputXML $inputXML -themeName $ctttheme
|
||||
|
||||
# Read the XAML file
|
||||
$reader = (New-Object System.Xml.XmlNodeReader $xaml)
|
||||
try { $sync["Form"] = [Windows.Markup.XamlReader]::Load( $reader ) }
|
||||
catch [System.Management.Automation.MethodInvocationException] {
|
||||
try {
|
||||
$sync["Form"] = [Windows.Markup.XamlReader]::Load( $reader )
|
||||
} catch [System.Management.Automation.MethodInvocationException] {
|
||||
Write-Warning "We ran into a problem with the XAML code. Check the syntax for this control..."
|
||||
Write-Host $error[0].Exception.Message -ForegroundColor Red
|
||||
|
||||
If ($error[0].Exception.Message -like "*button*") {
|
||||
write-warning "Ensure your <button in the `$inputXML does NOT have a Click=ButtonClick property. PS can't handle this`n`n`n`n"
|
||||
}
|
||||
}
|
||||
catch {
|
||||
} catch {
|
||||
Write-Host "Unable to load Windows.Markup.XamlReader. Double-check syntax and ensure .net is installed."
|
||||
}
|
||||
|
||||
@ -179,9 +180,9 @@ $sync["Form"].Add_Closing({
|
||||
})
|
||||
|
||||
# Attach the event handler to the Click event
|
||||
$sync.CheckboxFilterClear.Add_Click({
|
||||
$sync.CheckboxFilter.Text = ""
|
||||
$sync.CheckboxFilterClear.Visibility = "Collapsed"
|
||||
$sync.SearchBarClearButton.Add_Click({
|
||||
$sync.SearchBar.Text = ""
|
||||
$sync.SearchBarClearButton.Visibility = "Collapsed"
|
||||
})
|
||||
|
||||
# add some shortcuts for people that don't like clicking
|
||||
@ -192,9 +193,9 @@ $commonKeyEvents = {
|
||||
|
||||
if ($_.Key -eq "Escape")
|
||||
{
|
||||
$sync.CheckboxFilter.SelectAll()
|
||||
$sync.CheckboxFilter.Text = ""
|
||||
$sync.CheckboxFilterClear.Visibility = "Collapsed"
|
||||
$sync.SearchBar.SelectAll()
|
||||
$sync.SearchBar.Text = ""
|
||||
$sync.SearchBarClearButton.Visibility = "Collapsed"
|
||||
return
|
||||
}
|
||||
|
||||
@ -225,11 +226,11 @@ $commonKeyEvents = {
|
||||
}
|
||||
# shortcut for the filter box
|
||||
if ($_.Key -eq "F" -and $_.KeyboardDevice.Modifiers -eq "Ctrl") {
|
||||
if ($sync.CheckboxFilter.Text -eq "Ctrl-F to filter") {
|
||||
$sync.CheckboxFilter.SelectAll()
|
||||
$sync.CheckboxFilter.Text = ""
|
||||
if ($sync.SearchBar.Text -eq "Ctrl-F to filter") {
|
||||
$sync.SearchBar.SelectAll()
|
||||
$sync.SearchBar.Text = ""
|
||||
}
|
||||
$sync.CheckboxFilter.Focus()
|
||||
$sync.SearchBar.Focus()
|
||||
}
|
||||
}
|
||||
|
||||
@ -377,7 +378,7 @@ Add-Type @"
|
||||
|
||||
})
|
||||
|
||||
# Load Checkboxes and Labels outside of the Filter fuction only once on startup for performance reasons
|
||||
# Load Checkboxes and Labels outside of the Filter function only once on startup for performance reasons
|
||||
$filter = Get-WinUtilVariables -Type CheckBox
|
||||
$CheckBoxes = ($sync.GetEnumerator()).where{ $psitem.Key -in $filter }
|
||||
|
||||
@ -387,13 +388,13 @@ $labels = @{}
|
||||
|
||||
$allCategories = $checkBoxes.Name | ForEach-Object {$sync.configs.applications.$_} | Select-Object -Unique -ExpandProperty category
|
||||
|
||||
$sync["CheckboxFilter"].Add_TextChanged({
|
||||
$sync["SearchBar"].Add_TextChanged({
|
||||
|
||||
if ($sync.CheckboxFilter.Text -ne "") {
|
||||
$sync.CheckboxFilterClear.Visibility = "Visible"
|
||||
if ($sync.SearchBar.Text -ne "") {
|
||||
$sync.SearchBarClearButton.Visibility = "Visible"
|
||||
}
|
||||
else {
|
||||
$sync.CheckboxFilterClear.Visibility = "Collapsed"
|
||||
$sync.SearchBarClearButton.Visibility = "Collapsed"
|
||||
}
|
||||
|
||||
$activeApplications = @()
|
||||
@ -404,7 +405,7 @@ $sync["CheckboxFilter"].Add_TextChanged({
|
||||
continue
|
||||
}
|
||||
|
||||
$textToSearch = $sync.CheckboxFilter.Text.ToLower()
|
||||
$textToSearch = $sync.SearchBar.Text.ToLower()
|
||||
$checkBoxName = $CheckBox.Key
|
||||
$textBlockName = $checkBoxName + "Link"
|
||||
|
||||
@ -488,7 +489,12 @@ MicroWin : <a href="https://github.com/KonTy">@KonTy</a>
|
||||
GitHub : <a href="https://github.com/ChrisTitusTech/winutil">ChrisTitusTech/winutil</a>
|
||||
Version : <a href="https://github.com/ChrisTitusTech/winutil/releases/tag/$($sync.version)">$($sync.version)</a>
|
||||
"@
|
||||
Show-CustomDialog -Message $authorInfo -Width 400
|
||||
$FontSize = $sync.configs.themes.$ctttheme.CustomDialogFontSize
|
||||
$HeaderFontSize = $sync.configs.themes.$ctttheme.CustomDialogFontSizeHeader
|
||||
$IconSize = $sync.configs.themes.$ctttheme.CustomDialogIconSize
|
||||
$Width = $sync.configs.themes.$ctttheme.CustomDialogWidth
|
||||
$Height = $sync.configs.themes.$ctttheme.CustomDialogHeight
|
||||
Show-CustomDialog -Message $authorInfo -Width $Width -Height $Height -FontSize $FontSize -HeaderFontSize $HeaderFontSize -IconSize $IconSize
|
||||
})
|
||||
$sync["Form"].ShowDialog() | out-null
|
||||
Stop-Transcript
|
||||
|
Reference in New Issue
Block a user