当前位置: 首页>>代码示例>>C#>>正文


C# IUiElement.GetCurrentPattern方法代码示例

本文整理汇总了C#中IUiElement.GetCurrentPattern方法的典型用法代码示例。如果您正苦于以下问题:C# IUiElement.GetCurrentPattern方法的具体用法?C# IUiElement.GetCurrentPattern怎么用?C# IUiElement.GetCurrentPattern使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IUiElement的用法示例。


在下文中一共展示了IUiElement.GetCurrentPattern方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CallInvokePattern

        // 20130109
        //if (this.PassThru && CheckControl(this)) {

        // 20130105

        //this.RightClick,
        //this.MidClick,
        //this.Alt,
        //this.Shift,
        //this.Ctrl,
        //this.DoubleClick,
        //this.X,
        //this.Y);
        //if (this.PassThru) {
        // 20130109
        //if (this.PassThru && CheckControl(this)) {
        // 20130105
        //this.WriteObject(this, this.InputObject);

        //this.RightClick,
        //this.MidClick,
        //this.Alt,
        //this.Shift,
        //this.Ctrl,
        //this.DoubleClick,
        //this.X,
        //this.Y);
        //if (this.PassThru) {
        // 20130109
        //if (this.PassThru && CheckControl(this)) {
        // 20131109
        //internal void InvokeInvoke(System.Windows.Automation.AutomationElement _control, AutomationElement inputObject)
        internal void CallInvokePattern(PatternCmdletBase cmdlet, IUiElement control, IUiElement inputObject)
        {
            try {
                // IInvokePattern invokePattern = control.GetInvokePattern();
                // IInvokePattern invokePattern = control.GetCurrentPattern<IInvokePattern, InvokePattern>();
                IInvokePattern invokePattern = control.GetCurrentPattern<IInvokePattern>(classic.InvokePattern.Pattern);
                if (invokePattern != null) {
                    invokePattern.Invoke();
                    
                    if (PassThru && null != (inputObject as IUiElement)) {
                        WriteObject(this, inputObject);
                    } else {
                        WriteObject(this, true);
                    }
                } else {
                    if (Preferences.PerformWin32ClickOnFail) {
                        
                        // 20131230
                        // ClickControl(this, control, false, false, false, false, false, false, false, 0, 0,
                        //              0);
                        ClickControl(
                            this,
                            control,
                            new ClickSettings());
                        
                        if (PassThru && null != (inputObject as IUiElement)) {
                            WriteObject(this, inputObject);
                        } else {
                            WriteObject(this, true);
                        }
                    } else {
                        WriteVerbose(this, "couldn't get InvokePattern");
                        WriteObject(this, false);
                    }
                }
            } catch (Exception eInvokePatternException) {
                
                WriteVerbose(this, eInvokePatternException.Message + "\r\n" + eInvokePatternException.GetType().Name);
                if (Preferences.PerformWin32ClickOnFail &&
                    "ElementNotAvailableException" != eInvokePatternException.GetType().Name) {
                    
                    // 20131230
                    // ClickControl(this, control, false, false, false, false, false, false, false, 0, 0,
                    //              0);
                    ClickControl(
                        this,
                        control,
                        new ClickSettings());

                    if (PassThru && null != (inputObject as IUiElement)) {
                        WriteObject(this, inputObject);
                    } else {
                        WriteObject(this, true);
                    }
                } else {

                }
                // no reaction
            }
        }
开发者ID:apetrovskiy,项目名称:STUPS,代码行数:92,代码来源:PatternCmdletBase.cs

示例2: CallGridItemPattern

        //gridItemPattern.Current.

        // not yet implemented
        // GridItemPattern giPattern =
        // _control.GetCurrentPattern(classic.GridItemPattern.Pattern)
        // as GridItemPattern;
        // 
        // giPattern.Current.
        internal void CallGridItemPattern(PatternCmdletBase cmdlet, IUiElement control, IUiElement inputObject)
        {
            try {
                // 20131208
                // GridItemPattern gridItemPattern = control.GetCurrentPattern(classic.GridItemPattern.Pattern) as GridItemPattern;
                // GridItemPattern gridItemPattern = control.GetCurrentPattern<IGridItemPattern, GridItemPattern>(classic.GridItemPattern.Pattern) as GridItemPattern;
                IGridItemPattern gridItemPattern = control.GetCurrentPattern<IGridItemPattern>(classic.GridItemPattern.Pattern);
                if (gridItemPattern != null) {
                    //gridItemPattern.Current.
                }
            } catch (Exception eGridItemPatternException) {
            }
        }
