/// <summary> /// Converts the given object to an object the native client expects /// </summary> public static object ToNative(object val) { if (val == null) { return(null); } if (val is ControlType controlType) { val = (int)ControlTypeConverter.ToControlTypeNative(controlType); } else if (val is AnnotationType annotationType) { val = (int)AnnotationTypeConverter.ToAnnotationTypeNative(annotationType); } else if (val is Rectangle rect) { val = new[] { rect.Left, rect.Top, rect.Width, rect.Height }; } else if (val is Point point) { val = new[] { point.X, point.Y }; } else if (val is CultureInfo cultureInfo) { val = cultureInfo.LCID; } else if (val is AutomationElement automationElement) { val = automationElement.ToNative(); } return(val); }
/// <summary> /// Converts the given object to an object the native client expects /// </summary> public static object ToNative(object val) { if (val == null) { return(null); } if (val is ControlType) { val = (int)ControlTypeConverter.ToControlTypeNative((ControlType)val); } else if (val is AnnotationType) { val = (int)AnnotationTypeConverter.ToAnnotationTypeNative((AnnotationType)val); } else if (val is Rectangle) { var rect = (Rectangle)val; val = new[] { rect.Left, rect.Top, rect.Width, rect.Height }; } else if (val is Point) { var point = (Point)val; val = new[] { point.X, point.Y }; } else if (val is CultureInfo) { val = ((CultureInfo)val).LCID; } else if (val is AutomationElement) { val = AutomationElementConverter.ToNative((AutomationElement)val); } return(val); }