Exemplo n.º 1
0
 /// <summary>
 ///  Record the last saved zoom level, so that we can return to it if no activity for 750 milliseconds
 /// </summary>
 public void DelayedSaveZoom750Miliseconds()
 {
     if (_timer750Miliseconds?.Running != true)
     {
         _viewportZoomCache = CreateUndoRedoStackItem();
     }
     (_timer750Miliseconds ?? (_timer750Miliseconds = new KeepAliveTimer(TimeSpan.FromMilliseconds(740), () =>
     {
         if (_undoStack.Any() && _viewportZoomCache.Equals(_undoStack.Peek()))
         {
             return;
         }
         _undoStack.Push(_viewportZoomCache);
         _redoStack.Clear();
         _undoZoomCommand?.RaiseCanExecuteChanged();
         _redoZoomCommand?.RaiseCanExecuteChanged();
     }))).Nudge();
 }
Exemplo n.º 2
0
 /// <summary>
 ///     Record the previous zoom level, so that we can return to it.
 /// </summary>
 public void SaveZoom()
 {
     _viewportZoomCache = CreateUndoRedoStackItem();
     if (_undoStack.Any() && _viewportZoomCache.Equals(_undoStack.Peek()))
     {
         return;
     }
     _undoStack.Push(_viewportZoomCache);
     _redoStack.Clear();
     _undoZoomCommand?.RaiseCanExecuteChanged();
     _redoZoomCommand?.RaiseCanExecuteChanged();
 }
Exemplo n.º 3
0
 /// <summary>
 ///     Jump back to the previous zoom level, saving current zoom to Redo Stack.
 /// </summary>
 private void UndoZoom()
 {
     _viewportZoomCache = CreateUndoRedoStackItem();
     if (!_undoStack.Any() || !_viewportZoomCache.Equals(_undoStack.Peek()))
     {
         _redoStack.Push(_viewportZoomCache);
     }
     _viewportZoomCache = _undoStack.Pop();
     this.AnimatedZoomTo(_viewportZoomCache.Zoom, _viewportZoomCache.Rect);
     SetScrollViewerFocus();
     _undoZoomCommand?.RaiseCanExecuteChanged();
     _redoZoomCommand?.RaiseCanExecuteChanged();
 }