开发者ID:apetrovskiy,项目名称:STUPS,代码行数:21,代码来源:PatternCmdletBase.cs

示例3: CallRangeValuePatternForSet

 internal void CallRangeValuePatternForSet(PatternCmdletBase cmdlet, IUiElement control, IUiElement inputObject)
 {
     try {
         // 20131208
         // RangeValuePattern rvPatternSet = control.GetCurrentPattern(classic.RangeValuePattern.Pattern) as RangeValuePattern;
         // RangeValuePattern rvPatternSet = control.GetCurrentPattern<IRangeValuePattern, RangeValuePattern>(classic.RangeValuePattern.Pattern) as RangeValuePattern;
         IRangeValuePattern rvPatternSet = control.GetCurrentPattern<IRangeValuePattern>(classic.RangeValuePattern.Pattern);
         if (rvPatternSet == null) return;
         try {
             rvPatternSet.SetValue(((InvokeUiaRangeValuePatternSetCommand)Child).Value);
             
             if (PassThru && null != (inputObject as IUiElement)) {
                 WriteObject(this, inputObject);
             } else {
                 WriteObject(this, true);
             }
         } catch {
             WriteObject(this, false);
         }
     } catch (Exception) {
     }
 }
开发者ID:apetrovskiy,项目名称:STUPS,代码行数:22,代码来源:PatternCmdletBase.cs

示例4: CallRangeValuePatternForGet

 internal void CallRangeValuePatternForGet(PatternCmdletBase cmdlet, IUiElement control, IUiElement inputObject)
 {
     try {
         // 20131208
         // RangeValuePattern rvPatternGet = control.GetCurrentPattern(classic.RangeValuePattern.Pattern) as RangeValuePattern;
         // RangeValuePattern rvPatternGet = control.GetCurrentPattern<IRangeValuePattern, RangeValuePattern>(classic.RangeValuePattern.Pattern) as RangeValuePattern;
         IRangeValuePattern rvPatternGet = control.GetCurrentPattern<IRangeValuePattern>(classic.RangeValuePattern.Pattern);
         if (rvPatternGet != null) {
             WriteObject(this, rvPatternGet.Current.Value);
         }
     } catch (Exception) {
     }
 }
开发者ID:apetrovskiy,项目名称:STUPS,代码行数:13,代码来源:PatternCmdletBase.cs

示例5: CallSelectionItemPattern

 internal void CallSelectionItemPattern(PatternCmdletBase cmdlet, IUiElement control, IUiElement inputObject)
 {
     try {
         // ISelectionItemPattern selItemPattern = control.GetSelectionItemPattern();
         // ISelectionItemPattern selItemPattern = control.GetCurrentPattern<ISelectionItemPattern, SelectionItemPattern>();
         ISelectionItemPattern selItemPattern = control.GetCurrentPattern<ISelectionItemPattern>(classic.SelectionItemPattern.Pattern);
         if (selItemPattern != null) {
             selItemPattern.Select();
             
             if (PassThru && null != (inputObject as IUiElement)) {
                 try {
                     // 20131208
                     // SelectionPattern selPatternTemp = control.GetCurrentPattern(classic.SelectionPattern.Pattern) as SelectionPattern;
                     // SelectionPattern selPatternTemp = control.GetCurrentPattern<ISelectionItemPattern, SelectionItemPattern>(classic.SelectionPattern.Pattern) as SelectionPattern;
                     ISelectionPattern selPatternTemp = control.GetCurrentPattern<ISelectionPattern>(classic.SelectionPattern.Pattern);
                     if (selPatternTemp != null) {
                         // 20131208
                         // IUiElement[] selection = AutomationFactory.GetUiEltCollection(selPatternTemp.Current.GetSelection()).Cast<UiElement>().ToArray();
                         IUiElement[] selection = AutomationFactory.GetUiEltCollection(selPatternTemp.Current.GetSelection()).ToArray();
                         WriteObject(this, selection);
                     } else {
                         WriteObject(this, true);
                     }
                 } catch {
                 }
             } else {
                 WriteObject(this, true);
             }
         } else {
             WriteVerbose(this, "couldn't get SelectionItemPattern");
             WriteObject(this, false);
         }
     } catch (Exception) {
     }
 }
