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
@@ -2,7 +2,8 @@ using Microsoft.Extensions.DependencyInjection;
namespace Hyperbar.Desktop.Contextual;
public class ContextualCommandBuilder : ICommandBuilder
public class ContextualCommandBuilder :
ICommandBuilder
{
public void Create(IServiceCollection services)
{
@@ -2,13 +2,7 @@
<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">
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid>
<Button Content="This is a test" Click="Button_Click"/>
</Grid>
@@ -10,6 +10,6 @@ public sealed partial class ContextualCommandView : Page
private void Button_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
{
KeyInterop.Type((VirtualKey)186, VirtualKey.LeftWindows);
KeyInterop.Type(VirtualKey.L, VirtualKey.LeftWindows, VirtualKey.Control);
}
}
@@ -1,13 +1,8 @@
namespace Hyperbar.Desktop.Contextual;
public class ContextualCommandViewModel :
public class ContextualCommandViewModel(ITemplateFactory templateFactory) :
ICommandViewModel,
ITemplatedViewModel
{
public ContextualCommandViewModel(ITemplateFactory templateFactory)
{
TemplateFactory = templateFactory;
}
public ITemplateFactory TemplateFactory { get; }
public ITemplateFactory TemplateFactory { get; } = templateFactory;
}
@@ -1,30 +1,27 @@
<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.Desktop.Win32\Hyperbar.Desktop.Win32.csproj" />
<ProjectReference Include="..\Hyperbar\Hyperbar.csproj" />
</ItemGroup>
<ItemGroup>
<Page Update="ContextualCommandView.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<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.Desktop.Win32\Hyperbar.Desktop.Win32.csproj" />
<ProjectReference Include="..\Hyperbar\Hyperbar.csproj" />
</ItemGroup>
<ItemGroup>
<Page Update="ContextualCommandView.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
</Project>