Esempio n. 1
0
        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);
        }
Esempio n. 2
0
 public virtual bool Equals(WindowKey second)
 => GetType() == second.GetType() &&
 (ProcessName, WindowTitle) == (second.ProcessName, second.WindowTitle);
Esempio n. 3
0
 public WindowInfo(WindowKey key, int desktopIndex, WindowPlacement placement)
 {
     Key          = key ?? throw new ArgumentNullException(nameof(key));
     DesktopIndex = desktopIndex >= 0 ? desktopIndex : default;
     Placement    = placement;
 }