开发者ID:apetrovskiy,项目名称:STUPS,代码行数:35,代码来源:PatternCmdletBase.cs

示例6: CallScrollPattern

        //                                if (((InvokeUiaScrollPatternCommand)this).Large) {
        //                                    System.Windows.Automation.ScrollAmount.LargeIncrement = (System.Windows.Automation.ScrollAmount)10;
        //                                } else {
        //                                    System.Windows.Automation.ScrollAmount.SmallIncrement = (System.Windows.Automation.ScrollAmount)1;
        //                                }
        // 20130109
        //if (this.PassThru && CheckControl(this)) {
        internal void CallScrollPattern(PatternCmdletBase cmdlet, IUiElement control, IUiElement inputObject)
        {
            try {
                // 20131208
                // ScrollPattern scPattern = control.GetCurrentPattern(classic.ScrollPattern.Pattern) as ScrollPattern;
                // ScrollPattern scPattern = control.GetCurrentPattern<IScrollPattern, ScrollPattern>(classic.ScrollPattern.Pattern) as ScrollPattern;
                // IScrollPattern scPattern = control.GetScrollPattern();
                // IScrollPattern scPattern = control.GetCurrentPattern<IScrollPattern, ScrollPattern>();
                IScrollPattern scPattern = control.GetCurrentPattern<IScrollPattern>(classic.ScrollPattern.Pattern);
                if (scPattern == null) return;
                try {
                    bool horizontal = ((InvokeUiaScrollPatternCommand)this).Horizontal;
                    bool vertical = ((InvokeUiaScrollPatternCommand)this).Vertical;
                    int horPercent = ((InvokeUiaScrollPatternCommand)this).HorizontalPercent;
                    int verPercent = ((InvokeUiaScrollPatternCommand)this).VerticalPercent;
                    classic.ScrollAmount horAmount = classic.ScrollAmount.NoAmount;
                    classic.ScrollAmount verAmount = classic.ScrollAmount.NoAmount;
                    horAmount = (classic.ScrollAmount)((InvokeUiaScrollPatternCommand)this).HorizontalAmount;
                    verAmount = (classic.ScrollAmount)((InvokeUiaScrollPatternCommand)this).VerticalAmount;
                    // for refactoring
                    //System.Windows.Automation.ScrollAmount horAmount, verAmount = System.Windows.Automation.ScrollAmount.NoAmount;
                    //horAmount = (System.Windows.Automation.ScrollAmount)((InvokeUiaScrollPatternCommand)this).HorizontalAmount;
                    //verAmount = (System.Windows.Automation.ScrollAmount)((InvokeUiaScrollPatternCommand)this).VerticalAmount;
                    if ((horPercent + verPercent) > 0) {
                        scPattern.SetScrollPercent(horPercent, verPercent);
                    }
                    if (horizontal) {
                        if (horAmount > 0) {
                            scPattern.ScrollHorizontal(horAmount);
                        }
                    }
                    if (vertical) {
                        if (verAmount > 0) {
                            scPattern.ScrollVertical(verAmount);
                        }
                    }
                    
                    if (PassThru && null != (inputObject as IUiElement)) {
                        WriteObject(this, inputObject);
                    } else {
                        WriteObject(this, true);
                    }
                } catch {
                    WriteObject(this, false);
                }

                /*
                if (scPattern != null) {
                    try {
                        bool horizontal = ((InvokeUiaScrollPatternCommand)this).Horizontal;
                        bool vertical = ((InvokeUiaScrollPatternCommand)this).Vertical;
                        int horPercent = ((InvokeUiaScrollPatternCommand)this).HorizontalPercent;
                        int verPercent = ((InvokeUiaScrollPatternCommand)this).VerticalPercent;
                        System.Windows.Automation.ScrollAmount horAmount, verAmount = System.Windows.Automation.ScrollAmount.NoAmount;
                        horAmount = (System.Windows.Automation.ScrollAmount)((InvokeUiaScrollPatternCommand)this).HorizontalAmount;
                        verAmount = (System.Windows.Automation.ScrollAmount)((InvokeUiaScrollPatternCommand)this).VerticalAmount;
                        if ((horPercent + verPercent) > 0) {
                            scPattern.SetScrollPercent(horPercent, verPercent);
                        }
                        if (horizontal) {
                            if (horAmount > 0) {
                                scPattern.ScrollHorizontal(horAmount);
                            }
                        }
                        if (vertical) {
                            if (verAmount > 0) {
                                scPattern.ScrollVertical(verAmount);
                            }
                        }
                        if (this.PassThru && null != (inputObject as AutomationElement)) {
                            WriteObject(this, inputObject);
                        } else {
                            WriteObject(this, true);
                        }
                    } catch {
                        WriteObject(this, false);
                    }
                }
                */
            } catch {
                WriteObject(this, false);
            }
        }
