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
@@ -0,0 +1,11 @@
using Microsoft.Extensions.DependencyInjection;
namespace Hyperbar.Desktop.Contextual;
public class ContextualCommandBuilder : ICommandBuilder
{
public void Create(IServiceCollection services)
{
services.AddCommandTemplate<ContextualCommandViewModel, ContextualCommandView>();
}
}
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" ?>
<Page
x:Class="Hyperbar.Desktop.Contextual.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.Contextual"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
mc:Ignorable="d">
<Grid>
<Button Content="This is a test" />
</Grid>
</Page>
@@ -0,0 +1,8 @@
using Microsoft.UI.Xaml.Controls;
namespace Hyperbar.Desktop.Contextual;
public sealed partial class ContextualCommandView : Page
{
public ContextualCommandView() => InitializeComponent();
}
@@ -0,0 +1,13 @@
namespace Hyperbar.Desktop.Contextual;
public class ContextualCommandViewModel :
ICommandViewModel,
ITemplatedViewModel
{
public ContextualCommandViewModel(ITemplateFactory templateFactory)
{
TemplateFactory = templateFactory;
}
public ITemplateFactory TemplateFactory { get; }
}
@@ -0,0 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<RootNamespace>Hyperbar.Desktop.Contextual</RootNamespace>
<RuntimeIdentifiers>win10-x86;win10-x64;win10-arm64</RuntimeIdentifiers>
<UseWinUI>true</UseWinUI>
<UseRidGraph>true</UseRidGraph>
</PropertyGroup>
<ItemGroup>
<None Remove="ContextualCommandView.xaml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.5.231202003-experimental1" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.25936-preview" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Hyperbar\Hyperbar.csproj" />
</ItemGroup>
<ItemGroup>
<Page Update="ContextualCommandView.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
</Project>