void SlideOut(object parameter, ActionQueueCallback callback) { Log.DebugFormat("SlideOut {0}", DockPosition); Position position = CalculateSlideOutPosition(); SlideOut(DockPosition, callback); }
void SlideInMinimize(object parameter, ActionQueueCallback completeCallback) { Position position = CalculateSlideInPosition(); DockPosition dockPosition = DockPosition; if (parameter is DockPosition) { dockPosition = (DockPosition)parameter; } SlideInMinimize(dockPosition, completeCallback); }
void SlideOut(DockPosition dockPosition, ActionQueueCallback completeCallback) { //ClearAnimations(); DoubleAnimation widthAnimation, heightAnimation, leftAnimation, topAnimation; Position position = CalculateSlideOutPosition(dockPosition); // No point doing the sliding animation when the size of the window hasn't actually changed. if (!HasPositionChanged(position)) { Log.Debug("Window size has not changed significantly, cancelling sliding animation"); completeCallback(); return; } Storyboard storyBoard = new Storyboard(); storyBoard.Duration = SlideDuration; storyBoard.Completed += (sender, e) => { Log.DebugFormat("SlideOut Finished, MainGrid {0}", GetMainGridPosition()); //HandleFullScreenRdpApps(); completeCallback(); }; switch (dockPosition.Selected) { case DockEdge.Left: widthAnimation = CreateGridDoubleAnimation(Grid.WidthProperty); widthAnimation.To = position.Width; storyBoard.Children.Add(widthAnimation); _mainGrid.Height = position.Height; break; case DockEdge.Right: widthAnimation = CreateGridDoubleAnimation(Grid.WidthProperty); widthAnimation.To = position.Width; storyBoard.Children.Add(widthAnimation); leftAnimation = CreateGridDoubleAnimation(Canvas.LeftProperty); leftAnimation.From = position.Width; leftAnimation.To = 0; storyBoard.Children.Add(leftAnimation); _mainGrid.Height = position.Height; break; case DockEdge.Top: heightAnimation = CreateGridDoubleAnimation(Grid.HeightProperty); heightAnimation.To = position.Height; storyBoard.Children.Add(heightAnimation); _mainGrid.Width = position.Width; break; case DockEdge.Bottom: heightAnimation = CreateGridDoubleAnimation(Grid.HeightProperty); heightAnimation.To = position.Height; storyBoard.Children.Add(heightAnimation); topAnimation = CreateGridDoubleAnimation(Canvas.TopProperty); topAnimation.From = position.Height; topAnimation.To = 0; storyBoard.Children.Add(topAnimation); _mainGrid.Width = position.Width; break; } storyBoard.Freeze(); Log.DebugFormat("Grid before appbar resize {0}", GetMainGridPosition()); _appbar.Resize(ref position); Log.DebugFormat("Grid after appbar resize {0}", GetMainGridPosition()); DispatcherHelper.UIDispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, new Action(() => { Log.DebugFormat("Grid before window resize {0}", GetMainGridPosition()); Top = position.Top; Left = position.Left; Width = position.Width; Height = position.Height; Log.DebugFormat("Grid after window resize {0}", GetMainGridPosition()); storyBoard.Begin(_mainGrid); })); }
void SlideInResize(object parameter, ActionQueueCallback callback) { Log.DebugFormat("SlideInResize {0}", DockPosition); Position position = CalculateSlideOutPosition(); SlideInResize(DockPosition, callback); }
void SlideInMinimize(DockPosition dockPosition, ActionQueueCallback completeCallback) { Log.DebugFormat("SlideInMinimize {0}", dockPosition); //ClearAnimations(); DoubleAnimation widthAnimation, heightAnimation, leftAnimation, topAnimation; Position position = CalculateSlideInPosition(dockPosition); // No point doing the sliding animation when the size of the window hasn't actually changed. if (!HasPositionChanged(position)) { Log.Debug("Window size has not changed significantly, cancelling sliding animation"); completeCallback(); return; } Storyboard storyBoard = new Storyboard(); storyBoard.Duration = SlideDuration; storyBoard.Completed += (sender, e) => { Position minimizedPosition = new Position(); _appbar.Resize(ref minimizedPosition); DispatcherHelper.UIDispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => { Left = position.Left; Top = position.Top; Width = position.Width; Height = position.Height; Log.DebugFormat("SlideInMinimize Finished, MainGrid {0}", GetMainGridPosition()); completeCallback(); })); }; switch (dockPosition.Selected) { case DockEdge.Left: widthAnimation = CreateGridDoubleAnimation(Grid.WidthProperty); widthAnimation.To = 0; storyBoard.Children.Add(widthAnimation); break; case DockEdge.Right: widthAnimation = CreateGridDoubleAnimation(Grid.WidthProperty); widthAnimation.To = 0; storyBoard.Children.Add(widthAnimation); leftAnimation = CreateGridDoubleAnimation(Canvas.LeftProperty); leftAnimation.To = position.Width; storyBoard.Children.Add(leftAnimation); break; case DockEdge.Top: heightAnimation = CreateGridDoubleAnimation(Grid.HeightProperty); heightAnimation.To = 0; storyBoard.Children.Add(heightAnimation); break; case DockEdge.Bottom: heightAnimation = CreateGridDoubleAnimation(Grid.HeightProperty); heightAnimation.To = 0; storyBoard.Children.Add(heightAnimation); topAnimation = CreateGridDoubleAnimation(Canvas.TopProperty); heightAnimation.To = position.Height; storyBoard.Children.Add(topAnimation); break; } storyBoard.Freeze(); storyBoard.Begin(_mainGrid); }
void SlideInMinimize(object parameter, ActionQueueCallback completeCallback) { Position position = CalculateSlideInPosition(); DockPosition dockPosition = DockPosition; if (parameter is DockPosition) dockPosition = (DockPosition)parameter; SlideInMinimize(dockPosition, completeCallback); }