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:
@@ -0,0 +1,28 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
|
||||
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
|
||||
<RootNamespace>Hyperbar.Windows.Primary</RootNamespace>
|
||||
<RuntimeIdentifiers>win10-x86;win10-x64;win10-arm64</RuntimeIdentifiers>
|
||||
<UseWinUI>true</UseWinUI>
|
||||
<UseRidGraph>true</UseRidGraph>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<IsAotCompatible>True</IsAotCompatible>
|
||||
<IsTrimmable>True</IsTrimmable>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<IsAotCompatible>True</IsAotCompatible>
|
||||
<IsTrimmable>True</IsTrimmable>
|
||||
</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\Hyperbar.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace Hyperbar.Windows.Primary;
|
||||
|
||||
public interface IPrimaryCommand
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace Hyperbar.Windows.Primary;
|
||||
|
||||
public class KeyAcceleratorCommand :
|
||||
IPrimaryCommand
|
||||
{
|
||||
public string? Icon { get; set; }
|
||||
|
||||
public string? Key { get; set; }
|
||||
|
||||
public string[]? Modifiers { get; set; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace Hyperbar.Windows.Primary;
|
||||
|
||||
public class PrimaryCommandConfiguration : List<IPrimaryCommand>
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
using Hyperbar.Lifecycles;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace Hyperbar.Windows.Primary;
|
||||
|
||||
public class PrimaryCommandWidgetBuilder :
|
||||
ICommandWidgetBuilder
|
||||
{
|
||||
public void Create(IServiceCollection services)
|
||||
{
|
||||
services.AddWritableConfiguration<PrimaryCommandConfiguration>()
|
||||
.AddCommandTemplate<PrimaryCommandWidgetViewModel, PrimaryCommandWidgetView>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<Page
|
||||
x:Class="Hyperbar.Windows.Primary.PrimaryCommandWidgetView"
|
||||
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.Windows.Primary;
|
||||
|
||||
public sealed partial class PrimaryCommandWidgetView : Page
|
||||
{
|
||||
public PrimaryCommandWidgetView() => InitializeComponent();
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using Hyperbar.Lifecycles;
|
||||
using Hyperbar.Templates;
|
||||
using Windows.System;
|
||||
|
||||
namespace Hyperbar.Windows.Primary;
|
||||
|
||||
public class PrimaryCommandWidgetViewModel :
|
||||
ICommandWidgetViewModel,
|
||||
ITemplatedViewModel
|
||||
{
|
||||
public PrimaryCommandWidgetViewModel(ITemplateFactory templateFactory,
|
||||
IWritableConfiguration<PrimaryCommandConfiguration> configuration)
|
||||
{
|
||||
TemplateFactory = templateFactory;
|
||||
|
||||
configuration.Write(args => { args.Add(new KeyAcceleratorCommand { Key = $"138" , Modifiers = [$"{VirtualKey.LeftWindows}"] }); });
|
||||
configuration.Write(args => { args.Add(new KeyAcceleratorCommand { Key = $"{VirtualKey.Tab}", Modifiers = [$"{VirtualKey.LeftWindows}"] }); });
|
||||
configuration.Write(args => { args.Add(new KeyAcceleratorCommand { Key = $"{VirtualKey.L}", Modifiers = [$"{VirtualKey.LeftWindows}", $"{VirtualKey.Control}"] }); });
|
||||
}
|
||||
|
||||
public ITemplateFactory TemplateFactory { get; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user