// Prepares events to be subscribed to. // When adding new events, prepare them so that the selection object does not implode when an event fires. public void Prepare() { OnSelect = new SelectionHandler(() => PrepareDelegate("OnSelect")); OnDeselect = new SelectionHandler(() => PrepareDelegate("OnDeselect")); OnRightClick = new RightClickHandler((other) => PrepareDelegate("OnRightClick")); OnInitializeUI = new InitializeUIHandler((com) => PrepareDelegate("OnInitializeUI")); }
private void ContentRichTextBoxMouseUp(object sender, MouseEventArgs e) { int num = contentRichTextBox.GetCharIndexFromPosition(e.Location); char c = contentRichTextBox.GetCharFromPosition(e.Location); int num2 = 1000; int num3 = 0; while (0 <= num) { if (num2 <= num3) { return; } if (0 < num && c == ' ') { num--; c = contentRichTextBox.Text[num]; } else { if (num > contentRichTextBox.TextLength - 1 || c != '\t') { break; } num++; c = contentRichTextBox.Text[num]; } num3++; } if (0 < contentRichTextBox.SelectionLength) { SelectTextHandler?.Invoke(); return; } if (e.Button == MouseButtons.Left) { if (ClickHandler != null) { ClickHandler(num); return; } } else { RightClickHandler?.Invoke(num); } }