Initial orderby on primary items

This commit is contained in:
TheXamlGuy
2024-01-17 19:28:21 +00:00
parent 7fde5ab0fb
commit 1f02f6970e
4 changed files with 10 additions and 7 deletions
@@ -6,11 +6,12 @@ namespace Hyperbar.Windows.Primary;
[JsonDerivedType(typeof(ProcessCommandConfiguration), typeDiscriminator: "ProcessCommand")]
public class PrimaryCommandConfiguration
{
public required Guid Id { get; set; }
public List<PrimaryCommandConfiguration> Commands { get; set; } = [];
public required string Icon { get; set; }
public required string Text { get; set; }
public required Guid Id { get; set; }
public List<PrimaryCommandConfiguration> Commands { get; set; } = [];
public required int Order { get; set; }
public required string Text { get; set; }
}
@@ -5,6 +5,6 @@ public class PrimaryWidgetConfiguration :
{
public static PrimaryWidgetConfiguration Defaults => new()
{
new KeyAcceleratorCommandConfiguration { Id = Guid.NewGuid(), Icon = "\uE720", Text = "Test", Key = 91, Modifiers = [] }
new KeyAcceleratorCommandConfiguration { Id = Guid.NewGuid(), Order = 1, Icon = "\uE720", Text = "Test", Key = 91, Modifiers = [] }
};
}
@@ -6,7 +6,7 @@ public class WidgetComponentViewModelEnumerator(PrimaryWidgetConfiguration confi
{
public IEnumerable<IWidgetComponentViewModel?> Next()
{
foreach (PrimaryCommandConfiguration item in configuration)
foreach (PrimaryCommandConfiguration item in configuration.OrderBy(x => x.Order))
{
yield return factory.Create(item);
}
+3 -1
View File
@@ -1,3 +1,5 @@
namespace Hyperbar;
public record Created<TValue>(TValue Value) : INotification;
public record Created<TValue>(TValue Value) : INotification;
public record Inserted<TValue>(int Index, TValue Value) : INotification;