Too much to name... but damn, it got where we are needed
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Hyperbar.Windows.Controls;
|
||||
using Hyperbar.Windows.MediaController;
|
||||
using Hyperbar.Windows.Primary;
|
||||
using Hyperbar.Windows.UI;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
@@ -50,7 +51,7 @@ public partial class App :
|
||||
|
||||
services.AddHandler<AppConfigurationChangedHandler>();
|
||||
|
||||
//services.AddWidgetProvider<MediaControllerWidgetProvider>();
|
||||
services.AddWidgetProvider<MediaControllerWidgetProvider>();
|
||||
services.AddWidgetProvider<PrimaryWidgetProvider>();
|
||||
|
||||
services.AddTransient(provider =>
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
<ItemGroup>
|
||||
<None Remove="Views\WidgetButtonView.xaml" />
|
||||
<None Remove="Views\WidgetContainerView.xaml" />
|
||||
<None Remove="Views\WidgetSplitButtonView.xaml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Assets\SplashScreen.scale-200.png" />
|
||||
@@ -45,6 +46,11 @@
|
||||
<ProjectReference Include="..\Hyperbar.Windows.UI\Hyperbar.Windows.UI.csproj" />
|
||||
<ProjectReference Include="..\Hyperbar\Hyperbar.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Update="Views\WidgetSplitButtonView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Update="Views\WidgetContainerView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
@@ -28,24 +28,25 @@ namespace Hyperbar.Windows
|
||||
})
|
||||
.ConfigureServices((context, isolatedServices) =>
|
||||
{
|
||||
isolatedServices.AddSingleton<IServiceFactory>(provider =>
|
||||
isolatedServices.AddScoped<IServiceFactory>(provider =>
|
||||
new ServiceFactory((type, parameters) => ActivatorUtilities.CreateInstance(provider, type, parameters!)));
|
||||
|
||||
isolatedServices.AddHostedService<WidgetService>();
|
||||
|
||||
isolatedServices.AddTransient<ITemplateFactory, TemplateFactory>();
|
||||
isolatedServices.AddSingleton<IMediator, Mediator>();
|
||||
isolatedServices.AddSingleton<IDisposer, Disposer>();
|
||||
isolatedServices.AddScoped<IMediator, Mediator>();
|
||||
isolatedServices.AddScoped<IDisposer, Disposer>();
|
||||
|
||||
isolatedServices.AddSingleton<IVirtualKeyboard, VirtualKeyboard>();
|
||||
isolatedServices.AddScoped<IVirtualKeyboard, VirtualKeyboard>();
|
||||
|
||||
isolatedServices.AddHandler<KeyAcceleratorHandler>();
|
||||
isolatedServices.AddHandler<ProcesssAcceleratorHandler>();
|
||||
isolatedServices.AddHandler<StartProcessHandler>();
|
||||
|
||||
isolatedServices.AddTransient<IWidgetView, WidgetView>();
|
||||
|
||||
isolatedServices.AddContentTemplate<WidgetContainerViewModel, WidgetContainerView>();
|
||||
isolatedServices.AddContentTemplate<WidgetButtonViewModel, WidgetButtonView>();
|
||||
isolatedServices.AddContentTemplate<WidgetSplitButtonViewModel, WidgetSplitButtonView>();
|
||||
|
||||
builder.Create(context, isolatedServices);
|
||||
|
||||
|
||||
@@ -1,26 +1,14 @@
|
||||
using Hyperbar.Windows.Interop;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Hyperbar.Windows;
|
||||
|
||||
public class KeyAcceleratorHandler(IVirtualKeyboard virtualKeyboard) :
|
||||
IRequestHandler<KeyAcceleratorRequest>
|
||||
IRequestHandler<KeyAccelerator>
|
||||
{
|
||||
public ValueTask<Unit> Handle(KeyAcceleratorRequest request,
|
||||
public ValueTask<Unit> Handle(KeyAccelerator request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
virtualKeyboard.Send((int)request.Key, request.Modifiers?.Select(modifier => (int)modifier).ToArray() ?? []);
|
||||
return default;
|
||||
}
|
||||
}
|
||||
|
||||
public class ProcesssAcceleratorHandler :
|
||||
IRequestHandler<ProcessRequest>
|
||||
{
|
||||
public ValueTask<Unit> Handle(ProcessRequest request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
Process.Start(request.Process);
|
||||
return default;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Hyperbar.Windows;
|
||||
|
||||
public class StartProcessHandler :
|
||||
IRequestHandler<StartProcess>
|
||||
{
|
||||
public ValueTask<Unit> Handle(StartProcess request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
Process.Start(request.Process);
|
||||
return default;
|
||||
}
|
||||
}
|
||||
@@ -20,5 +20,6 @@
|
||||
Command="{Binding Click}"
|
||||
Content="{Binding Icon}"
|
||||
FontFamily="{StaticResource SymbolThemeFontFamily}"
|
||||
FontSize="16" />
|
||||
FontSize="16"
|
||||
ToolTipService.ToolTip="{Binding Text}" />
|
||||
</UserControl>
|
||||
@@ -11,7 +11,7 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
<Rectangle
|
||||
Width="1"
|
||||
Margin="6,8,6,8"
|
||||
Margin="6,2,6,2"
|
||||
Fill="{ThemeResource DividerStrokeColorDefaultBrush}"
|
||||
Visibility="{Binding Alternate}" />
|
||||
<ItemsControl
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<UserControl
|
||||
x:Class="Hyperbar.Windows.WidgetSplitButtonView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<UserControl.Resources>
|
||||
<SolidColorBrush x:Key="SplitButtonBackground" Color="Transparent" />
|
||||
<SolidColorBrush x:Key="SplitButtonBorderBrush" Color="Transparent" />
|
||||
<SolidColorBrush x:Key="SplitButtonBorderBrushPointerOver" Color="Transparent" />
|
||||
<SolidColorBrush x:Key="SplitButtonBorderBrushPressed" Color="Transparent" />
|
||||
<SolidColorBrush x:Key="SplitButtonBorderBrushDisabled" Color="Transparent" />
|
||||
<Thickness x:Key="ButtonPadding">0</Thickness>
|
||||
<x:Double x:Key="ButtonWidth">40</x:Double>
|
||||
<x:Double x:Key="ButtonHeight">38</x:Double>
|
||||
</UserControl.Resources>
|
||||
<SplitButton
|
||||
Height="{StaticResource ButtonHeight}"
|
||||
Margin="0,1,0,0"
|
||||
Command="{Binding Click}"
|
||||
Content="{Binding Icon}"
|
||||
FontFamily="{StaticResource SymbolThemeFontFamily}"
|
||||
FontSize="16">
|
||||
<SplitButton.Flyout>
|
||||
<Flyout ShouldConstrainToRootBounds="False">
|
||||
<ItemsControl Margin="-16,-13,-16,-15" ItemsSource="{Binding}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<MenuFlyoutItem Text="{Binding Text}" />
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</Flyout>
|
||||
</SplitButton.Flyout>
|
||||
</SplitButton>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,9 @@
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
|
||||
namespace Hyperbar.Windows;
|
||||
|
||||
public sealed partial class WidgetSplitButtonView :
|
||||
UserControl
|
||||
{
|
||||
public WidgetSplitButtonView() => InitializeComponent();
|
||||
}
|
||||
@@ -6,7 +6,6 @@
|
||||
xmlns:interactions="using:Microsoft.Xaml.Interactions.Core"
|
||||
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
|
||||
xmlns:ui="using:Hyperbar.Windows.UI">
|
||||
|
||||
<ItemsControl ItemTemplateSelector="{Binding Converter={ui:DataTemplateConverter}}" ItemsSource="{Binding}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
|
||||
Reference in New Issue
Block a user