1
0
mirror of https://github.com/proxysu/ProxySU.git synced 2024-11-22 13:16:09 +03:00
ProxySU/ProxySuper.WPF/Controls/HostControl.xaml

167 lines
8.4 KiB
Plaintext
Raw Normal View History

2021-05-14 14:07:19 +03:00
<UserControl x:Class="ProxySuper.WPF.Controls.HostControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:ProxySuper.WPF.Controls"
2021-05-15 11:45:36 +03:00
xmlns:convert="clr-namespace:ProxySuper.Core.Converters;assembly=ProxySuper.Core"
xmlns:host="clr-namespace:ProxySuper.Core.Models.Hosts;assembly=ProxySuper.Core"
2021-08-16 13:25:43 +03:00
xmlns:ssh="clr-namespace:Renci.SshNet;assembly=Renci.SshNet"
2021-05-14 14:07:19 +03:00
mc:Ignorable="d">
2021-05-15 11:45:36 +03:00
<UserControl.Resources>
<convert:LoginSecretTypeConverter x:Key="SecretTypeConverter" />
<convert:ProxyTypeConverter x:Key="ProxyTypeConverter" />
</UserControl.Resources>
2021-05-14 14:07:19 +03:00
<Grid>
2021-05-15 11:45:36 +03:00
<Grid.RowDefinitions>
2021-07-08 13:37:32 +03:00
<RowDefinition Height="300" />
<RowDefinition Height="auto" />
2021-05-15 11:45:36 +03:00
</Grid.RowDefinitions>
<GroupBox Padding="10" Header="{DynamicResource HostGroupName}" Grid.Row="0">
2021-05-14 14:07:19 +03:00
<Grid>
2021-05-15 06:58:05 +03:00
<Grid.Resources >
<Style TargetType="Border" >
<Setter Property="Padding" Value="5,5,5,5" />
</Style>
</Grid.Resources>
2021-05-14 14:07:19 +03:00
<Grid.RowDefinitions>
2021-05-15 06:58:05 +03:00
<RowDefinition Height="36" />
<RowDefinition Height="36" />
<RowDefinition Height="36" />
<RowDefinition Height="36" />
<RowDefinition Height="36" />
2021-05-15 11:45:36 +03:00
<RowDefinition Height="36" />
2021-05-26 11:22:18 +03:00
<RowDefinition Height="36" />
2021-05-14 14:07:19 +03:00
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
2021-05-15 06:58:05 +03:00
<ColumnDefinition Width="80" />
2021-05-22 12:14:27 +03:00
<ColumnDefinition Width="*" />
2021-05-14 14:07:19 +03:00
</Grid.ColumnDefinitions>
2021-05-15 06:58:05 +03:00
<Label Content="{DynamicResource HostTag}" Grid.Row="0" Grid.Column="0" />
2021-05-14 14:07:19 +03:00
<TextBox Grid.Row="0" Grid.Column="1"
2021-05-16 04:12:47 +03:00
Width="170"
2021-05-15 06:58:05 +03:00
Text="{Binding Host.Tag}"
VerticalContentAlignment="Center" />
2021-05-15 11:45:36 +03:00
2021-05-15 06:58:05 +03:00
<Label Content="{DynamicResource HostAddress}" Grid.Row="1" Grid.Column="0" />
<TextBox Grid.Row="1" Grid.Column="1"
2021-05-16 04:12:47 +03:00
Width="170"
2021-05-14 14:07:19 +03:00
Text="{Binding Host.Address}"
VerticalContentAlignment="Center" />
2021-05-15 06:58:05 +03:00
2021-05-26 11:22:18 +03:00
<Label Content="{DynamicResource HostPort}" Grid.Row="2" Grid.Column="0" />
2021-05-15 06:58:05 +03:00
<TextBox Grid.Row="2" Grid.Column="1"
2021-05-16 04:12:47 +03:00
Width="170"
2021-05-26 11:22:18 +03:00
Text="{Binding Host.Port}"
2021-05-15 06:58:05 +03:00
VerticalContentAlignment="Center" />
2021-05-26 11:22:18 +03:00
<Label Content="{DynamicResource HostUserName}" Grid.Row="3" Grid.Column="0" />
2021-05-15 06:58:05 +03:00
<TextBox Grid.Row="3" Grid.Column="1"
2021-05-26 11:22:18 +03:00
Width="170"
Text="{Binding Host.UserName}"
VerticalContentAlignment="Center" />
<Label Content="{DynamicResource HostPassword}" Grid.Row="4" Grid.Column="0" />
<TextBox Grid.Row="4" Grid.Column="1"
2021-05-16 04:12:47 +03:00
Width="170"
2021-05-15 06:58:05 +03:00
Text="{Binding Host.Password}"
VerticalContentAlignment="Center" />
2021-05-15 11:45:36 +03:00
2021-05-26 11:22:18 +03:00
<Label Content="{DynamicResource HostSecretType}" Grid.Row="5" Grid.Column="0" />
<StackPanel Orientation="Horizontal" Grid.Row="5" Grid.Column="1" VerticalAlignment="Center">
2021-05-15 11:45:36 +03:00
<RadioButton GroupName="LoginSecretType"
Content="{DynamicResource HostSertTypePassword}"
IsChecked="{
Binding Host.SecretType,
Converter={StaticResource SecretTypeConverter},
ConverterParameter={x:Static host:LoginSecretType.Password}
}" />
<RadioButton GroupName="LoginSecretType"
Margin="20,0"
Content="{DynamicResource HostSertTypePrivateKey}"
IsChecked="{
Binding Host.SecretType,
Converter={StaticResource SecretTypeConverter},
ConverterParameter={x:Static host:LoginSecretType.PrivateKey}
}" />
</StackPanel>
2021-05-26 11:22:18 +03:00
<Label Content="{DynamicResource HostUploadSecretKey}" Grid.Row="6" Grid.Column="0" />
2021-05-15 11:45:36 +03:00
<Button Height="24"
Width="100"
HorizontalAlignment="Left"
2021-05-26 11:22:18 +03:00
Grid.Row="6" Grid.Column="1"
Command="{Binding Host.UploadPrivateKeyCommand}"
2021-05-15 11:45:36 +03:00
IsEnabled="{
Binding Host.SecretType,
Converter={StaticResource SecretTypeConverter},
ConverterParameter={x:Static host:LoginSecretType.PrivateKey}
}"
Content="{DynamicResource HostUploadSecretKey}" />
</Grid>
</GroupBox>
<GroupBox Padding="10" Header="{DynamicResource ProxyGroupName}" Grid.Row="1" Margin="0,10,0,0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="36" />
<RowDefinition Height="36" />
<RowDefinition Height="36" />
<RowDefinition Height="36" />
<RowDefinition Height="36" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80" />
2021-05-22 12:14:27 +03:00
<ColumnDefinition Width="*" />
2021-05-15 11:45:36 +03:00
</Grid.ColumnDefinitions>
<Label Content="{DynamicResource ProxyType}" Grid.Row="0" Grid.Column="0" />
<StackPanel Orientation="Horizontal" Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
<RadioButton Content="{DynamicResource ProxyTypeNone}"
Margin="0,0,5,0"
IsChecked="{
Binding Host.Proxy.Type,
Converter={StaticResource ProxyTypeConverter},
2021-08-16 13:25:43 +03:00
ConverterParameter={x:Static ssh:ProxyTypes.None}
2021-05-15 11:45:36 +03:00
}"/>
<RadioButton Content="{DynamicResource ProxyTypeHttp}"
Margin="5,0"
IsChecked="{
Binding Host.Proxy.Type,
Converter={StaticResource ProxyTypeConverter},
2021-08-16 13:25:43 +03:00
ConverterParameter={x:Static ssh:ProxyTypes.Http}
2021-05-15 11:45:36 +03:00
}"/>
<RadioButton Content="{DynamicResource ProxyTypeSocks5}"
Margin="5,0"
IsChecked="{
Binding Host.Proxy.Type,
Converter={StaticResource ProxyTypeConverter},
2021-08-16 13:25:43 +03:00
ConverterParameter={x:Static ssh:ProxyTypes.Socks5}
2021-05-15 11:45:36 +03:00
}"/>
</StackPanel>
<Label Content="{DynamicResource ProxyAddress}" Grid.Row="1" Grid.Column="0" />
<TextBox Text="{Binding Host.Proxy.Address}" Grid.Row="1" Grid.Column="1" />
<Label Content="{DynamicResource ProxyUserName}" Grid.Row="2" Grid.Column="0" />
<TextBox Text="{Binding Host.Proxy.UserName}" Grid.Row="2" Grid.Column="1" />
<Label Content="{DynamicResource HostPort}" Grid.Row="3" Grid.Column="0" />
<TextBox Text="{Binding Host.Proxy.Port}" Grid.Row="3" Grid.Column="1" />
<Label Content="{DynamicResource ProxyPassword}" Grid.Row="4" Grid.Column="0" />
<TextBox Text="{Binding Host.Proxy.Password}" Grid.Row="4" Grid.Column="1" />
2021-05-14 14:07:19 +03:00
</Grid>
</GroupBox>
</Grid>
</UserControl>