public override WindowPrx[] getRootWindows(Ice.Current context__) { // Check based on pid and that they are ControlType.Window PropertyCondition pidCondition = new PropertyCondition(AutomationElement.ProcessIdProperty, process.pid()); PropertyCondition windowCondition = new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Window); // Check the children of the automation root for windows AutomationElement root = AutomationElement.RootElement; AutomationElementCollection children = root.FindAll(TreeScope.Children, new AndCondition(pidCondition, windowCondition)); Console.WriteLine("Found {0} windows", children.Count); // Register the windows WindowPrx[] windows = new WindowPrx[children.Count]; for (int i = 0; i < children.Count; i++) { windows[i] = new WGWindow(children[i]).Proxy; } return(windows); }
void Awake() { Instance = this; if (mMainCamera == null) { mMainCamera = FindObjectOfType <Camera>(); } fViewHeight = mMainCamera.orthographicSize * 2; fViewWith = Screen.width * mMainCamera.orthographicSize / Screen.height; fTop = fViewHeight / 2; fBottom = -fTop; fRight = fViewWith / 2; fLeft = -fRight; }
private void OnWindowOpened(object src, AutomationEventArgs args) { AutomationElement openedWin = src as AutomationElement; if (openedWin != null) { WGWindow window = new WGWindow(openedWin); openedWindows.Add(window); AutomationEventHandler closeFunction = (object sender, AutomationEventArgs e) => { openedWindows.Remove(window); closedWindows.Add(window); }; Automation.AddAutomationEventHandler( WindowPattern.WindowClosedEvent, openedWin, TreeScope.Element, closeFunction); } }