add error handling for styles

This commit is contained in:
MyDrift 2024-08-20 21:32:16 +02:00
parent cbb5691982
commit 1c2b301613

View File

@ -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)