Add event-driven quick action dispatch
This commit is contained in:
@@ -152,8 +152,7 @@
|
||||
Background="{DynamicResource BackgroundColor.DetailsPage.Widget.Title}"
|
||||
SpellCheck.IsEnabled="True"
|
||||
SelectionChanged="NotepadRichTextBox_SelectionChanged"
|
||||
IsVisibleChanged="NotepadRichTextBox_IsVisibleChanged"
|
||||
GotKeyboardFocus="NotepadRichTextBox_GotKeyboardFocus">
|
||||
IsVisibleChanged="NotepadRichTextBox_IsVisibleChanged">
|
||||
<RichTextBox.Resources>
|
||||
<Style TargetType="Border">
|
||||
<Setter Property="CornerRadius"
|
||||
|
||||
@@ -155,29 +155,6 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
|
||||
#region Methods
|
||||
|
||||
|
||||
private void NotepadRichTextBox_GotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_dataProvider is null)
|
||||
return;
|
||||
|
||||
if (_dataProvider?.CaseNotes?.Parent is RichTextBox parentBox)
|
||||
parentBox.Document = new FlowDocument();
|
||||
|
||||
if (!(sender is RichTextBox senderElement))
|
||||
return;
|
||||
|
||||
senderElement.Document = _dataProvider.CaseNotes;
|
||||
senderElement.CaretPosition = senderElement.CaretPosition.DocumentEnd;
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
private async void NotepadRichTextBox_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
try
|
||||
@@ -185,11 +162,15 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
if (!(e.NewValue is bool isVisible && isVisible))
|
||||
return;
|
||||
|
||||
await Task.Delay(50);
|
||||
NotepadRichTextBox.Focus();
|
||||
Keyboard.Focus(NotepadRichTextBox);
|
||||
if (!(sender is RichTextBox senderElement))
|
||||
return;
|
||||
|
||||
NotepadRichTextBox_GotKeyboardFocus(sender, null);
|
||||
senderElement.Document = _dataProvider.CaseNotes;
|
||||
senderElement.CaretPosition = senderElement.CaretPosition.DocumentEnd;
|
||||
|
||||
await Task.Delay(50);
|
||||
senderElement.Focus();
|
||||
Keyboard.Focus(senderElement);
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user