|
///////////////////////////////////////////////////////////////////////
//
// Audio Manager for the PRISMIQ Media Player
// Written by Bruce Waeyen
// Copyright (c) 2004. All Rights Reserved.
//
// This code may be used in compiled form in any way you desire. This
// file may be redistributed unmodified by any means PROVIDING it is
// not sold for profit without the authors written consent, and
// providing that this notice and the authors name and all copyright
// notices remains intact.
//
//
// This file is provided "as is" with no expressed or implied warranty.
// The author accepts no liability for any damage/loss of business that
// this product may cause.
//
//
//////////////////////////////////////////////////////////////////////
using System;
using System.Xml;
using System.Windows.Forms;
namespace PrismiqServer
{
/// <summary>
///
/// </summary>
public class XmlTreeNode : TreeNode
{
private XmlNode xmlNode;
public XmlNode XmlNode
{
get
{
return xmlNode;
}
set
{
if (xmlNode != value)
xmlNode = value;
}
}
public XmlTreeNode(XmlNode xNode) : base(xNode.Name)
{
xmlNode = xNode;
if (xmlNode != null)
{
String S = xmlNode.Name;
this.ImageIndex = 0;
this.SelectedImageIndex = 0;
if(xmlNode.Name == "Song")
{
this.ImageIndex = 1;
this.SelectedImageIndex = 1;
this.Text = xmlNode.Attributes.GetNamedItem("Title").Value;
}
}
}
public void FillNodes()
{
if (xmlNode != null)
{
this.Nodes.Clear();
XmlNode xNode = xmlNode;
if (xNode.HasChildNodes)
{
xNode = xNode.FirstChild;
while (xNode != null)
{
// If the xml child node is container type, create the
// tree child node for the treeview.
if (xNode.NodeType == XmlNodeType.Document ||
xNode.NodeType == XmlNodeType.DocumentFragment ||
xNode.NodeType == XmlNodeType.DocumentType ||
xNode.NodeType == XmlNodeType.Element ||
xNode.NodeType == XmlNodeType.Entity ||
xNode.NodeType == XmlNodeType.EntityReference)
{
XmlTreeNode treeNode = new XmlTreeNode(xNode);
this.Nodes.Add(treeNode);
treeNode.FillNodes();
}
xNode = xNode.NextSibling;
}
}
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.