BaseDataWindow: Add fields for season

This commit is contained in:
2023-11-05 12:20:59 +01:00
parent 6435a649b4
commit 7fe2ea76c3
12 changed files with 244 additions and 57 deletions

View File

@ -63,13 +63,15 @@ namespace Elwig.Helpers {
return CheckDecimal(input, required, -1, -1);
}
public static ValidationResult CheckDecimal(TextBox input, bool required, int maxLen, int maxDecimal) {
public static ValidationResult CheckDecimal(TextBox input, bool required, int maxLen, int maxDecimal, bool allowMinus = false) {
string text = "";
int pos = input.CaretIndex;
int v1 = 0, v2 = -1;
for (int i = 0; i < input.Text.Length; i++) {
char ch = input.Text[i];
if (char.IsAsciiDigit(ch)) {
if (ch == '-' && i == 0 && allowMinus) {
text += ch;
} else if (char.IsAsciiDigit(ch)) {
if (v2 == -1 && (maxLen == -1 || v1 < maxLen)) {
text += ch; v1++;
} else if (v2 != -1 && (maxDecimal == -1 || v2 < maxDecimal)) {