get plugin system working

This commit is contained in:
TheXamlGuy
2024-01-04 20:53:49 +00:00
parent da8af59391
commit d45076f2a9
24 changed files with 219 additions and 55 deletions
+10 -9
View File
@@ -1,20 +1,21 @@
namespace Hyperbar.Desktop;
using System.Collections;
using System.Collections.Generic;
namespace Hyperbar.Desktop;
public partial class CommandViewModel :
ObservableCollectionViewModel,
ITemplatedViewModel
{
public CommandViewModel(ITemplateFactory templateFactory)
public CommandViewModel(ITemplateFactory templateFactory,
IEnumerable<ICommandViewModel> commands)
{
TemplateFactory = templateFactory;
this.Add(new ContextualCommandViewModel(templateFactory));
this.Add(new ContextualCommandViewModel(templateFactory));
this.Add(new ContextualCommandViewModel(templateFactory));
this.Add(new ContextualCommandViewModel(templateFactory));
this.Add(new ContextualCommandViewModel(templateFactory));
var d = Items;
foreach (var command in commands)
{
this.Add(command);
}
}
public ITemplateFactory TemplateFactory { get; }
@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<Page
x:Class="Hyperbar.Desktop.ContextualCommandView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Hyperbar.Desktop"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
mc:Ignorable="d">
<Grid>
<Button />
</Grid>
</Page>
@@ -1,8 +0,0 @@
using Microsoft.UI.Xaml.Controls;
namespace Hyperbar.Desktop;
public sealed partial class ContextualCommandView : Page
{
public ContextualCommandView() => InitializeComponent();
}
@@ -1,12 +0,0 @@
namespace Hyperbar.Desktop;
public class ContextualCommandViewModel :
ITemplatedViewModel
{
public ContextualCommandViewModel(ITemplateFactory templateFactory)
{
TemplateFactory = templateFactory;
}
public ITemplateFactory TemplateFactory { get; }
}