public bool CloseSolution() { if (CurrentSolution == null) return true; var documents = Program.MainForm.DockPanel.Documents.Select(p => (IDocument)p).ToList(); if (documents.Any(p => p.IsDirty)) { var result = MessageBox.Show( Program.MainForm, "Do you want to save your changes?", "Save changes", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning ); if (result == DialogResult.Cancel) return false; if (result == DialogResult.Yes) { foreach (var document in documents) { document.Save(); } } } CurrentSolution.Dispose(); CurrentSolution = null; return true; }
public void OpenSolution(string fileName) { if (CurrentSolution != null && !CloseSolution()) return; CurrentSolution = new Solution(fileName); }
public Project(Solution solution, string fileName, string name) { if (fileName == null) throw new ArgumentNullException("fileName"); if (name == null) throw new ArgumentNullException("name"); RootNode = new ProjectItem(fileName, name, false); RootNode.SetProperty<Project>(this); Namespace = GetNamespace(fileName); Directory = Path.GetDirectoryName(RootNode.FileName); _translationsPath = Path.Combine(Directory, "Translations"); LoadTranslations(); LoadProject(RootNode, new DirectoryInfo(Path.GetDirectoryName(fileName)), ""); UpdateFromLanguage(solution.Dictionary); Program.MainForm.LanguageChanged += MainForm_LanguageChanged; }