开发者ID:apetrovskiy,项目名称:STUPS,代码行数:90,代码来源:PatternCmdletBase.cs

示例7: CallSelectedItemPattern

 internal void CallSelectedItemPattern(PatternCmdletBase cmdlet, IUiElement control, IUiElement inputObject)
 {
     try {
         // ISelectionItemPattern selItemPattern = control.GetSelectionItemPattern();
         // ISelectionItemPattern selItemPattern = control.GetCurrentPattern<ISelectionItemPattern, SelectionItemPattern>();
         ISelectionItemPattern selItemPattern = control.GetCurrentPattern<ISelectionItemPattern>(classic.SelectionItemPattern.Pattern);
         if (selItemPattern == null) return;
         if (selItemPattern.Current.IsSelected) {
             WriteObject(this, InputObject);
         }
     } catch (Exception) {
     }
 }
开发者ID:apetrovskiy,项目名称:STUPS,代码行数:13,代码来源:PatternCmdletBase.cs

示例8: CallSelectionItemPatternForState

 internal void CallSelectionItemPatternForState(PatternCmdletBase cmdlet, IUiElement control, IUiElement inputObject)
 {
     try {
         // ISelectionItemPattern selItemPattern = control.GetSelectionItemPattern();
         // ISelectionItemPattern selItemPattern = control.GetCurrentPattern<ISelectionItemPattern, SelectionItemPattern>();
         ISelectionItemPattern selItemPattern = control.GetCurrentPattern<ISelectionItemPattern>(classic.SelectionItemPattern.Pattern);
         if (selItemPattern != null) {
             WriteObject(this, selItemPattern.Current.IsSelected);
         } else {
             WriteVerbose(this, "couldn't get SelectionItemPattern");
             WriteObject(this, false);
         }
     } catch (Exception) {
     }
 }
开发者ID:apetrovskiy,项目名称:STUPS,代码行数:15,代码来源:PatternCmdletBase.cs

示例9: CallTableItemPattern

 internal void CallTableItemPattern(PatternCmdletBase cmdlet, IUiElement control, IUiElement inputObject)
 {
     try {
         // 20131208
         // TableItemPattern tableItemPattern = control.GetCurrentPattern(classic.TableItemPattern.Pattern) as TableItemPattern;
         // TableItemPattern tableItemPattern = control.GetCurrentPattern<ITableItemPattern, TableItemPattern>(classic.TableItemPattern.Pattern) as TableItemPattern;
         ITableItemPattern tableItemPattern = control.GetCurrentPattern<ITableItemPattern>(classic.TableItemPattern.Pattern);
         if (tableItemPattern != null) {
             //tableItemPattern.Current.
         }
     } catch (Exception) {
     }
 }
开发者ID:apetrovskiy,项目名称:STUPS,代码行数:13,代码来源:PatternCmdletBase.cs

示例10: CallSelectionPattern

 // 20130108
 // deleted as useless
 //                            if (this.PassThru && CheckControl(this)) {
 //                                WriteObject(this, inputObject);
 //                            //} else {
 //                            // WriteObject(this, true);
 //                            }
 //writev
 internal void CallSelectionPattern(PatternCmdletBase cmdlet, IUiElement control, IUiElement inputObject)
 {
     try {
         // ISelectionPattern selPattern = control.GetSelectionPattern();
         // ISelectionPattern selPattern = control.GetCurrentPattern<ISelectionPattern, SelectionPattern>();
         ISelectionPattern selPattern = control.GetCurrentPattern<ISelectionPattern>(classic.SelectionPattern.Pattern);
         if (selPattern != null) {
             IUiElement[] selection = AutomationFactory.GetUiEltCollection(selPattern.Current.GetSelection()).Cast<UiElement>().ToArray();
             WriteObject(this, selection);
         } else {
             WriteVerbose(this, "couldn't get SelectionPattern");
             WriteObject(this, false);
         }
     } catch (Exception) {
     }
 }
开发者ID:apetrovskiy,项目名称:STUPS,代码行数:24,代码来源:PatternCmdletBase.cs

