Esempio n. 1
0
        private void SaveAllWindows()
        {
            SavedWindows.Clear();

            var windows = _windowService.GetAllActiveWindows();
            foreach (var wnd in windows)
            {
                Rect rect = new Rect();
                if (WindowManagerService.GetWindowRect(wnd, ref rect))
                {
                    SavedWindows.Add(new SavedWindow(wnd, rect, WindowManagerService.IsWindowMaximized(wnd)));
                }
            }
        }
Esempio n. 2
0
 public void SetWindowPosition(IntPtr handle, Rect pos, bool isMax)
 {
     if (IsWindowVisible(handle))
     {
         //Check to see if the window is going to be off the screen, and if so just put it on the left side
         if (pos.Right > System.Windows.SystemParameters.VirtualScreenWidth)
             SetWindowPos(handle, IntPtr.Zero, 0, pos.Top, Math.Abs(pos.Left - pos.Right), Math.Abs(pos.Top - pos.Bottom), SetWindowPosFlags.SWP_SHOWWINDOW);
         else
         {
             SetWindowPos(handle, IntPtr.Zero, pos.Left, pos.Top, Math.Abs(pos.Left - pos.Right), Math.Abs(pos.Top - pos.Bottom), SetWindowPosFlags.SWP_SHOWWINDOW);
             if (isMax)
                 ShowWindow(handle, 3);
         }
     }
 }
Esempio n. 3
0
 public SavedWindow(IntPtr handle, Rect rect, bool isMax)
 {
     WndHandle = handle;
     Rectangle = rect;
     IsMaximized = isMax;
 }
Esempio n. 4
0
 public static extern bool GetWindowRect(IntPtr hwnd, ref Rect rectangle);