Rename projects to better structure it. The aim is to try and keep it not dependant on the type of UI framework it uses thus allowing us to switch to another UI framework if we need later...

This commit is contained in:
TheXamlGuy
2024-01-06 08:49:12 +00:00
parent b380f06fbf
commit 3e88950669
67 changed files with 211 additions and 196 deletions
@@ -0,0 +1,15 @@
using Hyperbar.Lifecycles;
using Microsoft.Extensions.DependencyInjection;
namespace Hyperbar.Windows.Contextual;
public class ContextualCommandWidgetBuilder :
ICommandWidgetBuilder
{
public void Create(IServiceCollection services)
{
services
.AddWritableConfiguration<ContextualCommandWidgetConfiguration>()
.AddCommandTemplate<ContextualCommandWidgetViewModel, ContextualCommandWidgetView>();
}
}
@@ -0,0 +1,5 @@
namespace Hyperbar.Windows.Contextual;
public class ContextualCommandWidgetConfiguration
{
}
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
<Page
x:Class="Hyperbar.Windows.Contextual.ContextualCommandWidgetView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid>
<Button Click="Button_Click" Content="This is a test" />
</Grid>
</Page>
@@ -0,0 +1,15 @@
using Hyperbar.Windows.Win32;
using Microsoft.UI.Xaml.Controls;
using Windows.System;
namespace Hyperbar.Windows.Contextual;
public sealed partial class ContextualCommandWidgetView : Page
{
public ContextualCommandWidgetView() => InitializeComponent();
private void Button_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
{
KeyInterop.Type(VirtualKey.L, VirtualKey.LeftWindows, VirtualKey.Control);
}
}
@@ -0,0 +1,11 @@
using Hyperbar.Lifecycles;
using Hyperbar.Templates;
namespace Hyperbar.Windows.Contextual;
public class ContextualCommandWidgetViewModel(ITemplateFactory templateFactory) :
ICommandWidgetViewModel,
ITemplatedViewModel
{
public ITemplateFactory TemplateFactory { get; } = templateFactory;
}
@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<RootNamespace>Hyperbar.Windows.Contextual</RootNamespace>
<RuntimeIdentifiers>win10-x86;win10-x64;win10-arm64</RuntimeIdentifiers>
<UseWinUI>true</UseWinUI>
<UseRidGraph>true</UseRidGraph>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<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.Windows.Win32\Hyperbar.Windows.Win32.csproj" />
<ProjectReference Include="..\Hyperbar\Hyperbar.csproj" />
</ItemGroup>
</Project>