예제 #1
0
        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);
                }
            }
        }
예제 #2
0
        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();
        }
예제 #3
0
        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();
            }
        }
예제 #4
0
 public void CopySelectedLinesToClipboard()
 {
     PartTextCanvas.OnCopyToClipboard();
 }
예제 #5
0
 public void Select(params LogLineIndex[] indices)
 {
     PartTextCanvas.SetSelected(indices, SelectMode.Replace);
 }
예제 #6
0
 public void Select(IEnumerable <LogLineIndex> indices)
 {
     PartTextCanvas.SetSelected(indices, SelectMode.Replace);
 }
예제 #7
0
 public void Select(LogLineIndex index)
 {
     PartTextCanvas.SetSelected(index, SelectMode.Replace);
 }
예제 #8
0
 public LogFileSection CalculateVisibleSection()
 {
     return(PartTextCanvas.CalculateVisibleSection());
 }