Exemplo n.º 1
0
        private void PlotWindowPane_SizeChanged(object sender, System.Windows.SizeChangedEventArgs e)
        {
            var unadjustedPixelSize = WpfUnitsConversion.ToPixels(Content as Visual, e.NewSize);

            // If the window gets below a certain minimum size, plot to the minimum size
            // and user will be able to use scrollbars to see the whole thing
            int pixelWidth  = Math.Max((int)unadjustedPixelSize.Width, MinPixelWidth);
            int pixelHeight = Math.Max((int)unadjustedPixelSize.Height, MinPixelHeight);

            // Throttle resize requests since we get a lot of size changed events when the tool window is undocked
            IdleTimeAction.Cancel(this);
            IdleTimeAction.Create(() => {
                PlotContentProvider.DoNotWait(_plotHistory.PlotContentProvider.ResizePlotAsync(pixelWidth, pixelHeight));
            }, 100, this);
        }
Exemplo n.º 2
0
        protected override void OnTextBufferChanged(object sender, TextContentChangedEventArgs e)
        {
            var c           = e.ToTextChange();
            var destructive = _separators.IsDestructiveChange(c.Start, c.OldLength, c.NewLength, c.OldTextProvider, c.NewTextProvider);

            if (destructive)
            {
                // Allow existing command call to complete so we don't yank projections
                // from underneath code that expects text buffer to exist, such as formatter.
                IdleTimeAction.Cancel(GetType());
                IdleTimeAction.Create(UpdateProjections, 0, GetType(), idleTime);
            }
            else
            {
                Blocks.ReflectTextChange(c.Start, c.OldLength, c.NewLength);
                _separators.ReflectTextChange(c.Start, c.OldLength, c.NewLength);
            }
        }
Exemplo n.º 3
0
        protected override void OnTextBufferChanged(object sender, TextContentChangedEventArgs e)
        {
            var changes = e.ConvertToRelative();

            foreach (var c in changes)
            {
                var destructive = _separators.IsDestructiveChange(c.OldStart, c.OldLength, c.NewLength, c.OldText, c.NewText);
                if (destructive)
                {
                    // Allow existing command call to complete so we don't yank projections
                    // from underneath code that expects text buffer to exist, such as formatter.
                    IdleTimeAction.Cancel(this.GetType());
                    IdleTimeAction.Create(() => UpdateProjections(), 0, this.GetType());
                    break;
                }
                else
                {
                    Blocks.ReflectTextChange(c.OldStart, c.OldLength, c.NewLength);
                    _separators.ReflectTextChange(c.OldStart, c.OldLength, c.NewLength);
                }
            }
        }
Exemplo n.º 4
0
 private void UpdateOnIdle()
 {
     IdleTimeAction.Cancel(_idleActionTag);
     IdleTimeAction.Create(Update, 0, _idleActionTag, _idleTime);
 }
Exemplo n.º 5
0
 private void CancelPendingIndexUpdate()
 {
     _updatePending = false;
     IdleTimeAction.Cancel(GetType());
 }
Exemplo n.º 6
0
 private void ScheduleIdleTimeRebuild()
 {
     IdleTimeAction.Cancel(typeof(PackageIndex));
     IdleTimeAction.Create(() => RebuildIndexAsync(CancellationToken.None).DoNotWait(), 100, GetType(), _idleTime);
 }
Exemplo n.º 7
0
 private void ScheduleIdleTimeRebuild()
 {
     IdleTimeAction.Cancel(typeof(PackageIndex));
     IdleTimeAction.Create(() => RebuildIndexAsync().DoNotWait(), 100, typeof(PackageIndex), _shell);
 }
Exemplo n.º 8
0
 private void UpdateOnIdle()
 {
     IdleTimeAction.Cancel(_idleActionTag);
     IdleTimeAction.Create(() => Update(force: true), 0, _idleActionTag, _idleTime);
 }