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; } }
private void MenuMainFileAddExistingProjectClick(object sender, EventArgs e) { try { OpenFileDialog ofd = FileUtility.CreateOpenFileDlg("", "Crcs project files (*.rsproj)|*.rsproj"); ofd.DefaultExt = "rsproj"; if (ofd.ShowDialog(this) == DialogResult.OK) { _solution.AddProject(CrcsProject.OpenProject(ofd.FileName, _solution)); solutionExplorer.Refresh(); } } catch (Exception ex) { MessageEngine.ShowError(ex); } }