Ejemplo n.º 1
0
 public void Close()
 {
     Log("Close", "Click \"cross\" button");
     pEveWindow = WindowsMan.UpdateWindow(pEveWindow);
     if(pEveWindow != null)
     {
         // POINT: close button
         Coordinate closePt = new Coordinate(
             new StretchedPoint() {X = 0.988349514563107, Y = 0.0138713745271122});
         pEveWindow.LeftClick(closePt); // click "cross" button
         // TODO: any confirmations?
         pEveWindow.Wait(pStandardWaitTime);
     }
     Log("Close", "Complete");
 }
Ejemplo n.º 2
0
Archivo: Window.cs Proyecto: antgraf/BA
 public static Window FromHandle(IntPtr hwnd)
 {
     WindowRect rect = new WindowRect();
     if(hwnd == IntPtr.Zero || !WinApi.GetWindowRect(hwnd, ref rect))
     {
         return null;
     }
     Window window = new Window
                         {
                             Handle = new WindowHandle() {Handle = hwnd},
                             X = rect.X,
                             Y = rect.Y,
                             Width = rect.Width,
                             Height = rect.Height,
                             Title = GetTitle(hwnd)
                         };
     return window;
 }
Ejemplo n.º 3
0
 public void CleanUp()
 {
     pEveWindow = WindowsMan.UpdateWindow(pEveWindow);
     if(pEveWindow != null)
     {
         Log("CleanUp", "Close window");
         try
         {
             pEveWindow.Close();
         }
     // ReSharper disable EmptyGeneralCatchClause
         catch
     // ReSharper restore EmptyGeneralCatchClause
         {
             // ignore
         }
         pEveWindow = null;
     }
     if(pEveProcess != null)
     {
         if(!pEveProcess.HasExited)
         {
             Log("CleanUp", "Kill process");
             pEveProcess.Kill();
         }
         pEveProcess = null;
     }
     Log("CleanUp", "Complete");
 }
Ejemplo n.º 4
0
 public static bool ModifyWindow(Window window)
 {
     lock(pRegisteredWindows)
     {
         foreach(Window registered in pRegisteredWindows.Where(registered => registered.Handle == window.Handle))
         {
             pRegisteredWindows.Remove(registered);
             pRegisteredWindows.Add(window);
             return true;
         }
         return false;
     }
 }
Ejemplo n.º 5
0
 public static bool IsRegistered(Window window)
 {
     lock(pRegisteredWindows)
     {
         return pRegisteredWindows.Any(registered => registered.Handle == window.Handle);
     }
 }
Ejemplo n.º 6
0
 public static Window UpdateWindow(Window window)
 {
     lock(pRegisteredWindows)
     {
         foreach(Window registered in pRegisteredWindows)
         {
             if(window != null && registered.Handle == window.Handle)
             {
                 Window newwindow = Window.FromHandle(window.Handle.Handle);
                 if(newwindow == null)
                 {
                     return null;
                 }
                 pRegisteredWindows.Remove(registered);
                 pRegisteredWindows.Add(newwindow);
                 return newwindow;
             }
         }
         return null;
     }
 }
Ejemplo n.º 7
0
 public static bool RegisterWindow(Window window)
 {
     lock(pRegisteredWindows)
     {
         if(IsRegistered(window))
         {
             return false;
         }
         pRegisteredWindows.Add(window);
         return true;
     }
 }