misc: Code cleanups

This commit is contained in:
Evan Husted
2024-10-19 16:41:04 -05:00
parent 2facad4be3
commit b20613661c
9 changed files with 52 additions and 84 deletions

View File

@ -102,14 +102,8 @@ namespace Ryujinx.Ava.UI.Applet
public bool TextProcessingEnabled
{
get
{
return Volatile.Read(ref _canProcessInput);
}
set
{
Volatile.Write(ref _canProcessInput, value);
}
get => Volatile.Read(ref _canProcessInput);
set => Volatile.Write(ref _canProcessInput, value);
}
public event DynamicTextChangedHandler TextChangedEvent;
@ -135,23 +129,19 @@ namespace Ryujinx.Ava.UI.Applet
});
}
public void SetText(string text, int cursorBegin)
{
public void SetText(string text, int cursorBegin) =>
Dispatcher.UIThread.Post(() =>
{
_hiddenTextBox.Text = text;
_hiddenTextBox.CaretIndex = cursorBegin;
});
}
public void SetText(string text, int cursorBegin, int cursorEnd)
{
public void SetText(string text, int cursorBegin, int cursorEnd) =>
Dispatcher.UIThread.Post(() =>
{
_hiddenTextBox.Text = text;
_hiddenTextBox.SelectionStart = cursorBegin;
_hiddenTextBox.SelectionEnd = cursorEnd;
});
}
}
}