private void ResetEvents() { // reset event data _lastSpellingEvent = null; _lastReplaceEvent = null; _lastEvent = EventNames.None; }
private void spellChecker_ReplacedWord(object sender, ReplaceWordEventArgs e) { if (ReplacedWord != null) { ReplacedWord(sender, e); } }
public static void OnReplaceWordEvent(object sender, ReplaceWordEventArgs e) { if (ReplaceEventRised != null) { ReplaceEventRised(sender, e); } EventAggregator.OnModelDataChanged(sender, new ModelValueChangedEventArgs()); }
/// <summary> /// 置換が発生した時のイベント /// </summary> private void OnReplaceWordEvent(object sender, ReplaceWordEventArgs arg) { if (arg.fromStr.Length == 0) { return; } if (arg.replaceAll) { var obj = Clipboard.GetText(); Clipboard.SetText(arg.toStr); int idx = 0; while (true) { idx = _writersBFView.Editor.GetText().IndexOf(arg.fromStr, idx); if (idx == -1) { break; } if (arg.toStr.Length == 0) { ReplaceOneWord(arg.fromStr, idx, true); } else { ReplaceOneWord(arg.fromStr, idx, false); } idx += arg.toStr.Length; } Clipboard.SetText(obj); } else { var obj = Clipboard.GetText(); Clipboard.SetText(arg.toStr); var idx = _writersBFView.Editor.GetText().IndexOf(arg.fromStr, arg.headIndex); if (idx == arg.headIndex) { if (arg.toStr.Length == 0) { ReplaceOneWord(arg.fromStr, idx, true); } else { ReplaceOneWord(arg.fromStr, idx, false); } } Clipboard.SetText(obj); } }
private void spellCheck_ReplacedWord(object sender, ReplaceWordEventArgs e) { int start = this.rtfEditor.SelectionStart; int length = this.rtfEditor.SelectionLength; this.rtfEditor.Select(e.TextIndex, e.Word.Length); this.rtfEditor.SelectedText = e.ReplacementWord; if (start > this.rtfEditor.Text.Length) { start = this.rtfEditor.Text.Length; } if ((start + length) > this.rtfEditor.Text.Length) { length = 0; } this.rtfEditor.Select(start, length); }
private void SpellingReplacedWord(object sender, ReplaceWordEventArgs e) { var start = TextBox.SelectionStart; var length = TextBox.SelectionLength; TextBox.Select(e.TextIndex, e.Word.Length); TextBox.SelectedText = e.ReplacementWord; if (start > TextBox.Text.Length) { start = TextBox.Text.Length; } if ((start + length) > TextBox.Text.Length) { length = 0; } TextBox.Select(start, length); }
private void _spelling_ReplacedWord(object sender, ReplaceWordEventArgs e) { switch (this._currentReason) { case CallReasons.TextBox: int start = this._currentTextBox.SelectionStart; int length = this._currentTextBox.SelectionLength; this._currentTextBox.Select(e.TextIndex, e.Word.Length); this._currentTextBox.SelectedText = e.ReplacementWord; if (start > this._currentTextBox.Text.Length) { start = this._currentTextBox.Text.Length; } if ((start + length) > this._currentTextBox.Text.Length) { length = 0; } this._currentTextBox.Select(start, length); break; } }
private void SpellChecker_ReplacedWord(object sender, ReplaceWordEventArgs e) { _lastReplaceEvent = e; _lastEvent = EventNames.ReplacedWord; }