예제 #1
0
        /// <summary>
        /// Adds a document to the listbox. Document name is indented and
        /// preceeded with hierarchically outlined corresponding project name
        /// and solution name.
        /// </summary>
        /// <param name="document"></param>
        private void AddDocumentItem(Document document)
        {
            Project        project           = document.ProjectItem.ContainingProject;
            string         projectName       = project.Name;
            Solution       solution          = project.DTE.Solution;
            SolutionLBItem newSolutionLBItem = new SolutionLBItem(solution);

            if (m_listBoxUnsavedDocuments.FindStringExact(newSolutionLBItem.ToString()) == -1)
            {
                m_listBoxUnsavedDocuments.Items.Add(newSolutionLBItem);
            }
            ProjectLBItem newProjectLBItem = new ProjectLBItem(project);
            int           index            = m_listBoxUnsavedDocuments.FindStringExact(newProjectLBItem.ToString());

            if (index == -1)
            {
                index = m_listBoxUnsavedDocuments.Items.Add(newProjectLBItem);
            }
            m_listBoxUnsavedDocuments.Items.Insert(index + 1, new DocumentLBItem(document));
        }