Ejemplo n.º 1
0
        /// <summary>
        /// Occurs when a document gets removed from a group document
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnDocumentRemoved(object sender, DocGroupDocActionEventArgs e)
        {
            TreeListViewItem result = null;

            FindTreeListViewItemByDocument(solutionExplorerTreeView.Items[0], e.Document, ref result);

            if (result != null)
            {
                if (result.ParentItem == null)
                {
                    solutionExplorerTreeView.Items.Remove(result);
                }
                else
                {
                    result.ParentItem.Items.Remove(result);
                }
            }

            solutionExplorerTreeView.ShowRootTreeLines = (solutionExplorerTreeView.Items.Count > 0 && solutionExplorerTreeView.Items[0].Items.Count > 0);
            solutionExplorerTreeView.AutoSizeColumnWidths(true);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Occurs when a document gets added to a group document
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnDocumentAdded(object sender, DocGroupDocActionEventArgs e)
        {
            TreeListViewItem result = null;
            ILuaEditDocument doc    = sender as ILuaEditDocument;

            FindTreeListViewItemByDocument(solutionExplorerTreeView.Items[0], doc, ref result);

            if (result != null)
            {
                e.Document.ToTreeListViewItem(result);
                result.Expand();

                if (e.Document is ILuaEditDocumentGroup)
                {
                    ILuaEditDocumentGroup grpDoc = e.Document as ILuaEditDocumentGroup;
                    grpDoc.DocumentRemoved += OnDocumentRemoved;
                    grpDoc.DocumentAdded   += OnDocumentAdded;
                }
            }

            solutionExplorerTreeView.ShowRootTreeLines = (solutionExplorerTreeView.Items.Count > 0 && solutionExplorerTreeView.Items[0].Items.Count > 0);
            solutionExplorerTreeView.AutoSizeColumnWidths(true);
        }