add uid loading support
This commit is contained in:
@@ -10,7 +10,7 @@ public class TemplateGenerator : DataTemplateSelector
|
|||||||
{
|
{
|
||||||
string xamlString = @"
|
string xamlString = @"
|
||||||
<DataTemplate xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'
|
<DataTemplate xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'
|
||||||
xmlns:ui='using:Hyperbar.Windows.UI'>
|
xmlns:ui='using:Hyperbar.UI.Windows'>
|
||||||
<ui:TemplateGeneratorControl />
|
<ui:TemplateGeneratorControl />
|
||||||
</DataTemplate>";
|
</DataTemplate>";
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@ public class TemplateGenerator : DataTemplateSelector
|
|||||||
{
|
{
|
||||||
string xamlString = @"
|
string xamlString = @"
|
||||||
<DataTemplate xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'
|
<DataTemplate xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'
|
||||||
xmlns:ui='using:Hyperbar.Windows.UI'>
|
xmlns:ui='using:Hyperbar.UI.Windows'>
|
||||||
<ui:TemplateGeneratorControl />
|
<ui:TemplateGeneratorControl />
|
||||||
</DataTemplate>";
|
</DataTemplate>";
|
||||||
|
|
||||||
|
|||||||
@@ -8,10 +8,43 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.5.231202003-experimental1" />
|
<None Remove="WidgetBarView.xaml" />
|
||||||
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26031-preview" />
|
<None Remove="WidgetButtonView.xaml" />
|
||||||
|
<None Remove="WidgetContainerView.xaml" />
|
||||||
|
<None Remove="WidgetSplitButtonView.xaml" />
|
||||||
|
<None Remove="WidgetView.xaml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Hyperbar\Hyperbar.csproj" />
|
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.5.231202003-experimental1" />
|
||||||
|
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26031-preview" />
|
||||||
|
<PackageReference Include="Microsoft.Xaml.Behaviors.WinUI.Managed" Version="2.0.9" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Hyperbar.Interop.Windows\Hyperbar.Interop.Windows.csproj" />
|
||||||
|
<ProjectReference Include="..\Hyperbar.UI.Windows\Hyperbar.UI.Windows.csproj" />
|
||||||
|
<ProjectReference Include="..\Hyperbar.Widget\Hyperbar.Widget.csproj" />
|
||||||
|
<ProjectReference Include="..\Hyperbar\Hyperbar.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Page Update="WidgetBarView.xaml">
|
||||||
|
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Page Update="WidgetButtonView.xaml">
|
||||||
|
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Page Update="WidgetContainerView.xaml">
|
||||||
|
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Page Update="WidgetSplitButtonView.xaml">
|
||||||
|
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Page Update="WidgetView.xaml">
|
||||||
|
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
using Hyperbar.Interop.Windows;
|
||||||
|
using Hyperbar.UI.Windows;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
|
namespace Hyperbar.Widget.Windows;
|
||||||
|
|
||||||
|
public static class IServiceCollectionExtensions
|
||||||
|
{
|
||||||
|
public static IServiceCollection AddWidgetWindows(this IServiceCollection services)
|
||||||
|
{
|
||||||
|
services.AddContentTemplate<WidgetBarViewModel, WidgetBarView>();
|
||||||
|
|
||||||
|
// We need to feed information to the Widgets about our Windows host,
|
||||||
|
// so the Windows host can make discussions how to display and interact with the widgets.
|
||||||
|
|
||||||
|
services.AddTransient<IProxyServiceCollection<IWidgetBuilder>>(provider =>
|
||||||
|
new ProxyServiceCollection<IWidgetBuilder>(services =>
|
||||||
|
{
|
||||||
|
services.AddSingleton(provider.GetRequiredService<IDispatcher>());
|
||||||
|
services.AddTransient<IFactory<IWidgetHost, WidgetContainerViewModel?>,
|
||||||
|
WidgetContainerFactory>();
|
||||||
|
|
||||||
|
services.AddTransient<ITemplateFactory, TemplateFactory>();
|
||||||
|
|
||||||
|
services.AddScoped<IVirtualKeyboard, VirtualKeyboard>();
|
||||||
|
services.AddHandler<KeyAcceleratorHandler>();
|
||||||
|
services.AddHandler<StartProcessHandler>();
|
||||||
|
|
||||||
|
services.AddHandler<WidgetViewModelEnumerator>();
|
||||||
|
|
||||||
|
services.AddTransient<IWidgetView, WidgetView>();
|
||||||
|
services.AddTransient<IInitializer, WidgetResourceInitialization>();
|
||||||
|
|
||||||
|
services.AddContentTemplate<WidgetContainerViewModel, WidgetContainerView>();
|
||||||
|
services.AddContentTemplate<WidgetButtonViewModel, WidgetButtonView>();
|
||||||
|
services.AddContentTemplate<WidgetSplitButtonViewModel, WidgetSplitButtonView>();
|
||||||
|
}));
|
||||||
|
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
using Windows.ApplicationModel.Resources.Core;
|
|
||||||
using Windows.Storage;
|
|
||||||
|
|
||||||
namespace Hyperbar.Widget;
|
|
||||||
|
|
||||||
public interface IWidgetResourceInitialization :
|
|
||||||
IInitializer
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public class WidgetResourceInitialization :
|
|
||||||
IInitializer
|
|
||||||
{
|
|
||||||
public async Task InitializeAsync()
|
|
||||||
{
|
|
||||||
//FileInfo resourcePriFileInfo = new(Path.Combine(ForeignAssemblyDir, "resources.pri"));
|
|
||||||
//if (!resourcePriFileInfo.Exists)
|
|
||||||
//{
|
|
||||||
// resourcePriFileInfo = new(Path.Combine(ForeignAssemblyDir, $"{ForeignAssemblyName}.pri"));
|
|
||||||
//}
|
|
||||||
|
|
||||||
//if (!resourcePriFileInfo.Exists)
|
|
||||||
//{
|
|
||||||
// return;
|
|
||||||
//}
|
|
||||||
|
|
||||||
//StorageFile file = await StorageFile.GetFileFromPathAsync(resourcePriFileInfo.FullName);
|
|
||||||
//ResourceManager.Current.LoadPriFiles(new[] { file });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
using Hyperbar.Interop.Windows;
|
using Hyperbar.Interop.Windows;
|
||||||
|
|
||||||
namespace Hyperbar.Windows;
|
namespace Hyperbar.Widget.Windows;
|
||||||
|
|
||||||
public class KeyAcceleratorHandler(IVirtualKeyboard virtualKeyboard) :
|
internal class KeyAcceleratorHandler(IVirtualKeyboard virtualKeyboard) :
|
||||||
IHandler<KeyAccelerator>
|
IHandler<KeyAccelerator>
|
||||||
{
|
{
|
||||||
public Task<Unit> Handle(KeyAccelerator request,
|
public Task<Unit> Handle(KeyAccelerator request,
|
||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
|
||||||
namespace Hyperbar.Windows;
|
namespace Hyperbar.Widget.Windows;
|
||||||
|
|
||||||
public class StartProcessHandler :
|
internal class StartProcessHandler :
|
||||||
IHandler<StartProcess>
|
IHandler<StartProcess>
|
||||||
{
|
{
|
||||||
public Task<Unit> Handle(StartProcess request,
|
public Task<Unit> Handle(StartProcess request,
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<UserControl
|
<UserControl
|
||||||
x:Class="Hyperbar.Windows.WidgetBarView"
|
x:Class="Hyperbar.Widget.Windows.WidgetBarView"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:ui="using:Hyperbar.UI.Windows">
|
xmlns:ui="using:Hyperbar.UI.Windows">
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
using Microsoft.UI.Xaml.Controls;
|
using Microsoft.UI.Xaml.Controls;
|
||||||
|
|
||||||
namespace Hyperbar.Windows;
|
namespace Hyperbar.Widget.Windows;
|
||||||
|
|
||||||
public sealed partial class WidgetBarView :
|
public sealed partial class WidgetBarView :
|
||||||
UserControl
|
UserControl
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<UserControl
|
<UserControl
|
||||||
x:Class="Hyperbar.Windows.WidgetButtonView"
|
x:Class="Hyperbar.Widget.Windows.WidgetButtonView"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
using Microsoft.UI.Xaml.Controls;
|
using Microsoft.UI.Xaml.Controls;
|
||||||
|
|
||||||
namespace Hyperbar.Windows;
|
namespace Hyperbar.Widget.Windows;
|
||||||
|
|
||||||
public sealed partial class WidgetButtonView :
|
public sealed partial class WidgetButtonView :
|
||||||
UserControl
|
UserControl
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<UserControl
|
<UserControl
|
||||||
x:Class="Hyperbar.Windows.WidgetContainerView"
|
x:Class="Hyperbar.Widget.Windows.WidgetContainerView"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:interactions="using:Microsoft.Xaml.Interactions.Core"
|
xmlns:interactions="using:Microsoft.Xaml.Interactions.Core"
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
using Microsoft.UI.Xaml.Controls;
|
using Microsoft.UI.Xaml.Controls;
|
||||||
|
|
||||||
namespace Hyperbar.Windows;
|
namespace Hyperbar.Widget.Windows;
|
||||||
|
|
||||||
public sealed partial class WidgetContainerView :
|
public sealed partial class WidgetContainerView :
|
||||||
UserControl
|
UserControl
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using Windows.ApplicationModel.Resources.Core;
|
||||||
|
using Windows.Storage;
|
||||||
|
|
||||||
|
namespace Hyperbar.Widget.Windows;
|
||||||
|
|
||||||
|
internal class WidgetResourceInitialization(IWidgetAssembly widgetAssembly) :
|
||||||
|
IInitializer
|
||||||
|
{
|
||||||
|
public async Task InitializeAsync()
|
||||||
|
{
|
||||||
|
if (widgetAssembly.Assembly is Assembly assembly)
|
||||||
|
{
|
||||||
|
if (Path.GetDirectoryName(assembly.Location) is string assemblyDirectory)
|
||||||
|
{
|
||||||
|
FileInfo resourceFileInfo = new(Path.Combine(assemblyDirectory,
|
||||||
|
"resources.pri"));
|
||||||
|
|
||||||
|
if (!resourceFileInfo.Exists)
|
||||||
|
{
|
||||||
|
resourceFileInfo = new(Path.Combine(assemblyDirectory,
|
||||||
|
$"{assembly.GetName().Name}.pri"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!resourceFileInfo.Exists)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
StorageFile file = await StorageFile.GetFileFromPathAsync(resourceFileInfo.FullName);
|
||||||
|
ResourceManager.Current.LoadPriFiles(new[] { file });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<UserControl
|
<UserControl
|
||||||
x:Class="Hyperbar.Windows.WidgetSplitButtonView"
|
x:Class="Hyperbar.Widget.Windows.WidgetSplitButtonView"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
using Microsoft.UI.Xaml.Controls;
|
using Microsoft.UI.Xaml.Controls;
|
||||||
|
|
||||||
namespace Hyperbar.Windows;
|
namespace Hyperbar.Widget.Windows;
|
||||||
|
|
||||||
public sealed partial class WidgetSplitButtonView :
|
public sealed partial class WidgetSplitButtonView :
|
||||||
UserControl
|
UserControl
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<UserControl
|
<UserControl
|
||||||
x:Class="Hyperbar.Windows.WidgetView"
|
x:Class="Hyperbar.Widget.Windows.WidgetView"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:interactions="using:Microsoft.Xaml.Interactions.Core"
|
xmlns:interactions="using:Microsoft.Xaml.Interactions.Core"
|
||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
using Hyperbar.Widget;
|
using Hyperbar.Widget;
|
||||||
using Microsoft.UI.Xaml.Controls;
|
using Microsoft.UI.Xaml.Controls;
|
||||||
|
|
||||||
namespace Hyperbar.Windows;
|
namespace Hyperbar.Widget.Windows;
|
||||||
|
|
||||||
public sealed partial class WidgetView :
|
public sealed partial class WidgetView :
|
||||||
UserControl,
|
UserControl,
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
using System.Reflection;
|
namespace Hyperbar.Widget;
|
||||||
namespace Hyperbar.Widget;
|
|
||||||
|
|
||||||
public record WidgetExtension(IWidget Widget, IWidgetAssembly Assembly);
|
public record WidgetExtension(IWidget Widget, IWidgetAssembly Assembly);
|
||||||
@@ -3,8 +3,7 @@
|
|||||||
namespace Hyperbar.Widget;
|
namespace Hyperbar.Widget;
|
||||||
|
|
||||||
public class WidgetExtensionHandler(IProxyServiceCollection<IWidgetBuilder> typedServices,
|
public class WidgetExtensionHandler(IProxyServiceCollection<IWidgetBuilder> typedServices,
|
||||||
IServiceProvider provider,
|
IServiceProvider provider) :
|
||||||
IMediator mediator) :
|
|
||||||
INotificationHandler<Created<WidgetExtension>>
|
INotificationHandler<Created<WidgetExtension>>
|
||||||
{
|
{
|
||||||
public async Task Handle(Created<WidgetExtension> notification,
|
public async Task Handle(Created<WidgetExtension> notification,
|
||||||
@@ -18,14 +17,12 @@ public class WidgetExtensionHandler(IProxyServiceCollection<IWidgetBuilder> type
|
|||||||
{
|
{
|
||||||
args.AddSingleton(widgetExtension.Assembly);
|
args.AddSingleton(widgetExtension.Assembly);
|
||||||
args.AddTransient(_ => provider.GetRequiredService<IProxyService<IMediator>>());
|
args.AddTransient(_ => provider.GetRequiredService<IProxyService<IMediator>>());
|
||||||
|
|
||||||
args.AddRange(typedServices.Services);
|
args.AddRange(typedServices.Services);
|
||||||
});
|
});
|
||||||
|
|
||||||
IWidgetHost host = builder.Build();
|
IWidgetHost host = builder.Build();
|
||||||
await host.InitializeAsync();
|
await host.InitializeAsync();
|
||||||
|
|
||||||
await mediator.PublishAsync(new Created<IWidgetHost>(host),
|
|
||||||
cancellationToken);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,28 +6,26 @@ public class WidgetHost :
|
|||||||
INotificationHandler<Changed<WidgetAvailability>>,
|
INotificationHandler<Changed<WidgetAvailability>>,
|
||||||
IWidgetHost
|
IWidgetHost
|
||||||
{
|
{
|
||||||
private readonly IConfigurationInitializer<WidgetConfiguration> configurationInitializer;
|
|
||||||
private readonly IServiceProvider services;
|
|
||||||
private readonly IEnumerable<IInitializer> initializers;
|
private readonly IEnumerable<IInitializer> initializers;
|
||||||
private readonly IMediator mediator;
|
private readonly IMediator mediator;
|
||||||
private readonly IProxyService<IMediator> proxyMediator;
|
private readonly IProxyService<IMediator> proxyMediator;
|
||||||
|
private readonly IServiceProvider services;
|
||||||
|
|
||||||
public WidgetHost(IServiceProvider services,
|
public WidgetHost(IServiceProvider services,
|
||||||
IMediator mediator,
|
IMediator mediator,
|
||||||
IEnumerable<IInitializer> initializers,
|
IEnumerable<IInitializer> initializers,
|
||||||
IProxyService<IMediator> proxyMediator,
|
IProxyService<IMediator> proxyMediator)
|
||||||
IConfigurationInitializer<WidgetConfiguration> configurationInitializer)
|
|
||||||
{
|
{
|
||||||
this.services = services;
|
this.services = services;
|
||||||
this.mediator = mediator;
|
this.mediator = mediator;
|
||||||
this.initializers = initializers;
|
this.initializers = initializers;
|
||||||
this.proxyMediator = proxyMediator;
|
this.proxyMediator = proxyMediator;
|
||||||
this.configurationInitializer = configurationInitializer;
|
|
||||||
|
|
||||||
mediator.Subscribe(this);
|
mediator.Subscribe(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public WidgetConfiguration Configuration => services.GetRequiredService<WidgetConfiguration>();
|
public WidgetConfiguration Configuration =>
|
||||||
|
services.GetRequiredService<WidgetConfiguration>();
|
||||||
|
|
||||||
public IServiceProvider Services => services;
|
public IServiceProvider Services => services;
|
||||||
|
|
||||||
@@ -43,7 +41,13 @@ public class WidgetHost :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task InitializeAsync() => await configurationInitializer.InitializeAsync();
|
public async Task InitializeAsync()
|
||||||
|
{
|
||||||
|
foreach (IInitializer initializer in initializers)
|
||||||
|
{
|
||||||
|
await initializer.InitializeAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async Task StartAsync()
|
private async Task StartAsync()
|
||||||
{
|
{
|
||||||
@@ -51,10 +55,5 @@ public class WidgetHost :
|
|||||||
{
|
{
|
||||||
await mediator.PublishAsync(new Started<IWidgetHost>(this));
|
await mediator.PublishAsync(new Started<IWidgetHost>(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (IInitializer initializer in initializers)
|
|
||||||
{
|
|
||||||
await initializer.InitializeAsync();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
using CustomExtensions.WinUI;
|
using CustomExtensions.WinUI;
|
||||||
using Hyperbar.Controls.Windows;
|
using Hyperbar.Controls.Windows;
|
||||||
using Hyperbar.Interop.Windows;
|
|
||||||
using Hyperbar.UI.Windows;
|
using Hyperbar.UI.Windows;
|
||||||
using Hyperbar.Widget;
|
using Hyperbar.Widget;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
@@ -9,6 +8,7 @@ using Microsoft.Extensions.Hosting;
|
|||||||
using Microsoft.UI.Dispatching;
|
using Microsoft.UI.Dispatching;
|
||||||
using Microsoft.UI.Xaml;
|
using Microsoft.UI.Xaml;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using Hyperbar.Widget.Windows;
|
||||||
|
|
||||||
namespace Hyperbar.Windows;
|
namespace Hyperbar.Windows;
|
||||||
|
|
||||||
@@ -36,6 +36,8 @@ public partial class App :
|
|||||||
{
|
{
|
||||||
services.AddDefault();
|
services.AddDefault();
|
||||||
services.AddWidget();
|
services.AddWidget();
|
||||||
|
services.AddWidgetWindows();
|
||||||
|
|
||||||
services.AddHostedService<AppService>();
|
services.AddHostedService<AppService>();
|
||||||
|
|
||||||
services.AddSingleton<IDispatcher>(new Dispatcher(DispatcherQueue.GetForCurrentThread()));
|
services.AddSingleton<IDispatcher>(new Dispatcher(DispatcherQueue.GetForCurrentThread()));
|
||||||
@@ -50,30 +52,6 @@ public partial class App :
|
|||||||
services.AddTransient<IInitializer, AppInitializer>();
|
services.AddTransient<IInitializer, AppInitializer>();
|
||||||
|
|
||||||
services.AddSingleton<DesktopBar>();
|
services.AddSingleton<DesktopBar>();
|
||||||
services.AddContentTemplate<WidgetBarViewModel, WidgetBarView>();
|
|
||||||
|
|
||||||
services.AddTransient<IProxyServiceCollection<IWidgetBuilder>>(provider =>
|
|
||||||
new ProxyServiceCollection<IWidgetBuilder>(services =>
|
|
||||||
{
|
|
||||||
services.AddSingleton<IDispatcher>(new Dispatcher(DispatcherQueue.GetForCurrentThread()));
|
|
||||||
|
|
||||||
services.AddTransient<IFactory<IWidgetHost, WidgetContainerViewModel?>,
|
|
||||||
WidgetContainerFactory>();
|
|
||||||
|
|
||||||
services.AddTransient<ITemplateFactory, TemplateFactory>();
|
|
||||||
|
|
||||||
services.AddScoped<IVirtualKeyboard, VirtualKeyboard>();
|
|
||||||
services.AddHandler<KeyAcceleratorHandler>();
|
|
||||||
services.AddHandler<StartProcessHandler>();
|
|
||||||
|
|
||||||
services.AddHandler<WidgetViewModelEnumerator>();
|
|
||||||
|
|
||||||
services.AddTransient<IWidgetView, WidgetView>();
|
|
||||||
|
|
||||||
services.AddContentTemplate<WidgetContainerViewModel, WidgetContainerView>();
|
|
||||||
services.AddContentTemplate<WidgetButtonViewModel, WidgetButtonView>();
|
|
||||||
services.AddContentTemplate<WidgetSplitButtonViewModel, WidgetSplitButtonView>();
|
|
||||||
}));
|
|
||||||
})
|
})
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
|||||||
@@ -13,11 +13,6 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<UseRidGraph>true</UseRidGraph>
|
<UseRidGraph>true</UseRidGraph>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
|
||||||
<None Remove="Views\WidgetButtonView.xaml" />
|
|
||||||
<None Remove="Views\WidgetContainerView.xaml" />
|
|
||||||
<None Remove="Views\WidgetSplitButtonView.xaml" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="Assets\SplashScreen.scale-200.png" />
|
<Content Include="Assets\SplashScreen.scale-200.png" />
|
||||||
<Content Include="Assets\LockScreenLogo.scale-200.png" />
|
<Content Include="Assets\LockScreenLogo.scale-200.png" />
|
||||||
@@ -49,6 +44,7 @@
|
|||||||
<ProjectReference Include="..\Hyperbar.Controls.Windows\Hyperbar.Controls.Windows.csproj" />
|
<ProjectReference Include="..\Hyperbar.Controls.Windows\Hyperbar.Controls.Windows.csproj" />
|
||||||
<ProjectReference Include="..\Hyperbar.Interop.Windows\Hyperbar.Interop.Windows.csproj" />
|
<ProjectReference Include="..\Hyperbar.Interop.Windows\Hyperbar.Interop.Windows.csproj" />
|
||||||
<ProjectReference Include="..\Hyperbar.UI.Windows\Hyperbar.UI.Windows.csproj" />
|
<ProjectReference Include="..\Hyperbar.UI.Windows\Hyperbar.UI.Windows.csproj" />
|
||||||
|
<ProjectReference Include="..\Hyperbar.Widget.Windows\Hyperbar.Widget.Windows.csproj" />
|
||||||
<ProjectReference Include="..\Hyperbar.Widget\Hyperbar.Widget.csproj" />
|
<ProjectReference Include="..\Hyperbar.Widget\Hyperbar.Widget.csproj" />
|
||||||
<ProjectReference Include="..\Hyperbar\Hyperbar.csproj" />
|
<ProjectReference Include="..\Hyperbar\Hyperbar.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Hyperbar.Controls.Windows;
|
using Hyperbar.Controls.Windows;
|
||||||
using Hyperbar.Widget;
|
using Hyperbar.Widget;
|
||||||
|
using Hyperbar.Widget.Windows;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
namespace Hyperbar.Windows;
|
namespace Hyperbar.Windows;
|
||||||
|
|||||||
Reference in New Issue
Block a user