private static string UiaGetText(BaseProdControl control) { string ret = ValuePatternHelper.GetValue(control.UIAElement); LogController.ReceiveLogMessage(new LogMessage("String: " + ret)); return(ret); }
private static int UiaGetLength(BaseProdControl control) { string txt = ValuePatternHelper.GetValue(control.UIAElement); int retVal = txt.Length; LogController.ReceiveLogMessage(new LogMessage("Length: " + retVal)); return(retVal); }
public string GetText() { string ret = ValuePatternHelper.GetValue(UIAElement); if (ret == null && UIAElement.Current.NativeWindowHandle != 0) { ret = NativeTextProds.GetTextNative(NativeWindowHandle); } LogText = "Text: " + ret; LogMessage(); return(ret); }
/// <summary> /// Gets the text currently contained in a text area /// </summary> /// <param name="controlHandle">NativeWindowHandle to the target control</param> /// <returns> /// Text contained in text area /// </returns> /// <exception cref="ProdOperationException">Examine inner exception</exception> /// <remarks> /// This overload is invalid for WPF controls /// </remarks> public static string GetText(IntPtr controlHandle) { try { AutomationElement control = AutomationElement.FromHandle(controlHandle); control.GetCurrentPattern(ValuePattern.Pattern); string ret = ValuePatternHelper.GetValue(control); return(ret ?? NativeTextProds.GetTextNative(controlHandle)); } catch (InvalidOperationException err) { throw new ProdOperationException(err.Message, err); } catch (ElementNotAvailableException err) { throw new ProdOperationException(err.Message, err); } catch (ArgumentException err) { throw new ProdOperationException(err.Message, err); } }