// Note: param "rootElementPath" should be ending with System.IO.Path.DirectorySeparatorChar public ElementControl(string rootElementPath) { root = new Element { ParentElement = null, HeadImageSource = String.Empty, TailImageSource = String.Empty, NoteText = String.Empty, IsExpanded = true, Path = rootElementPath, Type = ElementType.Heading, }; ni_root = new NavigationItem { Name = String.Empty, Path = rootElementPath, Parent = null, }; dbControl = new DatabaseControl(rootElementPath); dbControl.newXooMLCreate += new NewXooMLCreateDelegate(dbControl_newXooMLCreate); dbControl.OpenConnection(); dbControl.newDBControlHighP += new NewDatabaseControlHandler(dbControl_newDBControlHighP); dbControl.newDBControlLowP += new NewDatabaseControlHandler(dbControl_newDBControlLowP); dbControl.elementUpdate += new ElementUpdateDelegate(dbControl_elementUpdate); dbControl.elementStatusChangedDelegate += new ElementStatusChangedDelegate(dbControl_elementStatusChanged); dbControl.elementDelete += new ElementDeleteDelegate(dbControl_elementDelete); root.ShowAssociationMarkedDone = dbControl.GetFragmentElementFromXML().ShowAssociationMarkedDone; root.ShowAssociationMarkedDefer = dbControl.GetFragmentElementFromXML().ShowAssociationMarkedDefer; foreach (Element element in dbControl.GetAllElementFromXML()) { if (element.IsVisible == Visibility.Collapsed) { continue; } AddElement(element, root); if (element.IsHeading) { NavigationItem ni = new NavigationItem { Name = element.NoteText, Path = element.Path, Parent = ni_root, }; ni.Items.Add(new NavigationItem()); ni_root.Items.Add(ni); } } currentElement = root; RunXMLBackgroundWorker(); }