BaseDataWindow: Add fields for season
This commit is contained in:
@ -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)) {
|
||||
|
Reference in New Issue
Block a user