Skip to content
Permalink
Browse files

Better method naming

Better method naming
  • Loading branch information
JasonStein committed Jan 12, 2020
1 parent 1edd031 commit 173d5048deda9cce44321c3c89b6b24c22668c83
@@ -74,7 +74,7 @@ public interface ITextEditor

Encoding GetEncoding();

void CopyPlainTextToWindowsClipboard(TextControlCopyingToClipboardEventArgs args);
void CopySelectedTextToWindowsClipboard(TextControlCopyingToClipboardEventArgs args);

void RevertAllChanges();

@@ -175,7 +175,7 @@ public TextEditor()
TextEditorCore.TextChanging += TextEditorCore_OnTextChanging;
TextEditorCore.SelectionChanged += TextEditorCore_OnSelectionChanged;
TextEditorCore.KeyDown += TextEditorCore_OnKeyDown;
TextEditorCore.CopyPlainTextToWindowsClipboardRequested += TextEditorCore_CopyPlainTextToWindowsClipboardRequested;
TextEditorCore.CopySelectedTextToWindowsClipboardRequested += TextEditorCore_CopySelectedTextToWindowsClipboardRequested;
TextEditorCore.ContextFlyout = new TextEditorContextFlyout(this, TextEditorCore);

// Init shortcuts
@@ -201,7 +201,7 @@ public void Dispose()
TextEditorCore.TextChanging -= TextEditorCore_OnTextChanging;
TextEditorCore.SelectionChanged -= TextEditorCore_OnSelectionChanged;
TextEditorCore.KeyDown -= TextEditorCore_OnKeyDown;
TextEditorCore.CopyPlainTextToWindowsClipboardRequested -= TextEditorCore_CopyPlainTextToWindowsClipboardRequested;
TextEditorCore.CopySelectedTextToWindowsClipboardRequested -= TextEditorCore_CopySelectedTextToWindowsClipboardRequested;

if (TextEditorCore.ContextFlyout is TextEditorContextFlyout contextFlyout)
{
@@ -666,7 +666,7 @@ public void Focus()
}
}

public void CopyPlainTextToWindowsClipboard(TextControlCopyingToClipboardEventArgs args)
public void CopySelectedTextToWindowsClipboard(TextControlCopyingToClipboardEventArgs args)
{
if (args != null)
{
@@ -760,9 +760,9 @@ private void TextEditorCore_OnTextChanging(RichEditBox textEditor, RichEditBoxTe
TextChanging?.Invoke(this, EventArgs.Empty);
}

private void TextEditorCore_CopyPlainTextToWindowsClipboardRequested(object sender, TextControlCopyingToClipboardEventArgs e)
private void TextEditorCore_CopySelectedTextToWindowsClipboardRequested(object sender, TextControlCopyingToClipboardEventArgs e)
{
CopyPlainTextToWindowsClipboard(e);
CopySelectedTextToWindowsClipboard(e);
}

public void ShowFindAndReplaceControl(bool showReplaceBar)
@@ -118,7 +118,7 @@ public MenuFlyoutItem Copy
Key = VirtualKey.C,
IsEnabled = false,
});
_copy.Click += (sender, args) => _textEditor.CopyPlainTextToWindowsClipboard(null);
_copy.Click += (sender, args) => _textEditor.CopySelectedTextToWindowsClipboard(null);
}
return _copy;
}
@@ -26,7 +26,7 @@ public class TextEditorCore : RichEditBox

public event EventHandler<double> FontZoomFactorChanged;

public event EventHandler<TextControlCopyingToClipboardEventArgs> CopyPlainTextToWindowsClipboardRequested;
public event EventHandler<TextControlCopyingToClipboardEventArgs> CopySelectedTextToWindowsClipboardRequested;

private const char RichEditBoxDefaultLineEnding = '\r';

@@ -100,7 +100,7 @@ public TextEditorCore()
VerticalAlignment = VerticalAlignment.Stretch;
HandwritingView.BorderThickness = new Thickness(0);

CopyingToClipboard += TextEditorCore_CopyingToClipboard;
CopyingToClipboard += TextEditorCore_CopySelectedTextToWindowsClipboard;
Paste += TextEditorCore_Paste;
TextChanging += OnTextChanging;
SelectionChanged += OnSelectionChanged;
@@ -122,7 +122,7 @@ public TextEditorCore()
// Unhook events and clear state
public void Dispose()
{
CopyingToClipboard -= TextEditorCore_CopyingToClipboard;
CopyingToClipboard -= TextEditorCore_CopySelectedTextToWindowsClipboard;
Paste -= TextEditorCore_Paste;
TextChanging -= OnTextChanging;
SelectionChanged -= OnSelectionChanged;
@@ -466,9 +466,9 @@ private async void TextEditorCore_Paste(object sender, TextControlPasteEventArgs
await PastePlainTextFromWindowsClipboard(args);
}

private void TextEditorCore_CopyingToClipboard(RichEditBox sender, TextControlCopyingToClipboardEventArgs args)
private void TextEditorCore_CopySelectedTextToWindowsClipboard(RichEditBox sender, TextControlCopyingToClipboardEventArgs args)
{
CopyPlainTextToWindowsClipboardRequested?.Invoke(sender, args);
CopySelectedTextToWindowsClipboardRequested?.Invoke(sender, args);
}

private void SetDefaultTabStopAndLineSpacing(FontFamily font, double fontSize)

0 comments on commit 173d504

Please sign in to comment.
You can’t perform that action at this time.