/// <summary> /// Identifies documents that are open from a serialized list /// </summary> /// <param name="docs"></param> /// <returns>List of DocumentViewModels</returns> private static List <DocumentViewModel> LoadVisibleDocuments(string[] paths) { List <DocumentViewModel> documents = new List <DocumentViewModel>(); if (paths == null) { return(documents); } foreach (string s in paths) { FileDeclaration d = MacroUI.GetInstance().GetDeclarationFromFullname(s); if (d != null) { DocumentModel model = DocumentModel.Create(d); if (model != null) { DocumentViewModel viewModel = DocumentViewModel.Create(model); documents.Add(viewModel); } } } return(documents); }
/// <summary> /// Opens a document for editing from the id of a macro /// </summary> /// <param name="d">The file declaration</param> public void OpenMacroForEditing(FileDeclaration d) { if (d == null) { return; } DocumentViewModel dvm = DockManager.GetDocument(d); if (dvm != null) { DockManager.ActiveContent = dvm; return; } DocumentModel model = DocumentModel.Create(d); if (model != null) { DocumentViewModel viewModel = DocumentViewModel.Create(model); DockManager.AddDocument(viewModel); ChangeActiveDocument(viewModel); } }