示例11: CallTextPatternForGet

 internal void CallTextPatternForGet(PatternCmdletBase cmdlet, IUiElement control, IUiElement inputObject)
 {
     try {
         // 20131208
         // TextPattern textPatternGet = control.GetCurrentPattern(classic.TextPattern.Pattern) as TextPattern;
         // TextPattern textPatternGet = control.GetCurrentPattern<ITextPattern, TextPattern>(classic.TextPattern.Pattern) as TextPattern;
         ITextPattern textPatternGet = control.GetCurrentPattern<ITextPattern>(classic.TextPattern.Pattern);
         if (textPatternGet != null) {
             int textLength = ((InvokeUiaTextPatternGetCommand)this).TextLength;
             if (((InvokeUiaTextPatternGetCommand)this).VisibleArea)
             {
                 classic.Text.TextPatternRange[] textRanges = textPatternGet.GetVisibleRanges();
                 foreach (classic.Text.TextPatternRange tpr in textRanges)
                 {
                     WriteObject(this, tpr);
                 }
             }
             else {
                 string resultText = textPatternGet.DocumentRange.GetText(textLength);
                 WriteObject(this, resultText);
             }
         } else {
             WriteVerbose(this, "couldn't get TextPattern");
             WriteObject(this, false);
         }
     } catch (Exception) {
     }
 }
开发者ID:apetrovskiy,项目名称:STUPS,代码行数:28,代码来源:PatternCmdletBase.cs

示例12: CallTextPatternForSet

 internal void CallTextPatternForSet(PatternCmdletBase cmdlet, IUiElement control, IUiElement inputObject)
 {
     try {
         // 20131208
         // TextPattern textPatternSet = control.GetCurrentPattern(classic.TextPattern.Pattern) as TextPattern;
         // TextPattern textPatternSet = control.GetCurrentPattern<ITextPattern, TextPattern>(classic.TextPattern.Pattern) as TextPattern;
         ITextPattern textPatternSet = control.GetCurrentPattern<ITextPattern>(classic.TextPattern.Pattern);
         if (textPatternSet != null) {
             textPatternSet.GetSelection().SetValue(((InvokeUiaTextPatternSetCommand)this).Text, 0);
             WriteObject(this, true);
         } else {
             WriteVerbose(this, "couldn't get TextPattern");
             WriteObject(this, false);
         }
     } catch (Exception) {
     }
 }
开发者ID:apetrovskiy,项目名称:STUPS,代码行数:17,代码来源:PatternCmdletBase.cs

示例13: CallTogglePatternMethod

 internal void CallTogglePatternMethod(PatternCmdletBase cmdlet, IUiElement control, IUiElement inputObject)
 {
     try {
         // ITogglePattern togglePattern = control.GetTogglePattern();
         // ITogglePattern togglePattern = control.GetCurrentPattern<ITogglePattern, TogglePattern>();
         ITogglePattern togglePattern = control.GetCurrentPattern<ITogglePattern>(classic.TogglePattern.Pattern);
         if (togglePattern != null) {
             togglePattern.Toggle();
             
             if (PassThru && null != (inputObject as IUiElement)) {
                 WriteObject(this, inputObject);
             } else {
                 WriteObject(this, true);
             }
         } else {
             WriteVerbose(this, "couldn't get TogglePattern");
             WriteObject(this, false);
         }
     } catch (Exception) {
     }
 }
开发者ID:apetrovskiy,项目名称:STUPS,代码行数:21,代码来源:PatternCmdletBase.cs

