Esempio n. 1
0
        public override void DoDragDrop(IDataObject dataObject, DragDropEffects effect)
        {
            if (!isInitialized)
            {
                Initialize();
                isInitialized = true;
            }

            if (dataObject.GetDataPresent(typeof(SolutionFolderNode)))
            {
                SolutionFolderNode             folderNode = (SolutionFolderNode)dataObject.GetData(typeof(SolutionFolderNode));
                AbstractProjectBrowserTreeNode parentNode = folderNode.Parent as AbstractProjectBrowserTreeNode;

                folderNode.Remove();
                folderNode.InsertSorted(this);
                folderNode.EnsureVisible();
                this.folder.AddFolder(folderNode.Folder);
                if (parentNode != null)
                {
                    parentNode.Refresh();
                }
            }

            if (dataObject.GetDataPresent(typeof(SolutionItemNode)))
            {
                SolutionItemNode solutionItemNode = (SolutionItemNode)dataObject.GetData(typeof(SolutionItemNode));

                ISolutionFolderNode folderNode = (ISolutionFolderNode)solutionItemNode.Parent;
                folderNode.Container.SolutionItems.Items.Remove(solutionItemNode.SolutionItem);
                Container.SolutionItems.Items.Add(solutionItemNode.SolutionItem);

                solutionItemNode.Remove();
                solutionItemNode.InsertSorted(this);
                solutionItemNode.EnsureVisible();
                if (solutionItemNode.Parent != null)
                {
                    ((ExtTreeNode)solutionItemNode.Parent).Refresh();
                }
            }

            if (dataObject.GetDataPresent(typeof(ProjectNode)))
            {
                ProjectNode projectNode = (ProjectNode)dataObject.GetData(typeof(ProjectNode));

                projectNode.Remove();
                projectNode.InsertSorted(this);
                projectNode.EnsureVisible();
                this.folder.AddFolder(projectNode.Project);

                if (projectNode.Parent != null)
                {
                    ((ExtTreeNode)projectNode.Parent).Refresh();
                }
            }

            solution.Save();
        }
        //public override void DoDragDrop(IDataObject dataObject, DragDropEffects effect)
        public virtual void DoDragDrop(IDataObject dataObject, DragDropEffects effect)
        {
            if (!IsInitialized)
            {
                Initialize();
                //isInitialized = true;
            }

            if (dataObject.GetDataPresent(typeof(SolutionFolderNode)))
            {
                SolutionFolderNode             folderNode = (SolutionFolderNode)dataObject.GetData(typeof(SolutionFolderNode));
                AbstractProjectBrowserTreeNode parentNode = folderNode.Parent as AbstractProjectBrowserTreeNode;

                folderNode.Remove();
                folderNode.InsertSorted(this);
                folderNode.EnsureVisible();
                MoveItem(folderNode.Folder, this.folder);

                if (parentNode != null)
                {
                    parentNode.Refresh();
                }
            }

            if (dataObject.GetDataPresent(typeof(SolutionItemNode)))
            {
                SolutionItemNode solutionItemNode = (SolutionItemNode)dataObject.GetData(typeof(SolutionItemNode));

                MoveItem(solutionItemNode.SolutionItem, this.folder);

                solutionItemNode.Remove();
                solutionItemNode.InsertSorted(this);
                solutionItemNode.EnsureVisible();
                if (solutionItemNode.Parent != null)
                {
                    ((ExtTreeNode)solutionItemNode.Parent).Refresh();
                }
            }

            if (dataObject.GetDataPresent(typeof(ProjectNode)))
            {
                ProjectNode projectNode = (ProjectNode)dataObject.GetData(typeof(ProjectNode));

                projectNode.Remove();
                projectNode.InsertSorted(this);
                projectNode.EnsureVisible();
                MoveItem(projectNode.Project, this.folder);

                if (projectNode.Parent != null)
                {
                    ((ExtTreeNode)projectNode.Parent).Refresh();
                }
            }

            solution.Save();
        }