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,42 @@
using System.Windows;
namespace PortProxyTool.Wpf.Views.Windows;
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();
DataContext = this;
}
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);
if (string.IsNullOrEmpty(result))
{
DialogResult = true;
}
else
{
DialogResult = false;
MessageBox.Show(result, "编辑失败", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
}