public UIDocument Open(string path, string view = null) { string id; if(string.IsNullOrEmpty(path)) { id = null; path = null; view = null; } else { if(view != null) { id = path + "?view=" + view; } else { id = path; } } UIDocument ui; ui = _files.FirstOrDefault(z => z != null && z.ContentId == id); if(ui == null) { ui = new UI.UIDocument(path, view); _files.Add(ui); } ActiveDocument = ui; return ui; }
public BaseWindow Open(string path, string view = null) { string id; if (string.IsNullOrEmpty(path)) { id = null; path = null; view = null; } else { if (view != null) { id = path + "?view=" + view; } else { id = path; } } if (view == "wks") { var ui = Tools.FirstOrDefault(z => z != null && z.ContentId == id); if (ui == null) { ui = new uiWorkspace(); Tools.Add(ui); } return(ui); } else if (view == "log") { var ui = Tools.FirstOrDefault(z => z != null && z.ContentId == id); if (ui == null) { ui = new uiLog(); Tools.Add(ui); } return(ui); } else if (view == "catatlog") { var catalog = Files.OfType <UI.UiCatalog>().FirstOrDefault(z => z != null && z.ContentId == id); if (catalog == null) { catalog = new UI.UiCatalog(path); Files.Add(catalog); } ActiveDocument = catalog; return(catalog); } else { var doc = Files.OfType <UI.UIDocument>().FirstOrDefault(z => z != null && ((z.data != null && z.data.fullPath == path) || ContentIdEqual(z.ContentId, path, view))); if (doc == null) { doc = new UI.UIDocument(path, view); Files.Add(doc); } ActiveDocument = doc; return(doc); } }