Example #1
0
        /// <summary>
        /// Processes the pipeline.
        /// </summary>
        protected override void ProcessRecord()
        {
            // 20131109
            //System.Windows.Automation.AutomationElement result = null;

            /*
             * IUiElement result = null;
             */

            foreach (IUiElement result in InputObject.Select(handle => UiaHelper.GetAutomationElementFromHandle(
                                                                 // this,
                                                                 handle)))
            {
                if (result != null)
                {
                    // 20140312
                    // WriteVerbose(this, "got the control: " + result.Current.Name);
                }
                WriteObject(this, result);
            }

            /*
             * foreach (int handle in InputObject) {
             *  IUiElement result = UiaHelper.GetAutomationElementFromHandle(
             *      this,
             *      handle);
             *  if (result != null) {
             *      WriteVerbose(this, "got the control: " + result.Current.Name);
             *  }
             *  WriteObject(this, result);
             * }
             */
        }
Example #2
0
        // 20131105
        // refactoring

        /*
         * public GetUiaWindowFromHandleCommand()
         * {
         * }
         */
        #endregion Constructor

        /// <summary>
        /// Processes the pipeline.
        /// </summary>
        protected override void ProcessRecord()
        {
            // 20131109
            //System.Windows.Automation.AutomationElement result = null;
            // 20131113
            foreach (IUiElement result in InputObject.Select(handle => UiaHelper.GetAutomationElementFromHandle(
                                                                 // this,
                                                                 handle)))
            {
                if (result != null)
                {
                    WriteVerbose(this, "got the window");
                }
                CurrentData.CurrentWindow = result;
                WriteObject(this, result);
            }

            /*
             * foreach (int handle in this.InputObject) {
             *
             *  // 20131109
             *  //result =
             *  //    UiaHelper.GetAutomationElementFromHandle(
             *  //        this,
             *  //        handle);
             *  IUiElement result =
             *      UiaHelper.GetAutomationElementFromHandle(
             *          this,
             *          handle);
             *
             *  if (result != null) {
             *      this.WriteVerbose(this, "got the window");
             *  }
             *  UIAutomation.CurrentData.CurrentWindow = result;
             *  this.WriteObject(this, result);
             * }
             */
        }