Added messaging pipeline

This commit is contained in:
TheXamlGuy
2024-01-06 13:57:18 +00:00
parent 4a27534e39
commit 53537aa4c7
60 changed files with 609 additions and 141 deletions
+6 -9
View File
@@ -1,18 +1,15 @@
using Hyperbar.Lifecycles;
using Hyperbar.Templates;
using System.Collections.Generic;
namespace Hyperbar.Windows;
namespace Hyperbar.Windows;
public partial class CommandViewModel :
ObservableCollectionViewModel,
ObservableCollectionViewModel<IWidgetViewModel>,
ITemplatedViewModel
{
public CommandViewModel(ITemplateFactory templateFactory,
IEnumerable<IWidgetViewModel> commands)
public CommandViewModel(ITemplateFactory templateFactory,
IServiceFactory serviceFactory,
IEnumerable<IWidgetViewModel> widgets) : base(serviceFactory)
{
TemplateFactory = templateFactory;
AddRange(commands);
AddRange(widgets);
}
public ITemplateFactory TemplateFactory { get; }
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8" ?>
<UserControl
x:Class="Hyperbar.Windows.WidgetButtonView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<UserControl.Resources>
<SolidColorBrush x:Key="ButtonBackground" Color="Transparent" />
<SolidColorBrush x:Key="ButtonBorderBrush" Color="Transparent" />
<SolidColorBrush x:Key="ButtonBorderBrushPointerOver" Color="Transparent" />
<SolidColorBrush x:Key="ButtonBorderBrushPressed" Color="Transparent" />
<SolidColorBrush x:Key="ButtonBorderBrushDisabled" Color="Transparent" />
<x:Double x:Key="ButtonWidth">32</x:Double>
<x:Double x:Key="ButtonHeight">32</x:Double>
</UserControl.Resources>
<Button
Width="{StaticResource ButtonWidth}"
Height="{StaticResource ButtonHeight}"
Command="{Binding Click}"
Content="{Binding Icon}" />
</UserControl>
@@ -0,0 +1,9 @@
using Microsoft.UI.Xaml.Controls;
namespace Hyperbar.Windows;
public sealed partial class WidgetButtonView :
UserControl
{
public WidgetButtonView() => InitializeComponent();
}
+7 -1
View File
@@ -3,5 +3,11 @@
x:Class="Hyperbar.Windows.WidgetView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid />
<ItemsControl ItemTemplateSelector="{Binding TemplateFactory}" ItemsSource="{Binding}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" Spacing="8" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</UserControl>