UIAutomation.PatternCmdletBase.CallTextPatternForGet C# (CSharp) Method

CallTextPatternForGet() private method

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