feat: 完善 PortProxy 图形化管理工具

This commit is contained in:
2025-01-29 02:40:46 +08:00
parent 23995df656
commit 38ce3b2071
13 changed files with 685 additions and 25 deletions

View File

@@ -0,0 +1,200 @@
<Window x:Class="PortProxyTool.Wpf.Views.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:converters="clr-namespace:PortProxyTool.Wpf.Converters"
mc:Ignorable="d"
Title="PortProxyTool GUI" Height="450" Width="800"
MinHeight="450" MinWidth="800">
<Window.Resources>
<converters:NullableUnknownToStringConverter x:Key="NullableUnknownToStringConverter" />
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0">
<Button MinHeight="24"
Click="RefreshButton_OnClick">
刷新
</Button>
</StackPanel>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0"
Text="IPv4 -> IPv4"
HorizontalAlignment="Center" />
<ListBox Grid.Row="1"
Name="V4ToV4ListBox"
SelectionChanged="V4ToV4ListBox_OnSelectionChanged">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding ListenAddress}" />
<TextBlock Text=":" />
<TextBlock Text="{Binding ListenPort}" />
<TextBlock Text=" -> " />
<TextBlock
Text="{Binding TargetAddress, Converter={StaticResource NullableUnknownToStringConverter}}" />
<TextBlock Text=":" />
<TextBlock
Text="{Binding TargetPort, Converter={StaticResource NullableUnknownToStringConverter}}" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<Button Grid.Row="2"
Name="V4ToV4RemoveButton"
Click="RemoveButton_OnClick">
删除
</Button>
<Button Grid.Row="3"
Name="V4ToV4SetButton"
Click="SetButton_OnClick">
编辑
</Button>
</Grid>
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0"
Text="IPv4 -> IPv6"
HorizontalAlignment="Center" />
<ListBox Grid.Row="1"
Name="V4ToV6ListBox"
SelectionChanged="V4ToV6ListBox_OnSelectionChanged">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding ListenAddress}" />
<TextBlock Text=":" />
<TextBlock Text="{Binding ListenPort}" />
<TextBlock Text=" -> " />
<TextBlock
Text="{Binding TargetAddress, Converter={StaticResource NullableUnknownToStringConverter}}" />
<TextBlock Text=":" />
<TextBlock
Text="{Binding TargetPort, Converter={StaticResource NullableUnknownToStringConverter}}" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<Button Grid.Row="2"
Name="V4ToV6RemoveButton"
Click="RemoveButton_OnClick">
删除
</Button>
<Button Grid.Row="3"
Name="V4ToV6SetButton"
Click="SetButton_OnClick">
编辑
</Button>
</Grid>
<Grid Grid.Column="2">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0"
Text="IPv6 -> IPv6"
HorizontalAlignment="Center" />
<ListBox Grid.Row="1"
Name="V6ToV6ListBox"
SelectionChanged="V6ToV6ListBox_OnSelectionChanged">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding ListenAddress}" />
<TextBlock Text=":" />
<TextBlock Text="{Binding ListenPort}" />
<TextBlock Text=" -> " />
<TextBlock
Text="{Binding TargetAddress, Converter={StaticResource NullableUnknownToStringConverter}}" />
<TextBlock Text=":" />
<TextBlock
Text="{Binding TargetPort, Converter={StaticResource NullableUnknownToStringConverter}}" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<Button Grid.Row="2"
Name="V6ToV6RemoveButton"
Click="RemoveButton_OnClick">
删除
</Button>
<Button Grid.Row="3"
Name="V6ToV6SetButton"
Click="SetButton_OnClick">
编辑
</Button>
</Grid>
<Grid Grid.Column="3">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0"
Text="IPv6 -> IPv4"
HorizontalAlignment="Center" />
<ListBox Grid.Row="1"
Name="V6ToV4ListBox"
SelectionChanged="V6ToV4ListBox_OnSelectionChanged">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding ListenAddress}" />
<TextBlock Text=":" />
<TextBlock Text="{Binding ListenPort}" />
<TextBlock Text=" -> " />
<TextBlock
Text="{Binding TargetAddress, Converter={StaticResource NullableUnknownToStringConverter}}" />
<TextBlock Text=":" />
<TextBlock
Text="{Binding TargetPort, Converter={StaticResource NullableUnknownToStringConverter}}" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<Button Grid.Row="2"
Name="V6ToV4RemoveButton"
Click="RemoveButton_OnClick">
删除
</Button>
<Button Grid.Row="3"
Name="V6ToV4SetButton"
Click="SetButton_OnClick">
编辑
</Button>
</Grid>
</Grid>
<StackPanel Grid.Row="2">
<Button MinHeight="24"
Click="AddButton_OnClick">
添加
</Button>
</StackPanel>
</Grid>
</Window>