/// <summary> /// Raises the <see cref="MarginRedraw"/> event. /// </summary> /// <param name="reason">The reason of redrawing.</param> private void RaiseMarginRedraw(MarginDrawReason reason) { var eventHandler = MarginRedraw; if (eventHandler != null) { eventHandler(this, new MarginRedrawEventArgs(_cachedChangedLines, reason)); } }
/// <summary> /// Update difference between lines asynchronously, if needed, and redraw the margin. /// </summary> /// <param name="useCache">Use cached differences.</param> /// <param name="reason">The reason of redrawing.</param> private void Redraw(bool useCache, MarginDrawReason reason) { try { if (_isDisposed || _textView.IsClosed) { return; } if (!_isActivated) { _cachedChangedLines.Clear(); RaiseMarginRedraw(reason); return; } if (useCache) { RaiseMarginRedraw(reason); return; } var task = new Task(() => { lock (_drawLockObject) { try { _cachedChangedLines = GetChangedLineNumbers(); } catch (Exception ex) { RaiseExceptionThrown(ex); return; } Redraw(true, reason); } }); task.Start(); } catch (Exception ex) { RaiseExceptionThrown(ex); } }
/// <summary> /// Initialize a new instance of the <see cref="MarginRedrawEventArgs"/> class. /// </summary> /// <param name="diffLines">Differences between the current document and the version in TFS.</param> /// <param name="reason">The reason of redrawing the margin.</param> public MarginRedrawEventArgs(DiffLinesCollection diffLines, MarginDrawReason reason) { _diffLines = diffLines; _reason = reason; }
/// <summary> /// Raises the <see cref="MarginRedraw"/> event. /// </summary> /// <param name="reason">The reason of redrawing.</param> private void RaiseMarginRedraw(MarginDrawReason reason) { MarginRedraw?.Invoke(this, new MarginRedrawEventArgs(_cachedChangedLines, reason)); }
/// <summary> /// Update difference between lines asynchronously, if needed, and redraw the margin. /// </summary> /// <param name="useCache">Use cached differences.</param> /// <param name="reason">The reason of redrawing.</param> private void Redraw(bool useCache, MarginDrawReason reason) { try { if (_isDisposed || _textView.IsClosed) return; if (!_isActivated) { _cachedChangedLines.Clear(); RaiseMarginRedraw(reason); return; } if (useCache) { RaiseMarginRedraw(reason); return; } var task = new Task(() => { lock (_drawLockObject) { try { _cachedChangedLines = GetChangedLineNumbers(); } catch (Exception ex) { RaiseExceptionThrown(ex); return; } Redraw(true, reason); } }); task.Start(); } catch (Exception ex) { RaiseExceptionThrown(ex); } }
/// <summary> /// Raises the <see cref="MarginRedraw"/> event. /// </summary> /// <param name="reason">The reason of redrawing.</param> private void RaiseMarginRedraw(MarginDrawReason reason) { var eventHandler = MarginRedraw; if (eventHandler != null) eventHandler(this, new MarginRedrawEventArgs(_cachedChangedLines, reason)); }