Add Show-MappingTab function to manage tab selection and improve error handling
This commit is contained in:
@@ -1047,6 +1047,29 @@ function Set-MigrationUiBusy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Show-MappingTab {
|
||||||
|
if ($null -eq $script:MainTabControl -or $null -eq $script:tabMapping) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($script:MainTabControl -isnot [System.Windows.Forms.TabControl] -or $script:tabMapping -isnot [System.Windows.Forms.TabPage]) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($null -ne $script:MainForm -and $script:MainForm.IsDisposed) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
if ($script:MainTabControl.TabPages.Contains($script:tabMapping)) {
|
||||||
|
$script:MainTabControl.SelectTab($script:tabMapping)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-UILog -Message ("Konnte Mapping-Tab nicht aktivieren: {0}" -f $_.Exception.Message) -Level "WARN"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function Reset-MigrationStreamPositions {
|
function Reset-MigrationStreamPositions {
|
||||||
$script:MigrationStreamPositions = @{
|
$script:MigrationStreamPositions = @{
|
||||||
Output = [long]0
|
Output = [long]0
|
||||||
@@ -2400,7 +2423,7 @@ function Invoke-ExportFromGui {
|
|||||||
Load-MappingTableFromPath -Path $mappingPath
|
Load-MappingTableFromPath -Path $mappingPath
|
||||||
Apply-ColumnDefaultsIfAvailable
|
Apply-ColumnDefaultsIfAvailable
|
||||||
Save-MappingTableToPath -Path $mappingPath
|
Save-MappingTableToPath -Path $mappingPath
|
||||||
$script:MainTabControl.SelectedTab = $script:tabMapping
|
Show-MappingTab
|
||||||
}
|
}
|
||||||
}.GetNewClosure()
|
}.GetNewClosure()
|
||||||
|
|
||||||
@@ -2798,7 +2821,7 @@ $btnLoadMapping.Add_Click({
|
|||||||
|
|
||||||
if ($dialog.ShowDialog() -eq [System.Windows.Forms.DialogResult]::OK) {
|
if ($dialog.ShowDialog() -eq [System.Windows.Forms.DialogResult]::OK) {
|
||||||
Load-MappingTableFromPath -Path $dialog.GetPath()
|
Load-MappingTableFromPath -Path $dialog.GetPath()
|
||||||
$script:MainTabControl.SelectedTab = $script:tabMapping
|
Show-MappingTab
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
@@ -2923,3 +2946,4 @@ if ($NoGui.IsPresent) {
|
|||||||
|
|
||||||
$formBuilder.Show()
|
$formBuilder.Show()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user