Ejemplo n.º 1
0
        ObservableList <ControlProperty> IWindowExplorerTreeItem.GetElementProperties()
        {
            PayLoad Request = new PayLoad(JavaDriver.CommandType.WindowExplorerOperation.ToString());

            Request.AddEnumValue(JavaDriver.WindowExplorerOperationType.GetProperties);
            Request.AddValue("ByXPath");
            Request.AddValue(JavaElementInfo.XPath);
            Request.ClosePackage();

            JavaDriver d        = (JavaDriver)JavaElementInfo.WindowExplorer;
            PayLoad    Response = d.Send(Request);

            if (Response.IsErrorPayLoad())
            {
                string ErrMSG = Response.GetErrorValue();
                return(null);
            }

            if (Response.Name == "ControlProperties")
            {
                ObservableList <ControlProperty> list = new ObservableList <ControlProperty>();
                List <PayLoad> props = Response.GetListPayLoad();
                foreach (PayLoad prop in props)
                {
                    string PropName  = prop.GetValueString();
                    string PropValue = String.Empty;
                    if (PropName != "Value")
                    {
                        PropValue = prop.GetValueString();
                    }
                    else
                    {
                        List <String> valueList = prop.GetListString();
                        if (valueList.Count != 0)
                        {
                            PropValue = valueList.ElementAt(0);
                        }
                    }

                    list.Add(new ControlProperty()
                    {
                        Name = PropName, Value = PropValue
                    });
                }
                return(list);
            }
            else
            {
                //TODO: handle err
                return(null);
            }
        }