Compare commits
2 Commits
38ce3b2071
...
main
Author | SHA1 | Date | |
---|---|---|---|
eb09a42dc6
|
|||
1a4ad9a18f
|
@@ -18,6 +18,7 @@ public partial class MainWindow : Window
|
|||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
RefreshListBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RefreshButton_OnClick(object sender, RoutedEventArgs e)
|
private void RefreshButton_OnClick(object sender, RoutedEventArgs e)
|
||||||
|
@@ -16,7 +16,8 @@
|
|||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Label Grid.Column="0">监听地址</Label>
|
<Label Grid.Column="0">监听地址</Label>
|
||||||
<TextBox Grid.Column="1"
|
<TextBox Grid.Column="1"
|
||||||
Text="{Binding ListenAddress}" />
|
Text="{Binding Item.ListenAddress}"
|
||||||
|
IsEnabled="False" />
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid Margin="4">
|
<Grid Margin="4">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
@@ -24,9 +25,10 @@
|
|||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Label Grid.Column="0">监听端口</Label>
|
<Label Grid.Column="0">监听端口</Label>
|
||||||
<TextBox Grid.Column="1">
|
<TextBox Grid.Column="1"
|
||||||
|
IsEnabled="False">
|
||||||
<TextBox.Text>
|
<TextBox.Text>
|
||||||
<Binding Path="ListenPort" UpdateSourceTrigger="PropertyChanged">
|
<Binding Path="Item.ListenPort" UpdateSourceTrigger="PropertyChanged">
|
||||||
<Binding.ValidationRules>
|
<Binding.ValidationRules>
|
||||||
<rules:PortValidationRule />
|
<rules:PortValidationRule />
|
||||||
</Binding.ValidationRules>
|
</Binding.ValidationRules>
|
||||||
|
@@ -7,8 +7,6 @@ public partial class SetWindow : Window
|
|||||||
public SetWindow(PortProxyItem item)
|
public SetWindow(PortProxyItem item)
|
||||||
{
|
{
|
||||||
Item = item;
|
Item = item;
|
||||||
ListenAddress = item.ListenAddress;
|
|
||||||
ListenPort = item.ListenPort;
|
|
||||||
TargetAddress = item.TargetAddress ?? "127.0.0.1";
|
TargetAddress = item.TargetAddress ?? "127.0.0.1";
|
||||||
TargetPort = item.TargetPort ?? 12345;
|
TargetPort = item.TargetPort ?? 12345;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@@ -16,16 +14,11 @@ public partial class SetWindow : Window
|
|||||||
}
|
}
|
||||||
|
|
||||||
public PortProxyItem Item { get; set; }
|
public PortProxyItem Item { get; set; }
|
||||||
|
|
||||||
public string ListenAddress { get; set; }
|
|
||||||
public ushort ListenPort { get; set; }
|
|
||||||
public string TargetAddress { get; set; }
|
public string TargetAddress { get; set; }
|
||||||
public ushort TargetPort { get; set; }
|
public ushort TargetPort { get; set; }
|
||||||
|
|
||||||
private void SetButton_OnClick(object sender, RoutedEventArgs e)
|
private void SetButton_OnClick(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
Item.ListenAddress = ListenAddress;
|
|
||||||
Item.ListenPort = ListenPort;
|
|
||||||
Item.TargetAddress = TargetAddress;
|
Item.TargetAddress = TargetAddress;
|
||||||
Item.TargetPort = TargetPort;
|
Item.TargetPort = TargetPort;
|
||||||
var result = PortProxy.Set(Item);
|
var result = PortProxy.Set(Item);
|
||||||
|
Reference in New Issue
Block a user