Example #1
0
        public string GetXPath()
        {
            StringBuilder sb     = new StringBuilder();
            XListViewItem parent = _parent as XListViewItem;

            if (parent != null)
            {
                sb.Append(parent.GetXPath());
            }
            sb.Append('/').Append(NodeName);
            return(sb.ToString());
        }
Example #2
0
        private void lv_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            ListView lv = sender as ListView;

            if (lv == null)
            {
                return;
            }

            XListViewItem item = lv.Items[e.Index] as XListViewItem;

            if (item == null)
            {
                return;
            }

            switch (e.NewValue)
            {
            case CheckState.Checked:
            {
                XListViewItem pitem = item._parent as XListViewItem;
                if (pitem == null)
                {
                    return;
                }
                pitem.Checked = true;
                break;
            }

            case CheckState.Unchecked:
            {
                foreach (TListViewItem i in item._children)
                {
                    XListViewItem citem = i as XListViewItem;
                    if (citem == null)
                    {
                        continue;
                    }
                    citem.Checked = false;
                }
                break;
            }
            }
        }
Example #3
0
        public void LoadXmlSchema(XmlReader reader)
        {
            if (reader == null)
            {
                return;
            }

            _includes.Clear();
            _complexTypes.Clear();

            XmlSchema schema = XmlSchema.Read(reader, ValidationCallback);

            if (schema == null)
            {
                return;
            }

            LoadXmlSchemaInclude(schema);
            foreach (XmlSchemaObject obj in schema.Items)
            {
                XmlSchemaElement ele = obj as XmlSchemaElement;
                if (ele != null)
                {
                    XListViewItem        lvItem;
                    XmlSchemaComplexType cType = GetElementComplexType(ele);
                    if (cType == null)
                    {
                        lvItem = new XListViewItem(ele.Name);
                    }
                    else
                    {
                        lvItem = new XListViewItem(ele.Name, cType);
                    }
                    AddRoot(lvItem);
                }
            }
        }