public MainWindow() { InitializeComponent(); Thread.CurrentThread.Name = "Main Thread"; CountdownEvent folderEndByXML = new CountdownEvent(1); CountdownEvent folderEndByTree = new CountdownEvent(1); CountdownEvent fileEndByXML = new CountdownEvent(1); CountdownEvent fileEndByTree = new CountdownEvent(1); m_parser = new Parser(m_progressToken, folderEndByTree, folderEndByXML, fileEndByTree, fileEndByXML); m_treeFiller = new TreeFiller(m_treeView, m_progressToken, folderEndByTree, fileEndByTree); m_xmlFiller = new XMLFiller(m_progressToken, folderEndByXML, fileEndByXML); m_folderName.DataContext = m_parser; m_xmlFileName.DataContext = m_xmlFiller; m_parser.ItemGrabbed += m_xmlFiller.ItemGrabbedHandler; m_parser.ItemGrabbed += m_treeFiller.ItemGrabbedHandler; m_parser.FolderStarted += m_xmlFiller.FolderStartedHandler; m_parser.FolderStarted += m_treeFiller.FolderStartedHandler; m_parser.FolderFinished += m_xmlFiller.FolderFinishedHandler; m_parser.FolderFinished += m_treeFiller.FolderFinishedHandler; m_parser.ParserFinishEvent += this.ParserFinishEventHandler; m_xmlFiller.ExceptionOccuredEvent += this.ExceptionOccuredHandler; m_treeFiller.ExceptionOccuredEvent += this.ExceptionOccuredHandler; m_parser.ExceptionOccuredEvent += this.ExceptionOccuredHandler; }