Added primaey commands extenion/plugin

This commit is contained in:
TheXamlGuy
2024-01-04 23:02:51 +00:00
parent 97270eeed4
commit d94add17f9
14 changed files with 120 additions and 47 deletions
@@ -0,0 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<RootNamespace>Hyperbar.Desktop.Primary</RootNamespace>
<RuntimeIdentifiers>win10-x86;win10-x64;win10-arm64</RuntimeIdentifiers>
<UseWinUI>true</UseWinUI>
<UseRidGraph>true</UseRidGraph>
</PropertyGroup>
<ItemGroup>
<None Remove="PrimaryCommandView.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="PrimaryCommandView.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
</Project>
@@ -0,0 +1,13 @@
using Microsoft.Extensions.DependencyInjection;
namespace Hyperbar.Desktop.Primary;
public class PrimaryCommandBuilder :
ICommandBuilder
{
public void Create(IServiceCollection services)
{
services.AddCommandTemplate<PrimaryCommandViewModel, PrimaryCommandView>();
}
}
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
<Page
x:Class="Hyperbar.Desktop.Primary.PrimaryCommandView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid>
<Button Content="Primary commands" />
</Grid>
</Page>
@@ -0,0 +1,8 @@
using Microsoft.UI.Xaml.Controls;
namespace Hyperbar.Desktop.Primary;
public sealed partial class PrimaryCommandView : Page
{
public PrimaryCommandView() => InitializeComponent();
}
@@ -0,0 +1,9 @@
namespace Hyperbar.Desktop.Primary;
public class PrimaryCommandViewModel(ITemplateFactory templateFactory) :
ICommandViewModel,
ITemplatedViewModel
{
public ITemplateFactory TemplateFactory { get; } = templateFactory;
}