public static bool TrySave(WindowKey windowKey, WindowHandle windowHandle, out WindowInfo windowInfo) { var desktop = Desktop.FromWindow(windowHandle); if (desktop == default) { // TODO: Are there any windows whose placement we could save or set? windowInfo = default; return(false); } var windowPlacement = WindowPlacement.GetPlacement(windowHandle); windowInfo = new WindowInfo(windowKey, Desktop.FromDesktop(desktop), windowPlacement); return(true); }
public virtual bool Equals(WindowKey second) => GetType() == second.GetType() && (ProcessName, WindowTitle) == (second.ProcessName, second.WindowTitle);
public WindowInfo(WindowKey key, int desktopIndex, WindowPlacement placement) { Key = key ?? throw new ArgumentNullException(nameof(key)); DesktopIndex = desktopIndex >= 0 ? desktopIndex : default; Placement = placement; }