mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-01-16 01:40:35 -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."
|
throw "Failed to retrieve Styles using 'FindResource' from main window element."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
$targetGrid = $window.FindName($targetGridName)
|
$targetGrid = $window.FindName($targetGridName)
|
||||||
|
} catch {
|
||||||
|
throw "Failed to find the target grid '$targetGridName' in the main window."
|
||||||
|
}
|
||||||
|
|
||||||
# Clear existing ColumnDefinitions and Children
|
# Clear existing ColumnDefinitions and Children
|
||||||
$targetGrid.ColumnDefinitions.Clear() | Out-Null
|
$targetGrid.ColumnDefinitions.Clear() | Out-Null
|
||||||
|
Loading…
Reference in New Issue
Block a user