Esempio n. 1
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);
        }
Esempio n. 2
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;
     }
 }