Skip to content

Commit 63b7078

Browse files
committed
Fix display tab "New page" on fresh project
1 parent 9f6c4c4 commit 63b7078

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

Yafc.Model/Model/Project.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ public override ModelObject? ownerObject {
4545
internal set => throw new NotSupportedException();
4646
}
4747

48+
public void AssureFirstPage() {
49+
if (pages.Count == 0) {
50+
ProjectPage firstPage = new ProjectPage(this, typeof(ProductionTable));
51+
pages.Add(firstPage);
52+
pagesByGuid[firstPage.guid] = firstPage;
53+
54+
displayPages.Add(firstPage.guid);
55+
}
56+
}
57+
4858
private void UpdatePageMapping() {
4959
hiddenPages = 0;
5060
pagesByGuid.Clear();

Yafc/Windows/MainScreen.cs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,7 @@ private void SetProject(Project project) {
7979
this.project = project;
8080
if (project.justCreated) {
8181
_ = ShowPseudoScreen(new MilestonesPanel());
82-
}
83-
84-
if (project.pages.Count == 0) {
85-
ProjectPage firstPage = new ProjectPage(project, typeof(ProductionTable));
86-
project.pages.Add(firstPage);
87-
}
88-
89-
if (project.displayPages.Count == 0) {
90-
project.displayPages.Add(project.pages[0].guid);
82+
project.AssureFirstPage();
9183
}
9284

9385
// Hack to activate all page solvers for the summary view

0 commit comments

Comments
 (0)