/// <summary> /// Called when the docking style Changed /// </summary> /// <param name="dockedTo">New DockedTo Value</param> private void OnDockingChanged(TaskBar.TaskBarEdge dockedTo) { AdjustSlidingBehaviour(Width, Height, dockedTo); }
/// <summary> /// This method docks the window to the defined edge /// </summary> /// <param name="taskBarEdge">Edge to use</param> /// <param name="screen">Active Screen</param> public void Dock(TaskBar.TaskBarEdge taskBarEdge, int screen) { switch (taskBarEdge) { case TaskBar.TaskBarEdge.NotDocked: ResizeDirections = (ResizeDirectionFlags) 255; break; case TaskBar.TaskBarEdge.Left: ResizeDirections = ResizeDirectionFlags.SizeE; break; case TaskBar.TaskBarEdge.Top: ResizeDirections = ResizeDirectionFlags.SizeS; break; case TaskBar.TaskBarEdge.Right: ResizeDirections = ResizeDirectionFlags.SizeW; break; case TaskBar.TaskBarEdge.Bottom: ResizeDirections = ResizeDirectionFlags.SizeN; break; default: throw new ArgumentOutOfRangeException("taskBarEdge"); } // Dock the window docker.Dock(taskBarEdge, screen); }
/// <summary> /// Adjust the sliding behaviour depending on the current docking position /// </summary> /// <param name="width">Window with</param> /// <param name="height">Window height</param> /// <param name="dockedTo">Window docking position</param> private void AdjustSlidingBehaviour(double width, double height, TaskBar.TaskBarEdge dockedTo) { int offset = 0; if (PinStyle == PinStyle.TouchFriendly) offset = 16; switch (dockedTo) { case TaskBar.TaskBarEdge.NotDocked: SlideOutWidth = 0; SlideOutHeight = 0; break; case TaskBar.TaskBarEdge.Left: SlideOutWidth = -(width - HIDE_SIZE - offset); SlideOutHeight = 0; break; case TaskBar.TaskBarEdge.Top: SlideOutWidth = 0; SlideOutHeight = -(height - HIDE_SIZE - offset); break; case TaskBar.TaskBarEdge.Right: SlideOutWidth = width - HIDE_SIZE - offset; SlideOutHeight = 0; break; case TaskBar.TaskBarEdge.Bottom: SlideOutWidth = 0; SlideOutHeight = height - HIDE_SIZE - offset; break; default: throw new ArgumentOutOfRangeException(); } }
public OnTaskBarMovedEventHandlerArgs(TaskBar.TaskBarEdge currentEdge, Point currentPosition) { CurrentEdge = currentEdge; CurrentPosition = currentPosition; }