public void OnTimer(object sender, EventArgs args) { if (Interlocked.Exchange(ref _pendingModificationsCount, value: 0) > 0) { try { PartTextCanvas.DetermineVerticalOffset(); PartTextCanvas.CurrentlyVisibleSection = CalculateVisibleSection(); UpdateScrollViewerRegions(); ScrollToBottomIfRequired(); PartTextCanvas.UpdateVisibleLines(); PartTextCanvas.OnMouseMove(); } catch (Exception e) { Log.ErrorFormat("Caught unexpected exception while updating: {0}", e); // Common sense says that functions which fail once work when tried again. // The same goes for this control: If drawing fails then it's conceivable // that it will work when we try again in a few milliseconds... Interlocked.Increment(ref _pendingModificationsCount); } } }
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(); }
private void ChangeTextSettings(TextSettings textSettings, TextBrushes textBrushes) { _textSettings = textSettings; _textBrushes = textBrushes; _verticalScrollBar.SetValue(RangeBase.SmallChangeProperty, _textSettings.LineHeight); _verticalScrollBar.SetValue(RangeBase.LargeChangeProperty, 10 * _textSettings.LineHeight); _horizontalScrollBar.SetValue(RangeBase.SmallChangeProperty, _textSettings.LineHeight); _horizontalScrollBar.SetValue(RangeBase.LargeChangeProperty, 10 * _textSettings.LineHeight); foreach (var columnPresenter in _columnPresenters.Values) { columnPresenter.TextSettings = _textSettings; } PartTextCanvas.ChangeTextSettings(_textSettings, _textBrushes); if (LogSource != null) { TextCanvasOnVisibleLinesChanged(); } }
public void CopySelectedLinesToClipboard() { PartTextCanvas.OnCopyToClipboard(); }
public void Select(params LogLineIndex[] indices) { PartTextCanvas.SetSelected(indices, SelectMode.Replace); }
public void Select(IEnumerable <LogLineIndex> indices) { PartTextCanvas.SetSelected(indices, SelectMode.Replace); }
public void Select(LogLineIndex index) { PartTextCanvas.SetSelected(index, SelectMode.Replace); }
public LogFileSection CalculateVisibleSection() { return(PartTextCanvas.CalculateVisibleSection()); }