示例14: CallTogglePatternForSet

        internal void CallTogglePatternForSet(PatternCmdletBase cmdlet, IUiElement control, IUiElement inputObject, bool on)
        {
            /*
            try {
                control.PerformToggle(on);
                if (PassThru) {
                    WriteObject(this, control);
                } else {
                    WriteObject(this, true);
                }
            } catch (Exception) {
                WriteObject(this, false);
                // throw;
            }
            */
            try {
                // ITogglePattern togglePattern1 = control.GetTogglePattern();
                // ITogglePattern togglePattern = control.GetCurrentPattern<ITogglePattern, TogglePattern>();
                ITogglePattern togglePattern = control.GetCurrentPattern<ITogglePattern>(classic.TogglePattern.Pattern);
                if (togglePattern != null) {
                    if (togglePattern.Current.ToggleState == classic.ToggleState.On && on) {
                        // nothing to do
                        cmdlet.WriteVerbose(this, "the control is already ON");
                    } else if (togglePattern.Current.ToggleState == classic.ToggleState.Off && on) {
                        cmdlet.WriteVerbose(this, "setting the control ON");
                        togglePattern.Toggle();
                    } else if (togglePattern.Current.ToggleState == classic.ToggleState.On && !on) {
                        cmdlet.WriteVerbose(this, "setting the control OFF");
                        togglePattern.Toggle();
                    } else if (togglePattern.Current.ToggleState == classic.ToggleState.Off && !on) {
                        cmdlet.WriteVerbose(this, "the control is already OF");
                        // nothing to do
                    }
//                    if (ToggleState.On == togglePattern1.Current.ToggleState) {
//                        toggleState = true;
//                    }
//                    WriteObject(this, toggleState);
                    if (PassThru && null != (inputObject as IUiElement)) {
                        WriteObject(this, inputObject);
                    } else {
                        WriteObject(this, true);
                    }
                } else {
                    WriteVerbose(this, "couldn't get TogglePattern");
                    WriteObject(this, false);
                }
            } catch (Exception) {
                //!!!!!!!!!!!!
                if (Preferences.PerformWin32ClickOnFail) {

                    // 20131125
                    //ClickControl(this, _control, false, false, false, false, false, false, false, 0,
                    // 20131230
                    // ClickControl(this, control, false, false, false, false, false, false, false, 0, 0,
                    //              0);
                    ClickControl(
                        this,
                        control,
                        new ClickSettings());
                    
                    // 20131109
                    if (PassThru && null != (inputObject as IUiElement)) {
                    //if (this.PassThru && null != (inputObject as AutomationElement)) {

                        WriteObject(this, inputObject);

                    } else {

                        WriteObject(this, true);

                    }
                }
            }
        }
开发者ID:apetrovskiy,项目名称:STUPS,代码行数:74,代码来源:PatternCmdletBase.cs

示例15: CallWindowPattern

        internal void CallWindowPattern(PatternCmdletBase cmdlet, IUiElement control, IUiElement inputObject)
        {
            try {
                // 20131208
                // WindowPattern windowPattern = control.GetCurrentPattern(classic.WindowPattern.Pattern) as WindowPattern;
                // WindowPattern windowPattern = control.GetCurrentPattern<IWindowPattern, WindowPattern>(classic.WindowPattern.Pattern) as WindowPattern;
                // IWindowPattern windowPattern = control.GetCurrentPattern<IWindowPattern, WindowPattern>(); //WindowPattern.Pattern);
                IWindowPattern windowPattern = control.GetCurrentPattern<IWindowPattern>(classic.WindowPattern.Pattern);
                if (windowPattern != null) {

                    // Close windowPattern.Close
                    // get windowPattern.Current.CanMaximize
                    // get windowPattern.Current.CanMinimize
                    // get windowPattern.Current.IsModal
                    // get windowPattern.Current.IsTopmost
                    // get windowPattern.Current.WindowInteractionState
                    // get windowPattern.Current.WindowVisualState
                    // set windowPattern.SetWindowVisualState(WindowVisualState.Maximized
                    // set windowPattern.SetWindowVisualState(WindowVisualState.Mini
                    // set windowPattern.SetWindowVisualState(WindowVisualState.Normal
                    // invoke windowPattern.WaitForInputIdle(int ms)
                    
                    windowPattern.SetWindowVisualState(classic.WindowVisualState.Minimized);
                    Thread.Sleep(1000);
                    windowPattern.SetWindowVisualState(classic.WindowVisualState.Normal);
                    windowPattern.WaitForInputIdle(1000);
                    Thread.Sleep(1000);
                    windowPattern.SetWindowVisualState(classic.WindowVisualState.Minimized);
                    Thread.Sleep(1000);
                    windowPattern.SetWindowVisualState(classic.WindowVisualState.Normal);
                    
                    if (PassThru && null != (inputObject as IUiElement)) {
                        WriteObject(this, inputObject);
                    } else {
                        WriteObject(this, true);
                    }
                } else {
                    WriteVerbose(this, "couldn't get WindowPattern");
                    WriteObject(this, false);
                }
            } catch (Exception) {
            }
        }
开发者ID:apetrovskiy,项目名称:STUPS,代码行数:43,代码来源:PatternCmdletBase.cs


注:本文中的IUiElement.GetCurrentPattern方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。