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,14 @@
using System.Globalization;
using System.Windows.Controls;
namespace PortProxyTool.Wpf.Rules;
public class PortValidationRule : ValidationRule
{
public override ValidationResult Validate(object? value, CultureInfo cultureInfo)
{
if (value is not string strValue) return new ValidationResult(false, "请输入有效的数字");
if (string.IsNullOrEmpty(strValue) || ushort.TryParse(strValue, out _)) return ValidationResult.ValidResult;
return new ValidationResult(false, "请输入有效的数字");
}
}