Skip to content

Commit

Permalink
feature/add comma to InputLimits
Browse files Browse the repository at this point in the history
  • Loading branch information
Mochengvia committed Jul 31, 2024
1 parent 01854c1 commit 79bb3d4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 2 additions & 0 deletions SourceCode/SharedResources/Panuon.WPF.UI/Enums/InputLimits.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,7 @@ public enum InputLimits
MultipleSpaces = 512,
Dash = 1024,
Underline = 2048,
Comma = 4096,
MultipleCommas = 8192,
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -444,16 +444,20 @@ private static void TextBox_PreviewTextInput(object sender, TextCompositionEvent
&& inputChar >= 65 && inputChar <= 90) ||
(inputLimit.HasFlag(InputLimits.Point)
&& inputChar == '.' && !text.Contains(".")) ||
(inputLimit.HasFlag(InputLimits.At)
&& inputChar == '@' && !text.Contains("@")) ||
(inputLimit.HasFlag(InputLimits.MultiplePoints)
&& inputChar == '.') ||
(inputLimit.HasFlag(InputLimits.At)
&& inputChar == '@' && !text.Contains("@")) ||
(inputLimit.HasFlag(InputLimits.MultipleAts)
&& inputChar == '@') ||
(inputLimit.HasFlag(InputLimits.Dash)
(inputLimit.HasFlag(InputLimits.Dash)
&& inputChar == '-') ||
(inputLimit.HasFlag(InputLimits.Underline)
&& inputChar == '_'))
(inputLimit.HasFlag(InputLimits.Underline)
&& inputChar == '_') ||
(inputLimit.HasFlag(InputLimits.Comma)
&& inputChar == ',' && !text.Contains(",")) ||
(inputLimit.HasFlag(InputLimits.MultipleCommas)
&& inputChar == ',') )
{
text += inputChar;
}
Expand Down

0 comments on commit 79bb3d4

Please sign in to comment.