UIAutomation.PatternCmdletBase.CallSelectionPattern C# (CSharp) Method

CallSelectionPattern() private method

private CallSelectionPattern ( PatternCmdletBase cmdlet, IUiElement control, IUiElement inputObject ) : void
cmdlet PatternCmdletBase
control IUiElement
inputObject IUiElement
return void
        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) {
            }
        }