mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-01-15 17:30:37 -06:00
add error handling
This commit is contained in:
parent
20dc45bc27
commit
7e3d124a24
@ -36,7 +36,11 @@ function Invoke-WPFUIElements {
|
||||
throw "Failed to retrieve Styles using 'FindResource' from main window element."
|
||||
}
|
||||
|
||||
$targetGrid = $window.FindName($targetGridName)
|
||||
try {
|
||||
$targetGrid = $window.FindName($targetGridName)
|
||||
} catch {
|
||||
throw "Failed to find the target grid '$targetGridName' in the main window."
|
||||
}
|
||||
|
||||
# Clear existing ColumnDefinitions and Children
|
||||
$targetGrid.ColumnDefinitions.Clear() | Out-Null
|
||||
|
Loading…
Reference in New Issue
Block a user