diff --git a/Hyperbar.UI.Windows/TemplateFactory.cs b/Hyperbar.UI.Windows/TemplateFactory.cs index ecc384a..f01c01b 100644 --- a/Hyperbar.UI.Windows/TemplateFactory.cs +++ b/Hyperbar.UI.Windows/TemplateFactory.cs @@ -8,9 +8,11 @@ public class TemplateFactory(IEnumerable descriptors { public object? Create(object key) { - if (descriptors.FirstOrDefault(x => x.Key == key) is IContentTemplateDescriptor descriptor) + if (descriptors.FirstOrDefault(x => x.Key == key) + is IContentTemplateDescriptor descriptor) { - if (provider.GetRequiredKeyedService(descriptor.TemplateType, descriptor.Key) is { } template) + if (provider.GetRequiredKeyedService(descriptor.TemplateType, + descriptor.Key) is { } template) { return template; } diff --git a/Hyperbar.Widget.MediaController.Windows/MediaButtonView.xaml.cs b/Hyperbar.Widget.MediaController.Windows/MediaButtonView.xaml.cs index 8c57d7e..b85eaa2 100644 --- a/Hyperbar.Widget.MediaController.Windows/MediaButtonView.xaml.cs +++ b/Hyperbar.Widget.MediaController.Windows/MediaButtonView.xaml.cs @@ -3,11 +3,12 @@ using Hyperbar.UI.Windows; namespace Hyperbar.Widget.MediaController.Windows; -public sealed partial class MediaButtonView : +public partial class MediaButtonView : UserControl { public MediaButtonView() => this.InitializeComponent(ref _contentLoaded); - private IMediaButtonViewModel ViewModel => (IMediaButtonViewModel)DataContext; + protected IMediaButtonViewModel ViewModel => + (IMediaButtonViewModel)DataContext; } diff --git a/Hyperbar.Widget.MediaController.Windows/MediaControllerHandler.cs b/Hyperbar.Widget.MediaController.Windows/MediaControllerHandler.cs index 0a2d16d..7faf3bc 100644 --- a/Hyperbar.Widget.MediaController.Windows/MediaControllerHandler.cs +++ b/Hyperbar.Widget.MediaController.Windows/MediaControllerHandler.cs @@ -5,10 +5,10 @@ namespace Hyperbar.Widget.MediaController.Windows; public class MediaControllerHandler(IMediator mediator, IServiceScopeProvider scopeProvider, ICache cache) : - INotificationHandler>, - INotificationHandler> + INotificationHandler>, + INotificationHandler> { - public async Task Handle(Created notification, + public async Task Handle(Create notification, CancellationToken cancellationToken) { if (notification.Value is MediaController mediaController && @@ -18,17 +18,17 @@ public class MediaControllerHandler(IMediator mediator, factory.Create(mediaController) is MediaControllerViewModel viewModel) { cache.Add(mediaController, viewModel); - await mediator.PublishAsync(new Created(viewModel), cancellationToken); + await mediator.PublishAsync(new Create(viewModel), cancellationToken); } } - public async Task Handle(Removed notification, CancellationToken cancellationToken) + public async Task Handle(Remove notification, CancellationToken cancellationToken) { if (notification.Value is MediaController mediaController && cache.TryGetValue(mediaController, out MediaControllerViewModel? viewModel) && viewModel is not null) { - await mediator.PublishAsync(new Removed(viewModel), cancellationToken); + await mediator.PublishAsync(new Remove(viewModel), cancellationToken); cache.Remove(mediaController); } } diff --git a/Hyperbar.Widget.MediaController.Windows/MediaControllerService.cs b/Hyperbar.Widget.MediaController.Windows/MediaControllerService.cs index 86a06a6..8dfdb34 100644 --- a/Hyperbar.Widget.MediaController.Windows/MediaControllerService.cs +++ b/Hyperbar.Widget.MediaController.Windows/MediaControllerService.cs @@ -34,7 +34,7 @@ public class MediaControllerService(IMediator mediator, { if (factory.Create(session) is MediaController mediaController) { - await mediator.PublishAsync(new Created(mediaController)); + await mediator.PublishAsync(new Create(mediaController)); cache.Add(new KeyValuePair(session, mediaController)); } @@ -53,7 +53,7 @@ public class MediaControllerService(IMediator mediator, { if (!sessions.Any(x => x.SourceAppUserModelId == session.Key.SourceAppUserModelId)) { - await mediator.PublishAsync(new Removed(session.Value)); + await mediator.PublishAsync(new Remove(session.Value)); cache.Remove(session); } } diff --git a/Hyperbar.Widget.MediaController.Windows/MediaControllerView.xaml b/Hyperbar.Widget.MediaController.Windows/MediaControllerView.xaml index 50fe0d0..6a0cfe1 100644 --- a/Hyperbar.Widget.MediaController.Windows/MediaControllerView.xaml +++ b/Hyperbar.Widget.MediaController.Windows/MediaControllerView.xaml @@ -9,7 +9,7 @@ HorizontalAlignment="Right" HorizontalContentAlignment="Right" ItemTemplateSelector="{Binding Converter={windows:DataTemplateConverter}}" - ItemsSource="{Binding}"> + ItemsSource="{x:Bind ViewModel}"> diff --git a/Hyperbar.Widget.MediaController.Windows/MediaControllerView.xaml.cs b/Hyperbar.Widget.MediaController.Windows/MediaControllerView.xaml.cs index 8ae2da7..b98687e 100644 --- a/Hyperbar.Widget.MediaController.Windows/MediaControllerView.xaml.cs +++ b/Hyperbar.Widget.MediaController.Windows/MediaControllerView.xaml.cs @@ -3,9 +3,12 @@ using Hyperbar.UI.Windows; namespace Hyperbar.Widget.MediaController.Windows; -public sealed partial class MediaControllerView : +public partial class MediaControllerView : UserControl { public MediaControllerView() => this.InitializeComponent(ref _contentLoaded); + + protected MediaControllerViewModel ViewModel => + (MediaControllerViewModel)DataContext; } diff --git a/Hyperbar.Widget.MediaController.Windows/MediaControllerWidgetView.xaml.cs b/Hyperbar.Widget.MediaController.Windows/MediaControllerWidgetView.xaml.cs index 2e6a3a8..1404c3f 100644 --- a/Hyperbar.Widget.MediaController.Windows/MediaControllerWidgetView.xaml.cs +++ b/Hyperbar.Widget.MediaController.Windows/MediaControllerWidgetView.xaml.cs @@ -3,9 +3,12 @@ using Hyperbar.UI.Windows; namespace Hyperbar.Widget.MediaController.Windows; -public sealed partial class MediaControllerWidgetView : +public partial class MediaControllerWidgetView : UserControl { public MediaControllerWidgetView() => this.InitializeComponent(ref _contentLoaded); + + protected MediaControllerWidgetViewModel ViewModel => + (MediaControllerWidgetViewModel)DataContext; } \ No newline at end of file diff --git a/Hyperbar.Widget.MediaController.Windows/MediaInformationView.xaml.cs b/Hyperbar.Widget.MediaController.Windows/MediaInformationView.xaml.cs index dc9484f..bb60da4 100644 --- a/Hyperbar.Widget.MediaController.Windows/MediaInformationView.xaml.cs +++ b/Hyperbar.Widget.MediaController.Windows/MediaInformationView.xaml.cs @@ -3,11 +3,12 @@ using Hyperbar.UI.Windows; namespace Hyperbar.Widget.MediaController.Windows; -public sealed partial class MediaInformationView : +public partial class MediaInformationView : UserControl { public MediaInformationView() => this.InitializeComponent(ref _contentLoaded); - private MediaInformationViewModel ViewModel => (MediaInformationViewModel)DataContext; + protected MediaInformationViewModel ViewModel => + (MediaInformationViewModel)DataContext; } diff --git a/Hyperbar.Widget.Primary.Windows/PrimaryWidgetConfigurationHandler.cs b/Hyperbar.Widget.Primary.Windows/PrimaryWidgetConfigurationHandler.cs index 16ccf02..b2ee4af 100644 --- a/Hyperbar.Widget.Primary.Windows/PrimaryWidgetConfigurationHandler.cs +++ b/Hyperbar.Widget.Primary.Windows/PrimaryWidgetConfigurationHandler.cs @@ -44,7 +44,7 @@ public class PrimaryWidgetConfigurationHandler(IMediator mediator, if (moved.Value is PrimaryCommandConfiguration configuration && provider.Get(configuration) is IWidgetComponentViewModel viewModel) { - await mediator.PublishAsync(new Moved(configuration.Order, viewModel), + await mediator.PublishAsync(new Move(configuration.Order, viewModel), moved.Key.ParentId == Guid.Empty ? nameof(PrimaryWidgetViewModel) : moved.Key.ParentId, cancellationToken); @@ -62,7 +62,7 @@ public class PrimaryWidgetConfigurationHandler(IMediator mediator, factory.Create(configuration) is IWidgetComponentViewModel viewModel) { await mediator.PublishAsync( - new Inserted(configuration.Order, viewModel), + new Insert(configuration.Order, viewModel), added.Key.ParentId == Guid.Empty ? nameof(PrimaryWidgetViewModel) : added.Key.ParentId, cancellationToken); @@ -79,7 +79,7 @@ public class PrimaryWidgetConfigurationHandler(IMediator mediator, provider.Get(configuration) is IWidgetComponentViewModel viewModel) { await mediator.PublishAsync( - new Removed(viewModel), + new Remove(viewModel), removed.Key.ParentId == Guid.Empty ? nameof(PrimaryWidgetViewModel) : removed.Key.ParentId, cancellationToken); diff --git a/Hyperbar.Widget.Primary.Windows/WidgetComponentViewModelEnumerator.cs b/Hyperbar.Widget.Primary.Windows/WidgetComponentViewModelEnumerator.cs index a15d937..e4ba679 100644 --- a/Hyperbar.Widget.Primary.Windows/WidgetComponentViewModelEnumerator.cs +++ b/Hyperbar.Widget.Primary.Windows/WidgetComponentViewModelEnumerator.cs @@ -30,7 +30,7 @@ public class WidgetComponentViewModelEnumerator(PrimaryWidgetConfiguration confi { if (factory.Create(item) is IWidgetComponentViewModel viewModel) { - await mediator.PublishAsync(new Created(viewModel), nameof(PrimaryWidgetViewModel), + await mediator.PublishAsync(new Create(viewModel), nameof(PrimaryWidgetViewModel), cancellationToken); } } diff --git a/Hyperbar.Widget/WidgetExtensionEnumerator.cs b/Hyperbar.Widget/WidgetExtensionEnumerator.cs index 7f5162c..7cfeb0b 100644 --- a/Hyperbar.Widget/WidgetExtensionEnumerator.cs +++ b/Hyperbar.Widget/WidgetExtensionEnumerator.cs @@ -29,7 +29,7 @@ public class WidgetExtensionEnumerator(IFactory factory, { if (factory.Create(widgetType) is IWidget widget) { - await mediator.PublishAsync(new Created(new WidgetExtension(widget, + await mediator.PublishAsync(new Create(new WidgetExtension(widget, new WidgetAssembly(assembly))), cancellationToken); } } diff --git a/Hyperbar.Widget/WidgetExtensionHandler.cs b/Hyperbar.Widget/WidgetExtensionHandler.cs index cf576ab..5b53aee 100644 --- a/Hyperbar.Widget/WidgetExtensionHandler.cs +++ b/Hyperbar.Widget/WidgetExtensionHandler.cs @@ -5,9 +5,9 @@ namespace Hyperbar.Widget; public class WidgetExtensionHandler(IServiceProvider provider, IMediator mediator, IProxyServiceCollection typedServices) : - INotificationHandler> + INotificationHandler> { - public async Task Handle(Created notification, + public async Task Handle(Create notification, CancellationToken cancellationToken) { if(notification.Value is WidgetExtension widgetExtension) @@ -22,7 +22,7 @@ public class WidgetExtensionHandler(IServiceProvider provider, }); IWidgetHost host = builder.Build(); - await mediator.PublishAsync(new Created(host), + await mediator.PublishAsync(new Create(host), cancellationToken); } } diff --git a/Hyperbar.Widget/WidgetHostHandler.cs b/Hyperbar.Widget/WidgetHostHandler.cs index 545c189..555c75f 100644 --- a/Hyperbar.Widget/WidgetHostHandler.cs +++ b/Hyperbar.Widget/WidgetHostHandler.cs @@ -3,9 +3,9 @@ namespace Hyperbar.Widget; public class WidgetHostHandler : - INotificationHandler> + INotificationHandler> { - public async Task Handle(Created notification, + public async Task Handle(Create notification, CancellationToken cancellationToken) { if (notification.Value is IWidgetHost host) diff --git a/Hyperbar.Widget/WidgetStartedHandler.cs b/Hyperbar.Widget/WidgetStartedHandler.cs index 2aa988e..5b08a5f 100644 --- a/Hyperbar.Widget/WidgetStartedHandler.cs +++ b/Hyperbar.Widget/WidgetStartedHandler.cs @@ -12,7 +12,7 @@ public class WidgetStartedHandler(IMediator mediator) : { if (host.Services.GetService() is IWidgetViewModel viewModel) { - await mediator.PublishAsync(new Created(viewModel), + await mediator.PublishAsync(new Create(viewModel), nameof(IWidgetHostViewModel), cancellationToken); } } diff --git a/Hyperbar.Widget/WidgetViewModelEnumerator.cs b/Hyperbar.Widget/WidgetViewModelEnumerator.cs index e6c2c75..d35bca8 100644 --- a/Hyperbar.Widget/WidgetViewModelEnumerator.cs +++ b/Hyperbar.Widget/WidgetViewModelEnumerator.cs @@ -13,7 +13,7 @@ public class WidgetViewModelEnumerator(IWidgetHost host, { foreach (IWidgetViewModel viewModel in viewModels) { - await mediator.PublishAsync(new Created(viewModel), + await mediator.PublishAsync(new Create(viewModel), nameof(IWidgetHostViewModel), cancellationToken); } } diff --git a/Hyperbar.Windows/App.xaml.cs b/Hyperbar.Windows/App.xaml.cs index 9eb8074..871ff71 100644 --- a/Hyperbar.Windows/App.xaml.cs +++ b/Hyperbar.Windows/App.xaml.cs @@ -52,6 +52,7 @@ public partial class App : services.AddContentTemplate(); services.AddContentTemplate(); + services.AddContentTemplate("Settings"); services.AddTransient(); }) diff --git a/Hyperbar.Windows/ApplicationBarView.xaml b/Hyperbar.Windows/ApplicationBarView.xaml index 7bc0306..1eda1e8 100644 --- a/Hyperbar.Windows/ApplicationBarView.xaml +++ b/Hyperbar.Windows/ApplicationBarView.xaml @@ -18,7 +18,7 @@ + ItemsSource="{x:Bind ViewModel, Mode=OneWay}"> diff --git a/Hyperbar.Windows/ApplicationBarView.xaml.cs b/Hyperbar.Windows/ApplicationBarView.xaml.cs index 7053826..04af3eb 100644 --- a/Hyperbar.Windows/ApplicationBarView.xaml.cs +++ b/Hyperbar.Windows/ApplicationBarView.xaml.cs @@ -1,9 +1,13 @@ +using Hyperbar.Widget; using Microsoft.UI.Xaml.Controls; namespace Hyperbar.Windows; -public sealed partial class ApplicationBarView : +public partial class ApplicationBarView : UserControl { - public ApplicationBarView() => InitializeComponent(); + public ApplicationBarView() => + InitializeComponent(); + protected ApplicationBarViewModel ViewModel => + (ApplicationBarViewModel)DataContext; } \ No newline at end of file diff --git a/Hyperbar.Windows/Hyperbar.Windows.csproj b/Hyperbar.Windows/Hyperbar.Windows.csproj index a276e2a..f6d3fe6 100644 --- a/Hyperbar.Windows/Hyperbar.Windows.csproj +++ b/Hyperbar.Windows/Hyperbar.Windows.csproj @@ -18,6 +18,7 @@ + @@ -54,6 +55,11 @@ + + + MSBuild:Compile + + MSBuild:Compile diff --git a/Hyperbar.Windows/PrimaryView.xaml b/Hyperbar.Windows/PrimaryView.xaml index 6becf37..d0e740d 100644 --- a/Hyperbar.Windows/PrimaryView.xaml +++ b/Hyperbar.Windows/PrimaryView.xaml @@ -7,7 +7,7 @@ + ItemsSource="{x:Bind ViewModel}"> diff --git a/Hyperbar.Windows/PrimaryView.xaml.cs b/Hyperbar.Windows/PrimaryView.xaml.cs index 19a1642..2ba3cff 100644 --- a/Hyperbar.Windows/PrimaryView.xaml.cs +++ b/Hyperbar.Windows/PrimaryView.xaml.cs @@ -1,28 +1,14 @@ -using Microsoft.UI.Xaml; +using Hyperbar.Widget; using Microsoft.UI.Xaml.Controls; -using Microsoft.UI.Xaml.Controls.Primitives; -using Microsoft.UI.Xaml.Data; -using Microsoft.UI.Xaml.Input; -using Microsoft.UI.Xaml.Media; -using Microsoft.UI.Xaml.Navigation; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices.WindowsRuntime; -using Windows.Foundation; -using Windows.Foundation.Collections; -// To learn more about WinUI, the WinUI project structure, -// and more about our project templates, see: http://aka.ms/winui-project-info. +namespace Hyperbar.Windows; -namespace Hyperbar.Windows +public partial class PrimaryView : + UserControl { - public sealed partial class PrimaryView : UserControl - { - public PrimaryView() - { - this.InitializeComponent(); - } - } + public PrimaryView() => + InitializeComponent(); + + protected PrimaryViewModel ViewModel => + (PrimaryViewModel)DataContext; } diff --git a/Hyperbar.Windows/SecondaryView.xaml b/Hyperbar.Windows/SecondaryView.xaml index b99a1bc..5691e1a 100644 --- a/Hyperbar.Windows/SecondaryView.xaml +++ b/Hyperbar.Windows/SecondaryView.xaml @@ -5,7 +5,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:windows="using:Hyperbar.UI.Windows"> - + diff --git a/Hyperbar.Windows/SecondaryView.xaml.cs b/Hyperbar.Windows/SecondaryView.xaml.cs index 5d4c245..826c6b1 100644 --- a/Hyperbar.Windows/SecondaryView.xaml.cs +++ b/Hyperbar.Windows/SecondaryView.xaml.cs @@ -1,28 +1,14 @@ -using Microsoft.UI.Xaml; +using Hyperbar.Widget; using Microsoft.UI.Xaml.Controls; -using Microsoft.UI.Xaml.Controls.Primitives; -using Microsoft.UI.Xaml.Data; -using Microsoft.UI.Xaml.Input; -using Microsoft.UI.Xaml.Media; -using Microsoft.UI.Xaml.Navigation; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices.WindowsRuntime; -using Windows.Foundation; -using Windows.Foundation.Collections; -// To learn more about WinUI, the WinUI project structure, -// and more about our project templates, see: http://aka.ms/winui-project-info. +namespace Hyperbar.Windows; -namespace Hyperbar.Windows +public partial class SecondaryView : + UserControl { - public sealed partial class SecondaryView : UserControl - { - public SecondaryView() - { - this.InitializeComponent(); - } - } + public SecondaryView() => + InitializeComponent(); + + protected SecondaryViewModel ViewModel => + (SecondaryViewModel)DataContext; } diff --git a/Hyperbar.Windows/SettingsView.xaml b/Hyperbar.Windows/SettingsView.xaml new file mode 100644 index 0000000..4da9db5 --- /dev/null +++ b/Hyperbar.Windows/SettingsView.xaml @@ -0,0 +1,7 @@ + + + + diff --git a/Hyperbar.Windows/SettingsView.xaml.cs b/Hyperbar.Windows/SettingsView.xaml.cs new file mode 100644 index 0000000..d3b2d3b --- /dev/null +++ b/Hyperbar.Windows/SettingsView.xaml.cs @@ -0,0 +1,11 @@ +using Microsoft.UI.Xaml.Controls; + +namespace Hyperbar.Windows +{ + public sealed partial class SettingsView : + UserControl + { + public SettingsView() => + InitializeComponent(); + } +} diff --git a/Hyperbar.Windows/SettingsViewModel.cs b/Hyperbar.Windows/SettingsViewModel.cs new file mode 100644 index 0000000..e2511ee --- /dev/null +++ b/Hyperbar.Windows/SettingsViewModel.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Hyperbar.Windows +{ + internal class SettingsViewModel + { + } +} diff --git a/Hyperbar/Mediators/Changed.cs b/Hyperbar/Lifecycles/Changed.cs similarity index 100% rename from Hyperbar/Mediators/Changed.cs rename to Hyperbar/Lifecycles/Changed.cs diff --git a/Hyperbar/Lifecycles/Create.cs b/Hyperbar/Lifecycles/Create.cs new file mode 100644 index 0000000..e736bf6 --- /dev/null +++ b/Hyperbar/Lifecycles/Create.cs @@ -0,0 +1,5 @@ + +namespace Hyperbar; + +public record Create(TValue Value, object? Target = null) : + INotification; \ No newline at end of file diff --git a/Hyperbar/Mediators/Enumerate.cs b/Hyperbar/Lifecycles/Enumerate.cs similarity index 100% rename from Hyperbar/Mediators/Enumerate.cs rename to Hyperbar/Lifecycles/Enumerate.cs diff --git a/Hyperbar/Lifecycles/Insert.cs b/Hyperbar/Lifecycles/Insert.cs new file mode 100644 index 0000000..baf7c8d --- /dev/null +++ b/Hyperbar/Lifecycles/Insert.cs @@ -0,0 +1,3 @@ +namespace Hyperbar; + +public record Insert(int Index, TValue Value) : INotification; diff --git a/Hyperbar/Lifecycles/Move.cs b/Hyperbar/Lifecycles/Move.cs new file mode 100644 index 0000000..e9bbf59 --- /dev/null +++ b/Hyperbar/Lifecycles/Move.cs @@ -0,0 +1,3 @@ +namespace Hyperbar; + +public record Move(int Index, TValue Value) : INotification; \ No newline at end of file diff --git a/Hyperbar/Lifecycles/ObservableCollectionViewModel.cs b/Hyperbar/Lifecycles/ObservableCollectionViewModel.cs index bbf621f..fbfd83f 100644 --- a/Hyperbar/Lifecycles/ObservableCollectionViewModel.cs +++ b/Hyperbar/Lifecycles/ObservableCollectionViewModel.cs @@ -15,11 +15,11 @@ public partial class ObservableCollectionViewModel : IList, IReadOnlyList, INotifyCollectionChanged, - INotificationHandler>, - INotificationHandler>, - INotificationHandler>, - INotificationHandler>, - INotificationHandler>, + INotificationHandler>, + INotificationHandler>, + INotificationHandler>, + INotificationHandler>, + INotificationHandler>, IDisposable, IInitialization where TItem : @@ -206,7 +206,7 @@ public partial class ObservableCollectionViewModel : IEnumerator IEnumerable.GetEnumerator() => ((IEnumerable)collection).GetEnumerator(); - public Task Handle(Removed notification, + public Task Handle(Remove notification, CancellationToken cancellationToken) { foreach (TItem item in this.ToList()) @@ -220,7 +220,7 @@ public partial class ObservableCollectionViewModel : return Task.CompletedTask; } - public Task Handle(Created notification, + public Task Handle(Create notification, CancellationToken cancellationToken) { if (notification.Value is TItem item) @@ -231,7 +231,7 @@ public partial class ObservableCollectionViewModel : return Task.CompletedTask; } - public Task Handle(Inserted notification, + public Task Handle(Insert notification, CancellationToken cancellationToken) { if (notification.Value is TItem item) @@ -242,7 +242,7 @@ public partial class ObservableCollectionViewModel : return Task.CompletedTask; } - public Task Handle(Moved notification, + public Task Handle(Move notification, CancellationToken cancellationToken) { if (notification.Value is TItem item) @@ -253,7 +253,7 @@ public partial class ObservableCollectionViewModel : return Task.CompletedTask; } - public Task Handle(Replaced notification, + public Task Handle(Replace notification, CancellationToken cancellationToken) { if (notification.Value is TItem item) diff --git a/Hyperbar/Lifecycles/Remove.cs b/Hyperbar/Lifecycles/Remove.cs new file mode 100644 index 0000000..4b5d06b --- /dev/null +++ b/Hyperbar/Lifecycles/Remove.cs @@ -0,0 +1,36 @@ + +namespace Hyperbar; + +public record Remove(TValue Value) : INotification; + +public record Navigate(object Key) : + INotification; + +public class NavigateHandler : + INotificationHandler +{ + private readonly IEnumerable descriptors; + + public NavigateHandler(IEnumerable descriptors, + IServiceProvider provider) + { + this.descriptors = descriptors; + } + + public Task Handle(Navigate args, + CancellationToken cancellationToken) + { + if (descriptors.FirstOrDefault(x => x.Key == args.Key) + is IContentTemplateDescriptor descriptor) + { + //if (provider.GetRequiredKeyedService(descriptor.TemplateType, + // descriptor.Key) is { } template) + //{ + // return template; + //} + } + + throw new NotImplementedException(); + } +} + diff --git a/Hyperbar/Lifecycles/Replace.cs b/Hyperbar/Lifecycles/Replace.cs new file mode 100644 index 0000000..9a5aca0 --- /dev/null +++ b/Hyperbar/Lifecycles/Replace.cs @@ -0,0 +1,6 @@ + +namespace Hyperbar; + +public record Replace(int Index, TValue Value, object? Target = null) : + INotification; + diff --git a/Hyperbar/Mediators/Created.cs b/Hyperbar/Mediators/Created.cs deleted file mode 100644 index 9700768..0000000 --- a/Hyperbar/Mediators/Created.cs +++ /dev/null @@ -1,5 +0,0 @@ - -namespace Hyperbar; - -public record Created(TValue Value, object? Target = null) : - INotification; \ No newline at end of file diff --git a/Hyperbar/Mediators/Inserted.cs b/Hyperbar/Mediators/Inserted.cs deleted file mode 100644 index f084dfa..0000000 --- a/Hyperbar/Mediators/Inserted.cs +++ /dev/null @@ -1,3 +0,0 @@ -namespace Hyperbar; - -public record Inserted(int Index, TValue Value) : INotification; diff --git a/Hyperbar/Mediators/Moved.cs b/Hyperbar/Mediators/Moved.cs deleted file mode 100644 index 6909d35..0000000 --- a/Hyperbar/Mediators/Moved.cs +++ /dev/null @@ -1,3 +0,0 @@ -namespace Hyperbar; - -public record Moved(int Index, TValue Value) : INotification; \ No newline at end of file diff --git a/Hyperbar/Mediators/Removed.cs b/Hyperbar/Mediators/Removed.cs deleted file mode 100644 index 090a148..0000000 --- a/Hyperbar/Mediators/Removed.cs +++ /dev/null @@ -1,3 +0,0 @@ -namespace Hyperbar; - -public record Removed(TValue Value) : INotification; diff --git a/Hyperbar/Mediators/Replaced.cs b/Hyperbar/Mediators/Replaced.cs deleted file mode 100644 index db91333..0000000 --- a/Hyperbar/Mediators/Replaced.cs +++ /dev/null @@ -1,6 +0,0 @@ - -namespace Hyperbar; - -public record Replaced(int Index, TValue Value, object? Target = null) : - INotification; -