using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Windows;
using System.Xml.Serialization;

namespace USPopulation.ViewModel
{
	public class RadTreeViewXmlDataSource : XmlNodeItemList
	{
		private string source;
		public string Source
		{
			get
			{
				return this.source;
			}
			set
			{
				this.source = value;
				AddRange(RetrieveData(Application.GetResourceStream(new Uri(value, UriKind.Relative)).Stream));
			}
		}
		private XmlNodeItemList RetrieveData(Stream xmlStream)
		{
			XmlSerializer serializer = new XmlSerializer(typeof(XmlNodeItemList));
			StreamReader reader = new StreamReader(xmlStream);
			XmlNodeItemList list = (XmlNodeItemList)serializer.Deserialize(reader);
			return list;
		}
	}
}