Example #1
0
        private bool CloseSolution()
        {
            if (_solution == null)
            {
                return(true);
            }
            string selected = "";

            if (tabStripMain.SelectedItem != null)
            {
                var selectedFile = tabStripMain.SelectedItem.Tag as IProjectFile;
                if (selectedFile != null)
                {
                    selected = selectedFile.FileSystemPath;
                }
            }
            _solution.SaveSolutionSettings(solutionExplorer.GetExpandedTreeNodes(), solutionExplorer.GetOpenFiles(),
                                           selected);
            _solution.DetachProjectsFromSystem();
            if (!CloseOpenFiles())
            {
                return(false);
            }
            _solution = null;
            solutionExplorer.SetSolution(_solution);
            solutionExplorer.Refresh();
            return(true);
        }
Example #2
0
        private bool CreateNewProject()
        {
            var form = new ProjectWizard(true);

            if (form.ShowDialog() == DialogResult.OK)
            {
                if (!CloseSolution())
                {
                    return(false);
                }

                try
                {
                    Cursor = Cursors.WaitCursor;
                    toolStripStatusText.Text = "Creating project...";
                    if (form.CopySourceFilesToTargetLocation)
                    {
                        FolderUtility.CopyRecursive(form.SourceLocation, form.ProjectLocation, FileExistsQuestion);
                    }
                    _solution = CrcsSolution.CreateSolution(form.SolutionFileName);
                    CrcsProject rsproj = CrcsProject.CreateProject(form.ProjectFileName, _solution);
                    rsproj.Save();
                    _solution.AddProject(rsproj);
                    _solution.Save();
                    return(true);
                }
                finally
                {
                    Cursor = Cursors.Default;
                }
            }
            SetTitle();
            return(false);
        }
Example #3
0
 private void OnLoaded()
 {
     if (InvokeRequired)
     {
         BeginInvoke(new Action(OnLoaded));
         return;
     }
     try
     {
         Cursor = Cursors.WaitCursor;
         var extension = (Path.GetExtension(_fileSystemPath) ?? "").ToUpperInvariant();
         if (extension == ".RSSLN")
         {
             OpenSolution(_fileSystemPath);
         }
         else if (extension == ".RSPROJ")
         {
             bool solutionFound = false;
             var  fi            = new FileInfo(_fileSystemPath);
             var  paths         = new List <string>();
             paths.Add(fi.Directory.FullName);
             if (fi.Directory.Parent != null)
             {
                 paths.Add(fi.Directory.Parent.FullName);
             }
             foreach (var path in paths)
             {
                 foreach (var solution in Directory.GetFiles(path, "*.rssln"))
                 {
                     if (CrcsSolution.SolutionContainsProject(solution, _fileSystemPath))
                     {
                         OpenSolution(solution);
                         solutionFound = true;
                     }
                 }
             }
             if (!solutionFound)
             {
                 var file = _fileSystemPath.Substring(0, _fileSystemPath.Length - 6) + "rssln";
                 _solution = CrcsSolution.CreateSolution(file);
                 _solution.AddProject(CrcsProject.OpenProject(_fileSystemPath, _solution));
                 solutionExplorer.SetSolution(_solution);
                 solutionExplorer.Refresh();
             }
         }
         else
         {
             OpenFile(_fileSystemPath);
         }
     }
     catch (Exception ex)
     {
         MessageEngine.ShowError(ex);
     }
     finally
     {
         Cursor = Cursors.Default;
     }
 }
 public SolutionPropertiesEditor(CrcsSolution solution)
 {
     _solution = solution;
     InitializeComponent();
     TabTitle   = _solution.Name;
     TabToolTip = _solution.FileSystemPath;
     _tools.Refresh(CrcsSettings.Current.ToolsFolder);
     RefreshControls();
 }
Example #5
0
        public void SetSolution(CrcsSolution solution)
        {
            treeViewSolution.Nodes.Clear();
            _nodes.Clear();
            _solution = solution;
            if (solution == null)
            {
                _solutionNode = null;
                return;
            }
            _solutionNode = new ProjectTreeNode(_solution);
            _nodes.Add(_solutionNode);
            var propNode = new TreeNode("Properties", 6, 6)
            {
                Tag = _solution
            };

            _solutionNode.Nodes.Add(propNode);
            treeViewSolution.Nodes.Add(_solutionNode);
            _solution.TreeNode = _solutionNode;
        }
Example #6
0
 public void OpenSolutionWorker(string fileSystemPath)
 {
     try
     {
         CloseSolution();
         _solution = CrcsSolution.OpenSolution(fileSystemPath);
         solutionExplorer.SetSolution(_solution);
         solutionExplorer.Refresh();
         solutionExplorer.ExpandTreeNodes(_solution.PathsForExpandedTreeNodes);
         _solution.OpenRememberdFiles(OpenFile);
         _recentSolutions.Add(fileSystemPath);
         FileUtility.AddToRecentDocuments(fileSystemPath);
         menuMainViewShowExcluded.Checked = _solution.ShowExcludedItems;
         SetTitle();
     }
     finally
     {
         if (_loadSolutionDlg != null)
         {
             _loadSolutionDlg.Close();
             _loadSolutionDlg = null;
         }
     }
 }
Example #7
0
        public QuestionForm(IEnumerable <IProjectFile> files, CrcsSolution solution)
        {
            InitializeComponent();
            var dict = new Dictionary <string, List <IProjectFile> >();

            foreach (IProjectFile file in files)
            {
                if (file is CrcsSolution)
                {
                    continue;
                }
                CrcsProject rsproj   = file as CrcsProject ?? file.Project;
                string      projName = rsproj == null ? "Misc Files" : rsproj.FileName;
                if (!dict.ContainsKey(projName))
                {
                    dict.Add(projName, new List <IProjectFile>());
                }
                if (!ReferenceEquals(file, rsproj))
                {
                    dict[projName].Add(file);
                }
            }
            var sb = new StringBuilder();

            sb.AppendLine(solution.FileName);
            foreach (string rsproj in dict.Keys)
            {
                sb.Append("\t").AppendLine(rsproj);
                foreach (IProjectFile file in dict[rsproj])
                {
                    sb.Append("\t\t").AppendLine(file.RelativePath);
                }
            }
            textBox1.Text           = sb.ToString();
            textBox1.SelectionStart = textBox1.Text.Length;
        }