public static CBoxConfig GetBoxConfig(string boxName)
        {
            lock (_xmlDoc)
            {
                XmlNodeList list = _xmlDoc.SelectNodes("/controlConfig/tlResult/box");
                foreach (XmlElement element in list)
                {
                    if (element.GetAttribute("name") == boxName)
                    {
                        CBoxConfig config = new CBoxConfig();
                        config.Name = boxName;
                        foreach (XmlAttribute attribute in element.Attributes)
                        {
                            switch (attribute.Name)
                            {
                                case "class":
                                    config.Class = attribute.Value;
                                    break;

                                case "queryName":
                                    config.QueryName = attribute.Value;
                                    break;

                                case "idField":
                                    config.IdField = attribute.Value;
                                    break;

                                case "queryParameters":
                                    config.QueryParameters = StringHelper.Split(attribute.Value);
                                    break;

                                case "DAONameSpace":
                                    config.DAONameSpace = attribute.Value;
                                    break;

                                case "OpenViewCommand":
                                    config.OpenViewCommand = attribute.Value;
                                    break;

                                case "queryCountName":
                                    config.QueryCountName = attribute.Value;
                                    break;

                                case "toolbarPath":
                                    config.ToolbarPath = attribute.Value;
                                    break;
                            }
                        }
                        CColConfig col = null;
                        CMenuItemConfig menuItem = null;
                        XmlElement element2 = null;
                        foreach (XmlNode node in element.ChildNodes)
                        {
                            if (node is XmlElement)
                            {
                                element2 = node as XmlElement;
                                if (element2.Name.Equals("col"))
                                {
                                    col = new CColConfig();
                                    col.Caption = element2.GetAttribute("caption");
                                    col.FieldName = element2.GetAttribute("fieldName");
                                    col.VisibleIndex = Convert.ToInt32(element2.GetAttribute("visibleIndex"));
                                    col.FormatType = element2.GetAttribute("formatType");
                                    col.FormatString = element2.GetAttribute("formatString");
                                    if (element2.HasAttribute("width"))
                                    {
                                        col.Width = Convert.ToInt32(element2.GetAttribute("width"));
                                    }
                                    config.AddCol(col);
                                }
                                else if (element2.Name.Equals("menuItem"))
                                {
                                    menuItem = new CMenuItemConfig();
                                    menuItem.Text = element2.GetAttribute("text");
                                    menuItem.InvokeName = element2.GetAttribute("invokeName");
                                    string str = element2.GetAttribute("enableOnSelect");
                                    if (str != null)
                                    {
                                        menuItem.EnableOnSelect = Convert.ToBoolean(str);
                                    }
                                    menuItem.Access = element2.GetAttribute("acess");
                                    config.AddMenuItem(menuItem);
                                }
                            }
                        }
                        return config;
                    }
                }
            }
            throw new WfClientException("Cannot find configuration the box of " + boxName);
        }
Example #2
0
 public void AddCol(CColConfig col)
 {
     this._colList.Add(col);
 }