/// Determines the behavior of borders. private void OnPanGestureDetected(object source, PanGestureDetector.DetectedEventArgs e) { if (e == null) { return; } PanGesture panGesture = e.PanGesture; if (panGesture.State == Gesture.StateType.Started && panGesture.Position != null) { direction = BorderWindow.GetDirection(panGesture.Position.X, panGesture.Position.Y); if (direction == Window.BorderDirection.Move) { if (BorderWindow.IsMaximized() == true) { BorderWindow.Maximize(false); } else { BorderWindow.RequestMoveToServer(); } } else if (direction != Window.BorderDirection.None) { OnRequestResize(); BorderWindow.RequestResizeToServer((Window.ResizeDirection)direction); } } else if (panGesture.State == Gesture.StateType.Continuing) { if (direction == Window.BorderDirection.BottomLeft || direction == Window.BorderDirection.BottomRight || direction == Window.BorderDirection.TopLeft || direction == Window.BorderDirection.TopRight) { BorderWindow.WindowSize += new Size2D((int)panGesture.ScreenDisplacement.X, (int)panGesture.ScreenDisplacement.Y); } else if (direction == Window.BorderDirection.Left || direction == Window.BorderDirection.Right) { BorderWindow.WindowSize += new Size2D((int)panGesture.ScreenDisplacement.X, 0); } else if (direction == Window.BorderDirection.Bottom || direction == Window.BorderDirection.Top) { BorderWindow.WindowSize += new Size2D(0, (int)panGesture.ScreenDisplacement.Y); } else if (direction == Window.BorderDirection.Move) { BorderWindow.WindowPosition += new Position2D((int)panGesture.ScreenDisplacement.X, (int)panGesture.ScreenDisplacement.Y); } } else if (panGesture.State == Gesture.StateType.Finished || panGesture.State == Gesture.StateType.Cancelled) { direction = Window.BorderDirection.None; ClearWindowGesture(); } }
/// Determines the behavior of borders. private void OnPanGestureDetected(object source, PanGestureDetector.DetectedEventArgs e) { if (e == null) { return; } PanGesture panGesture = e.PanGesture; if (panGesture.State == Gesture.StateType.Started && panGesture.Position != null) { direction = BorderWindow.GetDirection(panGesture.Position.X, panGesture.Position.Y); if (direction == Window.BorderDirection.Move) { if (BorderWindow.IsMaximized() == true) { BorderWindow.Maximize(false); OnMaximize(false); } else { BorderWindow.RequestMoveToServer(); } } else if (direction != Window.BorderDirection.None && ResizePolicy != Window.BorderResizePolicyType.Fixed) { OnRequestResize(); BorderWindow.RequestResizeToServer((Window.ResizeDirection)direction); } } else if (panGesture.State == Gesture.StateType.Finished || panGesture.State == Gesture.StateType.Cancelled) { direction = Window.BorderDirection.None; ClearWindowGesture(); } }