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