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"); }
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; }
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"); }
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; } }
public static bool IsRegistered(Window window) { lock(pRegisteredWindows) { return pRegisteredWindows.Any(registered => registered.Handle == window.Handle); } }
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; } }
public static bool RegisterWindow(Window window) { lock(pRegisteredWindows) { if(IsRegistered(window)) { return false; } pRegisteredWindows.Add(window); return true; } }