private IDockContent GetContentFromPersistString(string persistString) { string[] parsedStrings = persistString.Split(new[] {','}); if (parsedStrings[0] == typeof (ProjectPanel).ToString()) { var projp = new ProjectPanel(); if (parsedStrings[1] != "ProjectPanel") projp.OpenProject(YnoteProject.Load(parsedStrings[1])); return projp; } if (parsedStrings[0] == typeof (Editor).ToString()) { if (parsedStrings[1] == "Editor") return null; return OpenEditor(parsedStrings[1]); } return null; }
private void OpenProject(YnoteProject project) { if (Globals.ActiveProject == project || project == null) return; if (projectPanel == null) projectPanel = new ProjectPanel(); if (File.Exists(project.LayoutFile)) { if (dock.Contents.Count != 0) { var docs = dock.Contents.ToArray(); for (int i = 0; i < docs.Length; i++) { var document = docs[i]; document.DockHandler.Close(); } } dock.LoadFromXml(project.LayoutFile, GetContentFromPersistString); } else { projectPanel.OpenProject(project); projectPanel.Show(dock, DockState.DockLeft); } Text = project.Name + " - Ynote Classic"; }