Removes linter warnings from the PDA module (#17097)

This commit is contained in:
TemporalOroboros
2023-06-07 07:22:19 -07:00
committed by GitHub
parent f96a3a4b79
commit fdbf5b86f2
12 changed files with 150 additions and 107 deletions

View File

@@ -18,20 +18,38 @@ namespace Content.Client.PDA.Ringer
RingerNoteInputs = new[] { RingerNoteOneInput, RingerNoteTwoInput, RingerNoteThreeInput, RingerNoteFourInput };
for (int i = 0; i < RingerNoteInputs.Length; i++)
for (var i = 0; i < RingerNoteInputs.Length; ++i)
{
var input = RingerNoteInputs[i];
int index = i;
input.OnTextChanged += _ => //Prevents unauthorized characters from being entered into the LineEdit
var index = i;
var foo = () => // Prevents unauthorized characters from being entered into the LineEdit
{
input.Text = input.Text.ToUpper();
if (!IsNote(input.Text))
{
input.Text = PreviousNoteInputs[index];
}
else
PreviousNoteInputs[index] = input.Text;
input.CursorPosition = input.Text.Length; //Resets caret position to the end of the typed input
input.RemoveStyleClass("Caution");
};
input.OnFocusExit += _ => foo();
input.OnTextEntered += _ =>
{
foo();
input.CursorPosition = input.Text.Length; // Resets caret position to the end of the typed input
};
input.OnTextChanged += _ =>
{
input.Text = input.Text.ToUpper();
if (!IsNote(input.Text))
input.AddStyleClass("Caution");
else
input.RemoveStyleClass("Caution");
};
}
}