Exemplo n.º 1
0
        public static void LoadExpenses(TreeListView lView, string xFile)
        {
            Throw.IfFalse(File.Exists(xFile), new FileNotFoundException(xFile));
            InitializeListView(lView);

            var xDoc = XDocument.Load(xFile);

            Debug.Assert(xDoc.Root.Name == "Expenses");
            Debug.Assert(xDoc.Root.Attributes().Count() >= 2);

            var xList  = new List <XElement>(xDoc.Root.Elements());
            var lItems = PrepareTree(xList, null);

            foreach (var li in lItems)
            {
                lView.AddItem(li);
            }
        }