Ejemplo n.º 1
0
        protected virtual object ConvertStringtoObject(string BindingText, Type type)
        {
            object obj2     = null;
            string fullName = type.FullName;

            if (fullName == null)
            {
                return(obj2);
            }
            if (fullName != "System.Boolean")
            {
                if (fullName != "System.String")
                {
                    if (fullName == "System.Windows.Rect")
                    {
                        return(UIAHelperMethods.GetRect(BindingText));
                    }
                    if (fullName == "System.Windows.Point")
                    {
                        return(UIAHelperMethods.GetPoint(BindingText));
                    }
                    if (fullName == "System.Windows.Automation.OrientationType")
                    {
                        OrientationType none = OrientationType.None;
                        Enum.TryParse <OrientationType>(BindingText, out none);
                        return(none);
                    }
                    if (fullName != "System.Windows.Automation.ControlType")
                    {
                        return(obj2);
                    }
                    return(UIAHelperMethods.GetControlType(BindingText));
                }
            }
            else
            {
                bool result = false;
                bool.TryParse(BindingText, out result);
                return(result);
            }
            return(UIAHelperMethods.UnEscapeXml(BindingText));
        }