|
3 | 3 | xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
4 | 4 | xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
5 | 5 | xmlns:viewModels="clr-namespace:OpenSSHA_GUI.ViewModels" |
| 6 | + xmlns:models="clr-namespace:OpenSSHALib.Models;assembly=OpenSSHALib" |
| 7 | + xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia" |
| 8 | + xmlns:converters="clr-namespace:OpenSSHA_GUI.Converters" |
6 | 9 | x:DataType="viewModels:UploadToServerViewModel" |
7 | 10 | mc:Ignorable="d" d:DesignWidth="400" d:DesignHeight="600" |
8 | 11 | x:Class="OpenSSHA_GUI.Views.UploadToServerWindow" |
9 | | - Width="400" |
| 12 | + Width="500" |
10 | 13 | Height="600" |
11 | 14 | Title="Upload key to Server"> |
| 15 | + <Window.Resources> |
| 16 | + <converters:SingleSshKeyTypeConverter x:Key="SingleSshKeyTypeConverter" /> |
| 17 | + </Window.Resources> |
12 | 18 | <Design.DataContext> |
13 | 19 | <!-- This only sets the DataContext for the previewer in an IDE, |
14 | 20 | to set the actual DataContext for runtime, set the DataContext property in code (look at App.axaml.cs) --> |
|
17 | 23 | <Grid ColumnDefinitions="* * *" RowDefinitions="* * * * *"> |
18 | 24 | <Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3" Content="Upload a Key to a Server" VerticalAlignment="Top" HorizontalAlignment="Center" Margin="0 20"/> |
19 | 25 | <ListBox Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" Grid.RowSpan="2" ItemsSource="{Binding Keys}"> |
| 26 | + <ListBox.ItemTemplate> |
| 27 | + <DataTemplate DataType="models:SshPublicKey"> |
| 28 | + <Grid RowDefinitions="*" ColumnDefinitions="* * * *"> |
| 29 | + <StackPanel Grid.Column="0" Orientation="Horizontal" HorizontalAlignment="Center"> |
| 30 | + <avalonia:MaterialIcon Kind="FileKey"/> |
| 31 | + <TextBlock Text="{Binding Filename}" VerticalAlignment="Center"/> |
| 32 | + </StackPanel> |
| 33 | + <StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Center"> |
| 34 | + <avalonia:MaterialIcon Kind="Key"/> |
| 35 | + <Label Content="{Binding KeyType.BaseType, Converter={StaticResource SingleSshKeyTypeConverter}}"/> |
| 36 | + </StackPanel> |
| 37 | + <StackPanel Grid.Column="2" Grid.ColumnSpan="2" Orientation="Horizontal"> |
| 38 | + <avalonia:MaterialIcon Kind="CommentText"/> |
| 39 | + <Label Content="{Binding Comment}"/> |
| 40 | + </StackPanel> |
| 41 | + </Grid> |
| 42 | + </DataTemplate> |
| 43 | + </ListBox.ItemTemplate> |
20 | 44 | </ListBox> |
21 | 45 | <TextBox Grid.Row="3" Grid.Column="0" Text="{Binding Hostname}" Watermark="Hostname" Margin="5 20" Height="25"/> |
22 | 46 | <TextBox Grid.Row="3" Grid.Column="1" Text="{Binding User}" Watermark="Username" Margin="5 20" Height="25"/> |
23 | 47 | <TextBox Grid.Row="3" Grid.Column="2" Text="{Binding Password}" Watermark="Password" PasswordChar="*" Margin="5 20" Height="25"/> |
24 | | - <Button Grid.Row="4" Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="5" >Test connection</Button> |
25 | | - <Button Grid.Row="4" Grid.Column="2" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="5" IsEnabled="False">Status: Unknown</Button> |
| 48 | + <Button Grid.Row="4" Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="5" Command="{Binding TestConnection}" > |
| 49 | + <Label Content="Test connection"/> |
| 50 | + </Button> |
| 51 | + <Canvas Grid.Row="4" Grid.Column="2" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="5" Background="{Binding StatusButtonBackground}"> |
| 52 | + <ToolTip.Tip> |
| 53 | + <Label Content="{Binding StatusButtonToolTip}"/> |
| 54 | + </ToolTip.Tip> |
| 55 | + <Label Content="{Binding StatusButtonText}" /> |
| 56 | + </Canvas> |
26 | 57 | <Button Grid.Row="4" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="5" Background="LimeGreen">Upload</Button> |
27 | 58 | </Grid> |
28 | 59 | </Window> |
0 commit comments