<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:loc="using:NewLife.XCoder.Services"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:NewLife.XCoder.ViewModels"
mc:Ignorable="d" d:DesignWidth="900" d:DesignHeight="700"
x:Class="NewLife.XCoder.Views.SshWindow"
x:DataType="vm:SshViewModel"
Title="{loc:Tr 'SSH Tool'}" Width="900" Height="700"
WindowStartupLocation="CenterOwner">
<Window.Styles>
<Style Selector="TextBox.ConfigTextBox">
<Setter Property="Margin" Value="2"/>
<Setter Property="Height" Value="32"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderDefault}"/>
</Style>
<Style Selector="Button.ActionButton">
<Setter Property="Height" Value="32"/>
<Setter Property="Padding" Value="12,0"/>
<Setter Property="Margin" Value="2"/>
</Style>
<Style Selector="Border.GroupBorder">
<Setter Property="Background" Value="{DynamicResource BgSurface2}"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderDefault}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="CornerRadius" Value="10"/>
<Setter Property="Padding" Value="8"/>
<Setter Property="Margin" Value="0"/>
</Style>
</Window.Styles>
<Grid Margin="16" RowSpacing="10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- 连接配置 -->
<Border Grid.Row="0" Classes="GroupBorder">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="120"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="80"/>
</Grid.ColumnDefinitions>
<TextBlock Text="{loc:Tr 'Address'}" VerticalAlignment="Center" Margin="4,2"/>
<TextBox Grid.Column="1" Text="{Binding RemoteAddress}" Classes="ConfigTextBox"
PlaceholderText="{loc:Tr '192.168.1.10 or user@host:22'}"/>
<TextBlock Grid.Column="2" Text="{loc:Tr 'Port'}" VerticalAlignment="Center" Margin="4,2"/>
<TextBox Grid.Column="3" Text="{Binding Port}" Classes="ConfigTextBox"/>
<TextBlock Grid.Column="4" Text="{loc:Tr 'Username'}" VerticalAlignment="Center" Margin="4,2"/>
<TextBox Grid.Column="5" Text="{Binding UserName}" Classes="ConfigTextBox"/>
<TextBlock Grid.Row="1" Text="{loc:Tr 'Password'}" VerticalAlignment="Center" Margin="4,2"/>
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding Password}" Classes="ConfigTextBox"/>
<Button Grid.Row="1" Grid.Column="3" Content="{Binding ConnectButtonText}" Command="{Binding ToggleConnectCommand}" Classes="ActionButton" Width="80"/>
<TextBlock Grid.Row="2" Text="{loc:Tr 'Private key'}" VerticalAlignment="Center" Margin="4,2"/>
<TextBox Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding PrivateKeyPath}" Classes="ConfigTextBox"
PlaceholderText="{loc:Tr 'Optional: id_rsa path; if set, key authentication is preferred'}"/>
<TextBlock Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="5" VerticalAlignment="Center"
Margin="4,4,0,0" FontSize="11" Foreground="{DynamicResource TextTertiary}"
Text="{loc:Tr 'Use either a password or a private key; the password can be empty when a key is provided'}"/>
</Grid>
</Border>
<!-- 日志 -->
<TextBox Classes="console" Grid.Row="1" Text="{Binding ReceiveLog}" AcceptsReturn="True" AcceptsTab="True"
FontFamily="{DynamicResource FontMono}" FontSize="12" Margin="0,4"
BorderThickness="1" BorderBrush="{DynamicResource BorderDefault}"/>
<!-- 发送 -->
<Border Grid.Row="2" Classes="GroupBorder">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBox Text="{Binding SendText}" Classes="ConfigTextBox"/>
<Button Grid.Column="1" Content="{loc:Tr 'Send'}" Command="{Binding SendCommand}" Classes="ActionButton" Width="80"/>
<Button Grid.Column="2" Content="{loc:Tr 'Clear'}" Command="{Binding ClearLogCommand}" Classes="ActionButton" Width="60"/>
</Grid>
</Border>
</Grid>
</Window>
|