public static void ShowOpenProject(this ScreenLayerManager screenLayerManager) { if (!Directory.Exists(Project.ProjectsFolder)) { Directory.CreateDirectory(Project.ProjectsFolder); } screenLayerManager.OpenFilePicker("", "", Project.ProjectsFolder, Project.FileFilter, (projectPath) => { if (!PathHelper.FolderContainsPath(Project.ProjectsFolder, projectPath) || PathHelper.GetRelativePath(Project.ProjectsFolder, projectPath).Count(c => c == '/') != 1) { screenLayerManager.ShowMessage("Projects must be placed in a folder directly inside the 'projects' folder."); } else { screenLayerManager.AsyncLoading("Loading project", () => { var resourceContainer = screenLayerManager.GetContext <Editor>().ResourceContainer; var project = Project.Load(projectPath, true, resourceContainer); Program.Schedule(() => screenLayerManager.Set(new ProjectMenu(project))); }); } }); }
public void Restart(ScreenLayer initialLayer = null, string message = null) { initializeOverlay(); ScreenLayerManager.Set(initialLayer ?? new StartMenu()); if (message != null) { ScreenLayerManager.ShowMessage(message); } }
public static void ShowOpenProject(this ScreenLayerManager screenLayerManager) { if (!Directory.Exists(Project.ProjectsFolder)) { Directory.CreateDirectory(Project.ProjectsFolder); } screenLayerManager.OpenFilePicker("", "", Project.ProjectsFolder, Project.FileFilter, (projectPath) => { if (!PathHelper.FolderContainsPath(Project.ProjectsFolder, projectPath)) { screenLayerManager.ShowMessage("Projects must be placed in a folder inside the 'projects' folder."); } else { screenLayerManager.AsyncLoading("Loading project", () => { var project = Project.Load(projectPath, true); Program.Schedule(() => screenLayerManager.Set(new ProjectMenu(project))); }); } }); }