rename property

This commit is contained in:
Matt Parker
2025-10-02 20:16:26 +10:00
parent 9c1dcbdf6c
commit f325b546b8
4 changed files with 10 additions and 10 deletions

View File

@@ -4,7 +4,7 @@ public class AppState
{
public string? LastOpenSolutionFilePath { get; set; }
public IdeSettings IdeSettings { get; set; } = new IdeSettings();
public HashSet<PreviouslyOpenedSln> PreviouslyOpenedSolutions { get; set; } = [];
public HashSet<RecentSln> RecentSlns { get; set; } = [];
}
public class IdeSettings
@@ -12,7 +12,7 @@ public class IdeSettings
public bool AutoOpenLastSolution { get; set; }
}
public record PreviouslyOpenedSln
public record RecentSln
{
public required string Name { get; set; }
public required string FilePath { get; set; }

View File

@@ -9,16 +9,16 @@ public partial class PreviousSlnEntry : HBoxContainer
private Label _slnNameLabel = null!;
private Panel _slnColourPanel = null!;
public PreviouslyOpenedSln PreviouslyOpenedSln { get; set; } = null!;
public RecentSln RecentSln { get; set; } = null!;
public override void _Ready()
{
if (PreviouslyOpenedSln is null) return;
if (RecentSln is null) return;
_slnNameLabel = GetNode<Label>("%SlnNameLabel");
_slnPathLabel = GetNode<Label>("%SlnPathLabel");
_slnColourPanel = GetNode<Panel>("Panel");
_slnNameLabel.Text = PreviouslyOpenedSln.Name;
_slnPathLabel.Text = PreviouslyOpenedSln.FilePath;
_slnColourPanel.Modulate = RandomRecentSlnColours.GetColourForFilePath(PreviouslyOpenedSln.FilePath);
_slnNameLabel.Text = RecentSln.Name;
_slnPathLabel.Text = RecentSln.FilePath;
_slnColourPanel.Modulate = RandomRecentSlnColours.GetColourForFilePath(RecentSln.FilePath);
}
}

View File

@@ -33,10 +33,10 @@ public partial class SlnPicker : Control
private void PopulatePreviousSolutions()
{
_previousSlnsVBoxContainer.QueueFreeChildren();
foreach (var previousSln in Singletons.AppState.PreviouslyOpenedSolutions.Reverse())
foreach (var previousSln in Singletons.AppState.RecentSlns.Reverse())
{
var node = _previousSlnEntryScene.Instantiate<PreviousSlnEntry>();
node.PreviouslyOpenedSln = previousSln;
node.RecentSln = previousSln;
_previousSlnsVBoxContainer.AddChild(node);
}
}

View File

@@ -79,7 +79,7 @@ public partial class IdeWindow : Control
return;
}
ideRoot.SetSlnFilePath(slnPath);
Singletons.AppState.PreviouslyOpenedSolutions.Add(new PreviouslyOpenedSln { FilePath = slnPath, Name = Path.GetFileName(slnPath) });
Singletons.AppState.RecentSlns.Add(new RecentSln { FilePath = slnPath, Name = Path.GetFileName(slnPath) });
await this.InvokeAsync(() =>
{