public void Remove(Desktop fallback = null) { // destroy desktop and switch to <fallback> IVirtualDesktop fallbackdesktop; if (fallback == null) { // if no fallback is given use desktop to the left except for desktop 0. Desktop dtToCheck = new Desktop(DesktopManager.GetDesktop(0)); if (this.Equals(dtToCheck)) { // desktop 0: set fallback to second desktop (= "right" desktop) DesktopManager.VirtualDesktopManagerInternal.GetAdjacentDesktop(ivd, 4, out fallbackdesktop); // 4 = RightDirection } else { // set fallback to "left" desktop DesktopManager.VirtualDesktopManagerInternal.GetAdjacentDesktop(ivd, 3, out fallbackdesktop); // 3 = LeftDirection } } else { // set fallback desktop fallbackdesktop = fallback.ivd; } DesktopManager.VirtualDesktopManagerInternal.RemoveDesktop(ivd, fallbackdesktop); }
public static int FromDesktop(Desktop desktop) { // return index of desktop object or -1 if not found return(DesktopManager.GetDesktopIndex(desktop.ivd)); }
public override bool Equals(object obj) { // compare with object Desktop desk = obj as Desktop; return(desk != null && object.ReferenceEquals(this.ivd, desk.ivd)); }