private void OnLogFileChanged(ILogSource oldValue, ILogSource newValue) { oldValue?.RemoveListener(this); PartTextCanvas.LogSource = newValue; if (newValue != null) { newValue.AddListener(this, TimeSpan.FromMilliseconds(value: 100), maximumLineCount: 10000); _maxLineWidth = (int)Math.Ceiling(_textSettings.EstimateWidthUpperLimit(newValue.GetProperty(TextProperties.MaxCharactersInLine))); UpdateScrollViewerRegions(); PartTextCanvas.DetermineVerticalOffset(); PartTextCanvas.UpdateVisibleSection(); PartTextCanvas.UpdateVisibleLines(); } else { _maxLineWidth = 0; TextCanvasOnVisibleLinesChanged(); UpdateScrollViewerRegions(); } MatchScrollbarValueToCurrentLine(); }
/// <inheritdoc /> public void RemoveListener(ILogSourceListener listener) { try { _logSource.RemoveListener(listener); } catch (Exception e) { BlameExceptionOnPlugin(e); } }
/// <inheritdoc /> protected override void DisposeAdditional() { _source.RemoveListener(this); // https://github.com/Kittyfisto/Tailviewer/issues/282 lock (_indices) { _indices.Clear(); _indices.Capacity = 0; } _properties.Clear(); _propertiesBuffer.Clear(); }
public void RemoveListener(ILogSourceListener listener) { ListenerProxy proxy; lock (_syncRoot) { if (!_listeners.TryGetValue(listener, out proxy)) { return; } } _actualSource.RemoveListener(proxy); }
public void Dispose() { _logSource.RemoveListener(this); _scheduler.StopPeriodic(_task); lock (_syncRoot) { _matches.Clear(); _matches.Capacity = 0; _matchesBuffer.Clear(); _matchesBuffer.Capacity = 0; _logLinesArray = null; _pendingModifications.Clear(); } _isDisposed = true; }
/// <inheritdoc /> protected override void DisposeAdditional() { _source.RemoveListener(this); base.DisposeAdditional(); }