Ejemplo n.º 1
0
        public override void Run()
        {
            AbstractProjectBrowserTreeNode node = ProjectBrowserPad.Instance.ProjectBrowserControl.SelectedNode;
            ISolutionFolderNode            solutionFolderNode = node as ISolutionFolderNode;

            if (solutionFolderNode != null)
            {
                using (OpenFileDialog fdiag = new OpenFileDialog()) {
                    fdiag.AddExtension     = true;
                    fdiag.Filter           = ProjectService.GetAllProjectsFilter(this, false);
                    fdiag.Multiselect      = true;
                    fdiag.CheckFileExists  = true;
                    fdiag.InitialDirectory = AddNewProjectToSolution.GetInitialDirectorySuggestion(solutionFolderNode.Folder);
                    if (fdiag.ShowDialog(SD.WinForms.MainWin32Window) == DialogResult.OK)
                    {
                        try {
                            foreach (string fileName in fdiag.FileNames)
                            {
                                solutionFolderNode.Folder.AddExistingProject(FileName.Create(fileName));
                            }
                        } catch (ProjectLoadException ex) {
                            MessageService.ShowError(ex.Message);
                        } catch (IOException ex) {
                            MessageService.ShowError(ex.Message);
                        }
                        ProjectService.SaveSolution();
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public override void Run()
        {
            AbstractProjectBrowserTreeNode node = ProjectBrowserPad.Instance.ProjectBrowserControl.SelectedNode;
            ISolutionFolderNode            solutionFolderNode = node as ISolutionFolderNode;

            if (node != null)
            {
                using (OpenFileDialog fdiag = new OpenFileDialog()) {
                    fdiag.AddExtension     = true;
                    fdiag.Filter           = ProjectService.GetAllProjectsFilter(this);
                    fdiag.Multiselect      = true;
                    fdiag.CheckFileExists  = true;
                    fdiag.InitialDirectory = AddNewProjectToSolution.GetInitialDirectorySuggestion(solutionFolderNode);
                    if (fdiag.ShowDialog(ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainForm) == DialogResult.OK)
                    {
                        foreach (string fileName in fdiag.FileNames)
                        {
                            AddProject(solutionFolderNode, fileName);
                        }
                        ProjectService.SaveSolution();
                    }
                }
            }
        }