Skip to content

Commit

Permalink
add error handling for styles
Browse files Browse the repository at this point in the history
  • Loading branch information
MyDrift-user committed Aug 20, 2024
1 parent cbb5691 commit 1c2b301
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions functions/public/Invoke-WPFUIElements.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ function Invoke-WPFUIElements {
$borderstyle = $window.FindResource("BorderStyle")
$HoverTextBlockStyle = $window.FindResource("HoverTextBlockStyle")
$ColorfulToggleSwitchStyle = $window.FindResource("ColorfulToggleSwitchStyle")

if (!$borderstyle -or !$HoverTextBlockStyle -or !$ColorfulToggleSwitchStyle) {
throw "Failed to retrieve Styles using 'FindResource' from main window element."
}

$targetGrid = $window.FindName($targetGridName)

Expand Down

0 comments on commit 1c2b301

Please sign in to comment.