整理代码

This commit is contained in:
GG Z
2026-02-20 15:31:44 +08:00
parent 94cf3f3266
commit 9f121cfc7f
149 changed files with 4063 additions and 6964 deletions

View File

@@ -0,0 +1,21 @@
using System.ComponentModel.DataAnnotations;
using System.Globalization;
namespace ShrlAlgoToolkit.Mvvm.Attributes;
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)]
public sealed class IsNumericAttribute : ValidationAttribute
{
protected override ValidationResult IsValid(object value, ValidationContext validationContext)
{
return double.TryParse(value.ToString(), out var _) ? ValidationResult.Success : new("输入内容不是数值。");
}
public override bool IsValid(object value)
{
return double.TryParse(value.ToString(), out var _);
}
public override string FormatErrorMessage(string name)
{
return string.Format(CultureInfo.CurrentCulture, base.ErrorMessageString, [name]);
}
}