Jun 11, 2026, 10:38 AM
This commit is contained in:
@@ -47,6 +47,7 @@ $dgServerInfo = $Window.FindName("dgServerInfo")
|
||||
$tvServers = $Window.FindName("tvServers")
|
||||
$btnAddServer = $Window.FindName("btnAddServer")
|
||||
$btnRemoveServer = $Window.FindName("btnRemoveServer")
|
||||
$gridDetails = $Window.FindName("gridDetails")
|
||||
|
||||
# Set initial values from settings
|
||||
$txtServerName.Text = $settings.LastServer
|
||||
@@ -135,10 +136,11 @@ function Refresh-ServerTree {
|
||||
$tvServers.Add_SelectedItemChanged({
|
||||
param($sender, $e)
|
||||
$selectedItem = $tvServers.SelectedItem
|
||||
if ($null -ne $selectedItem -and $null -ne $selectedItem.Tag) {
|
||||
if ($null -ne $selectedItem -and $null -ne $selectedItem.Tag -and $selectedItem.Tag -ne "__ROOT__") {
|
||||
# Show detail panel
|
||||
$gridDetails.Visibility = "Visible"
|
||||
|
||||
if ($selectedItem.Tag -is [string]) {
|
||||
if ($selectedItem.Tag -eq "__ROOT__") { return }
|
||||
|
||||
# It's a server node, copy its name to TextBox
|
||||
$txtServerName.Text = $selectedItem.Tag
|
||||
Write-Log "Selected server: $($selectedItem.Tag)"
|
||||
@@ -147,6 +149,9 @@ $tvServers.Add_SelectedItemChanged({
|
||||
$db = $selectedItem.Tag
|
||||
Write-Log "Selected database: $($db.Name) (Size: $($db.Size), Status: $($db.Status))"
|
||||
}
|
||||
} else {
|
||||
# Hide detail panel if selection is null or ROOT
|
||||
$gridDetails.Visibility = "Collapsed"
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
+21
-14
@@ -48,25 +48,32 @@
|
||||
<!-- Right Panel: Connection and Main Workspace -->
|
||||
<Grid Grid.Column="2" Margin="10,0,0,0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<Grid.RowDefinition Height="*"/>
|
||||
<Grid.RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Connection Panel -->
|
||||
<StackPanel Orientation="Horizontal" Margin="0,0,0,10">
|
||||
<Label Content="Server Name:" VerticalAlignment="Center" FontWeight="SemiBold"/>
|
||||
<TextBox x:Name="txtServerName" Width="250" VerticalAlignment="Center" Margin="5,0,10,0" Padding="4"/>
|
||||
<Button x:Name="btnConnect" Content="Connect & Test" Width="120" Padding="5" Background="#007ACC" Foreground="White" BorderThickness="0" Cursor="Hand"/>
|
||||
</StackPanel>
|
||||
<!-- Information/Connection Panel (Hidden until a server/db is selected) -->
|
||||
<Grid x:Name="gridDetails" Grid.Row="0" Visibility="Collapsed">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Main Content Area -->
|
||||
<GroupBox Grid.Row="1" Header="Server Information" Margin="0,0,0,10" Foreground="#2D3E50" FontWeight="SemiBold">
|
||||
<DataGrid x:Name="dgServerInfo" AutoGenerateColumns="True" IsReadOnly="True" Background="White" BorderBrush="#CCCCCC" Margin="5"/>
|
||||
</GroupBox>
|
||||
<!-- Connection Panel -->
|
||||
<StackPanel Grid.Row="0" Orientation="Horizontal" Margin="0,0,0,10">
|
||||
<Label Content="Server Name:" VerticalAlignment="Center" FontWeight="SemiBold"/>
|
||||
<TextBox x:Name="txtServerName" Width="250" VerticalAlignment="Center" Margin="5,0,10,0" Padding="4"/>
|
||||
<Button x:Name="btnConnect" Content="Connect & Test" Width="120" Padding="5" Background="#007ACC" Foreground="White" BorderThickness="0" Cursor="Hand"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Main Content Area -->
|
||||
<GroupBox Grid.Row="1" Header="Server Information" Margin="0,0,0,10" Foreground="#2D3E50" FontWeight="SemiBold">
|
||||
<DataGrid x:Name="dgServerInfo" AutoGenerateColumns="True" IsReadOnly="True" Background="White" BorderBrush="#CCCCCC" Margin="5"/>
|
||||
</GroupBox>
|
||||
</Grid>
|
||||
|
||||
<!-- Log Area -->
|
||||
<TextBox Grid.Row="2" x:Name="txtLogs" Height="120" IsReadOnly="True" VerticalScrollBarVisibility="Auto" Background="#E8E8E8" FontFamily="Consolas" FontSize="11" TextWrapping="Wrap" BorderBrush="#CCCCCC" Padding="5"/>
|
||||
<TextBox Grid.Row="1" x:Name="txtLogs" Height="120" IsReadOnly="True" VerticalScrollBarVisibility="Auto" Background="#E8E8E8" FontFamily="Consolas" FontSize="11" TextWrapping="Wrap" BorderBrush="#CCCCCC" Padding="5"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
Reference in New Issue
Block a user