private void OnDocumentChanged(object sender, EventArgs e) { using (TaskServiceLock.Lock()) { if (this.ActiveDocumentChanged != null) { this.ActiveDocumentChanged(sender, e); } if (this.ActiveDocument != null) { this.ActiveDocument.LastTimeActive = DateTime.Now; } Services.TaskService.SetCurrentDocument((IEditableDocument)this.ActiveDocument); } }
public Solution OpenSolution(IProgressMonitor monitor, string filePath) { Solution wrapperSolution = Services.ProjectsService.GetWrapperSolution(monitor, filePath); if (!ProjectsOperations.CheckProjectVersion(wrapperSolution.Version)) { MessageBox.Show(LanguageInfo.MessageBox_Content71, (Window)null, (string)null, MessageBoxImage.Info); return((Solution)null); } wrapperSolution.Version = Option.EditorVersion; wrapperSolution.Save(monitor); ProjectsService.Instance.CurrentSolution = wrapperSolution; wrapperSolution.Initialize(monitor); this.CurrentSelectedWorkspaceItem = (WorkspaceItem)wrapperSolution; using (TaskServiceLock.Lock()) this.OnCurrentSolutionChanged(); Services.RecentFileService.AddFile((string)this.CurrentSelectedSolution.FileName); return(wrapperSolution); }
public bool CloseAll(bool dontCloseCurrent = false) { CocoStudio.Core.Document document1 = !dontCloseCurrent ? (CocoStudio.Core.Document)null : this.ActiveDocument; bool flag = false; List <CocoStudio.Core.Document> documentList1 = new List <CocoStudio.Core.Document>(); List <CocoStudio.Core.Document> documentList2 = new List <CocoStudio.Core.Document>(); foreach (CocoStudio.Core.Document document2 in this.Documents) { if (document2 != document1) { documentList1.Add(document2); if (document2.IsDirty) { flag = true; documentList2.Add(document2); } } } if (flag) { string info; ButtonText btnText; if (documentList2.Count == 1) { info = string.Format(LanguageInfo.MessageBox188_AskSaveCurFile, (object)Path.GetFileName(documentList2[0].Name)); btnText = new ButtonText(LanguageInfo.Command_Save, LanguageInfo.Dialog_ButtonDontSave, LanguageInfo.Dialog_ButtonCancel); } else { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(LanguageInfo.MessageBox189_AskSaveFiles); foreach (CocoStudio.Core.Document document2 in documentList2) { stringBuilder.Append("\r\n " + Path.GetFileName(document2.Name)); } info = stringBuilder.ToString(); btnText = new ButtonText(LanguageInfo.Command_SaveAll, LanguageInfo.Dialog_ButtonDontSave, LanguageInfo.Dialog_ButtonCancel); } switch (MessageBox.Show(info, btnText, (Window)null, (string)null, MessageBoxImage.Info)) { case MessageBoxResult.Yes: foreach (CocoStudio.Core.Document document2 in documentList2) { document2.Save(); } if (document1 != null && document1.Project != null) { using (TaskServiceLock.Lock()) { document1.Project.ReloadReferencedProject(Services.ProgressMonitors.Default); break; } } else { break; } case MessageBoxResult.Cancel: return(false); } } foreach (CocoStudio.Core.Document document2 in documentList1) { document2.Close(true); } return(true); }