public void TemporarilyShowWindowOnCurrentWorkspace(Window window) { if (!NativeMethods.IsWindowVisible(window.hWnd)) { CurrentWorkspace.Monitor.temporarilyShownWindows.Add(window.hWnd); window.ShowAsync(); } }
public void AddApplicationToWorkspace(IntPtr hWnd, int toWorkspaceId = 0, int fromWorkspaceId = 0, bool follow = true) { var oldWorkspace = fromWorkspaceId == 0 ? CurrentWorkspace : config.Workspaces[fromWorkspaceId - 1]; var newWorkspace = toWorkspaceId == 0 ? CurrentWorkspace : config.Workspaces[toWorkspaceId - 1]; if (newWorkspace.id != oldWorkspace.id) { Window window; LinkedList<Tuple<Workspace, Window>> list; if (TryGetManagedWindowForWorkspace(hWnd, oldWorkspace, out window, out list) && list.All(t => t.Item1 != newWorkspace)) { var newWindow = new Window(window); newWorkspace.WindowCreated(newWindow); if (!follow && !oldWorkspace.IsWorkspaceVisible && newWorkspace.IsWorkspaceVisible) { newWindow.ShowAsync(); } list.AddFirst(Tuple.Create(newWorkspace, newWindow)); list.Where(t => ++t.Item2.WorkspacesCount == 2).ForEach(t => t.Item1.sharedWindowsCount++); FollowWindow(oldWorkspace, newWorkspace, follow, newWindow); } } }