diff --git a/Hyperbar.Widget/Hyperbar.Widget.csproj b/Hyperbar.Widget/Hyperbar.Widget.csproj
new file mode 100644
index 0000000..3ecc5a3
--- /dev/null
+++ b/Hyperbar.Widget/Hyperbar.Widget.csproj
@@ -0,0 +1,10 @@
+
+
+ net8.0
+ enable
+ enable
+
+
+
+
+
\ No newline at end of file
diff --git a/Hyperbar.Widget/IServiceCollectionExtensions.cs b/Hyperbar.Widget/IServiceCollectionExtensions.cs
new file mode 100644
index 0000000..5470f3b
--- /dev/null
+++ b/Hyperbar.Widget/IServiceCollectionExtensions.cs
@@ -0,0 +1,65 @@
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.DependencyInjection.Extensions;
+
+namespace Hyperbar.Widget;
+
+public static class IServiceCollectionExtensions
+{
+ public static IServiceCollection AddWidget(this IServiceCollection services)
+ {
+ services.AddTransient();
+ services.AddTransient, WidgetFactory>();
+
+ services.AddHandler();
+ services.AddHandler();
+ services.AddHandler();
+ services.AddHandler();
+
+ services.AddTransient, WidgetContainerFactory>();
+
+ return services;
+ }
+
+ public static IServiceCollection AddWidgetTemplate(this IServiceCollection services)
+ where TWidgetContent :
+ IWidgetViewModel
+ {
+ Type contentType = typeof(TWidgetContent);
+ Type templateType = typeof(IWidgetView);
+
+ string key = contentType.Name;
+
+ services.AddTransient(typeof(IWidgetViewModel), contentType);
+ services.TryAddTransient(templateType, provider => provider.GetService()!);
+
+ services.AddKeyedTransient(typeof(IWidgetViewModel), key, contentType);
+ services.TryAddKeyedTransient(key, (provider, key) => provider.GetService()!);
+
+ services.AddTransient(provider => new ContentTemplateDescriptor { ContentType = contentType, TemplateType = templateType, Key = key });
+
+ return services;
+ }
+
+ public static IServiceCollection AddWidgetTemplate(this IServiceCollection services)
+ where TWidgetContent :
+ IWidgetViewModel
+ {
+ Type contentType = typeof(TWidgetContent);
+ Type templateType = typeof(TWidgetTemplate);
+
+ string key = contentType.Name;
+
+ services.AddTransient(typeof(IWidgetViewModel), contentType);
+ services.TryAddTransient(templateType);
+
+ services.AddKeyedTransient(typeof(IWidgetViewModel), key, contentType);
+ services.TryAddKeyedTransient(templateType, key);
+
+ services.AddTransient(provider =>
+ new ContentTemplateDescriptor { ContentType = contentType,
+ TemplateType = templateType, Key = key });
+
+ return services;
+ }
+}
\ No newline at end of file
diff --git a/Hyperbar/Widgets/IWidget.cs b/Hyperbar.Widget/IWidget.cs
similarity index 66%
rename from Hyperbar/Widgets/IWidget.cs
rename to Hyperbar.Widget/IWidget.cs
index 90b46c7..929007b 100644
--- a/Hyperbar/Widgets/IWidget.cs
+++ b/Hyperbar.Widget/IWidget.cs
@@ -1,4 +1,4 @@
-namespace Hyperbar;
+namespace Hyperbar.Widget;
public interface IWidget
{
diff --git a/Hyperbar/Widgets/IWidgetBuilder.cs b/Hyperbar.Widget/IWidgetBuilder.cs
similarity index 92%
rename from Hyperbar/Widgets/IWidgetBuilder.cs
rename to Hyperbar.Widget/IWidgetBuilder.cs
index 9c38ab0..1742ec2 100644
--- a/Hyperbar/Widgets/IWidgetBuilder.cs
+++ b/Hyperbar.Widget/IWidgetBuilder.cs
@@ -1,6 +1,6 @@
using Microsoft.Extensions.DependencyInjection;
-namespace Hyperbar;
+namespace Hyperbar.Widget;
public interface IWidgetBuilder
{
diff --git a/Hyperbar/Widgets/IWidgetBuilderExtensions.cs b/Hyperbar.Widget/IWidgetBuilderExtensions.cs
similarity index 92%
rename from Hyperbar/Widgets/IWidgetBuilderExtensions.cs
rename to Hyperbar.Widget/IWidgetBuilderExtensions.cs
index cc8e53a..07d5481 100644
--- a/Hyperbar/Widgets/IWidgetBuilderExtensions.cs
+++ b/Hyperbar.Widget/IWidgetBuilderExtensions.cs
@@ -1,6 +1,6 @@
using Microsoft.Extensions.DependencyInjection;
-namespace Hyperbar;
+namespace Hyperbar.Widget;
public static class IWidgetBuilderExtensions
{
diff --git a/Hyperbar/Views/IWidgetComponentViewModel.cs b/Hyperbar.Widget/IWidgetComponentViewModel.cs
similarity index 65%
rename from Hyperbar/Views/IWidgetComponentViewModel.cs
rename to Hyperbar.Widget/IWidgetComponentViewModel.cs
index 6cf934f..5d7931c 100644
--- a/Hyperbar/Views/IWidgetComponentViewModel.cs
+++ b/Hyperbar.Widget/IWidgetComponentViewModel.cs
@@ -1,3 +1,3 @@
-namespace Hyperbar;
+namespace Hyperbar.Widget;
public interface IWidgetComponentViewModel : IDisposable;
\ No newline at end of file
diff --git a/Hyperbar/Widgets/IWidgetHost.cs b/Hyperbar.Widget/IWidgetHost.cs
similarity index 82%
rename from Hyperbar/Widgets/IWidgetHost.cs
rename to Hyperbar.Widget/IWidgetHost.cs
index 0d01f41..8d35a59 100644
--- a/Hyperbar/Widgets/IWidgetHost.cs
+++ b/Hyperbar.Widget/IWidgetHost.cs
@@ -1,4 +1,4 @@
-namespace Hyperbar;
+namespace Hyperbar.Widget;
public interface IWidgetHost :
IInitializer
diff --git a/Hyperbar/Views/IWidgetView.cs b/Hyperbar.Widget/IWidgetView.cs
similarity index 50%
rename from Hyperbar/Views/IWidgetView.cs
rename to Hyperbar.Widget/IWidgetView.cs
index ab21bb5..0e29631 100644
--- a/Hyperbar/Views/IWidgetView.cs
+++ b/Hyperbar.Widget/IWidgetView.cs
@@ -1,3 +1,3 @@
-namespace Hyperbar;
+namespace Hyperbar.Widget;
public interface IWidgetView;
\ No newline at end of file
diff --git a/Hyperbar/Views/IWidgetViewModel.cs b/Hyperbar.Widget/IWidgetViewModel.cs
similarity index 62%
rename from Hyperbar/Views/IWidgetViewModel.cs
rename to Hyperbar.Widget/IWidgetViewModel.cs
index ff92d9f..e4f5838 100644
--- a/Hyperbar/Views/IWidgetViewModel.cs
+++ b/Hyperbar.Widget/IWidgetViewModel.cs
@@ -1,3 +1,3 @@
-namespace Hyperbar;
+namespace Hyperbar.Widget;
public interface IWidgetViewModel : IDisposable;
\ No newline at end of file
diff --git a/Hyperbar/Widgets/Started.cs b/Hyperbar.Widget/Started.cs
similarity index 67%
rename from Hyperbar/Widgets/Started.cs
rename to Hyperbar.Widget/Started.cs
index 899d61e..758c278 100644
--- a/Hyperbar/Widgets/Started.cs
+++ b/Hyperbar.Widget/Started.cs
@@ -1,3 +1,3 @@
-namespace Hyperbar;
+namespace Hyperbar.Widget;
public record Started(TValue Value) : INotification;
diff --git a/Hyperbar/Widgets/Stopped.cs b/Hyperbar.Widget/Stopped.cs
similarity index 67%
rename from Hyperbar/Widgets/Stopped.cs
rename to Hyperbar.Widget/Stopped.cs
index 6a01900..d1ac4ae 100644
--- a/Hyperbar/Widgets/Stopped.cs
+++ b/Hyperbar.Widget/Stopped.cs
@@ -1,3 +1,3 @@
-namespace Hyperbar;
+namespace Hyperbar.Widget;
public record Stopped(TValue Value) : INotification;
\ No newline at end of file
diff --git a/Hyperbar/Widgets/WidgetAssembly.cs b/Hyperbar.Widget/WidgetAssembly.cs
similarity index 80%
rename from Hyperbar/Widgets/WidgetAssembly.cs
rename to Hyperbar.Widget/WidgetAssembly.cs
index 7bd26cd..ac2138a 100644
--- a/Hyperbar/Widgets/WidgetAssembly.cs
+++ b/Hyperbar.Widget/WidgetAssembly.cs
@@ -1,6 +1,6 @@
using System.Reflection;
-namespace Hyperbar;
+namespace Hyperbar.Widget;
public record WidgetAssembly(Assembly? Assembly = default) :
INotification;
\ No newline at end of file
diff --git a/Hyperbar/Widgets/WidgetAssemblyHandler.cs b/Hyperbar.Widget/WidgetAssemblyHandler.cs
similarity index 96%
rename from Hyperbar/Widgets/WidgetAssemblyHandler.cs
rename to Hyperbar.Widget/WidgetAssemblyHandler.cs
index 6b4f793..cf3d230 100644
--- a/Hyperbar/Widgets/WidgetAssemblyHandler.cs
+++ b/Hyperbar.Widget/WidgetAssemblyHandler.cs
@@ -1,6 +1,6 @@
using System.Reflection;
-namespace Hyperbar;
+namespace Hyperbar.Widget;
public class WidgetAssemblyHandler(IMediator mediator,
IFactory factory) :
diff --git a/Hyperbar/Widgets/WidgetAvailability.cs b/Hyperbar.Widget/WidgetAvailability.cs
similarity index 71%
rename from Hyperbar/Widgets/WidgetAvailability.cs
rename to Hyperbar.Widget/WidgetAvailability.cs
index a1bb444..5a0b9f2 100644
--- a/Hyperbar/Widgets/WidgetAvailability.cs
+++ b/Hyperbar.Widget/WidgetAvailability.cs
@@ -1,4 +1,4 @@
-namespace Hyperbar;
+namespace Hyperbar.Widget;
public record WidgetAvailability
{
diff --git a/Hyperbar/Views/WidgetBarViewModel.cs b/Hyperbar.Widget/WidgetBarViewModel.cs
similarity index 93%
rename from Hyperbar/Views/WidgetBarViewModel.cs
rename to Hyperbar.Widget/WidgetBarViewModel.cs
index 1594e9a..e5197b7 100644
--- a/Hyperbar/Views/WidgetBarViewModel.cs
+++ b/Hyperbar.Widget/WidgetBarViewModel.cs
@@ -1,4 +1,4 @@
-namespace Hyperbar;
+namespace Hyperbar.Widget;
[NotificationHandler(nameof(WidgetBarViewModel))]
public partial class WidgetBarViewModel(ITemplateFactory templateFactory,
diff --git a/Hyperbar/Widgets/WidgetBuilder.cs b/Hyperbar.Widget/WidgetBuilder.cs
similarity index 98%
rename from Hyperbar/Widgets/WidgetBuilder.cs
rename to Hyperbar.Widget/WidgetBuilder.cs
index 91f897a..7ba795e 100644
--- a/Hyperbar/Widgets/WidgetBuilder.cs
+++ b/Hyperbar.Widget/WidgetBuilder.cs
@@ -3,7 +3,7 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System.Reflection;
-namespace Hyperbar;
+namespace Hyperbar.Widget;
public class WidgetBuilder(TConfiguration configuration) :
IWidgetBuilder
diff --git a/Hyperbar/Views/WidgetButtonViewModel.cs b/Hyperbar.Widget/WidgetButtonViewModel.cs
similarity index 96%
rename from Hyperbar/Views/WidgetButtonViewModel.cs
rename to Hyperbar.Widget/WidgetButtonViewModel.cs
index f96efa7..61f947a 100644
--- a/Hyperbar/Views/WidgetButtonViewModel.cs
+++ b/Hyperbar.Widget/WidgetButtonViewModel.cs
@@ -1,7 +1,7 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
-namespace Hyperbar;
+namespace Hyperbar.Widget;
[NotificationHandler(nameof(Id))]
public partial class WidgetButtonViewModel(IServiceFactory serviceFactory,
diff --git a/Hyperbar/Views/WidgetComponentViewModel.cs b/Hyperbar.Widget/WidgetComponentViewModel.cs
similarity index 97%
rename from Hyperbar/Views/WidgetComponentViewModel.cs
rename to Hyperbar.Widget/WidgetComponentViewModel.cs
index 1e934fa..e07dc6a 100644
--- a/Hyperbar/Views/WidgetComponentViewModel.cs
+++ b/Hyperbar.Widget/WidgetComponentViewModel.cs
@@ -1,6 +1,6 @@
using CommunityToolkit.Mvvm.ComponentModel;
-namespace Hyperbar;
+namespace Hyperbar.Widget;
public partial class WidgetComponentViewModel :
ObservableCollectionViewModel,
diff --git a/Hyperbar/Widgets/WidgetConfiguration.cs b/Hyperbar.Widget/WidgetConfiguration.cs
similarity index 92%
rename from Hyperbar/Widgets/WidgetConfiguration.cs
rename to Hyperbar.Widget/WidgetConfiguration.cs
index 5cd45e5..8da6a25 100644
--- a/Hyperbar/Widgets/WidgetConfiguration.cs
+++ b/Hyperbar.Widget/WidgetConfiguration.cs
@@ -1,6 +1,6 @@
using System.Text.Json.Serialization;
-namespace Hyperbar;
+namespace Hyperbar.Widget;
public class WidgetConfiguration
{
public string? Description { get; set; }
diff --git a/Hyperbar/Widgets/WidgetConfigurationChanged.cs b/Hyperbar.Widget/WidgetConfigurationChanged.cs
similarity index 74%
rename from Hyperbar/Widgets/WidgetConfigurationChanged.cs
rename to Hyperbar.Widget/WidgetConfigurationChanged.cs
index 699b35e..d458cd6 100644
--- a/Hyperbar/Widgets/WidgetConfigurationChanged.cs
+++ b/Hyperbar.Widget/WidgetConfigurationChanged.cs
@@ -1,4 +1,4 @@
-namespace Hyperbar;
+namespace Hyperbar.Widget;
public record WidgetConfigurationChanged : INotification;
\ No newline at end of file
diff --git a/Hyperbar/Widgets/WidgetConfigurationHandler.cs b/Hyperbar.Widget/WidgetConfigurationHandler.cs
similarity index 94%
rename from Hyperbar/Widgets/WidgetConfigurationHandler.cs
rename to Hyperbar.Widget/WidgetConfigurationHandler.cs
index ff3764f..32bfbba 100644
--- a/Hyperbar/Widgets/WidgetConfigurationHandler.cs
+++ b/Hyperbar.Widget/WidgetConfigurationHandler.cs
@@ -1,4 +1,4 @@
-namespace Hyperbar;
+namespace Hyperbar.Widget;
public class WidgetConfigurationHandler(IValue widgetAvailability) :
INotificationHandler>
diff --git a/Hyperbar/Widgets/WidgetContainerFactory.cs b/Hyperbar.Widget/WidgetContainerFactory.cs
similarity index 94%
rename from Hyperbar/Widgets/WidgetContainerFactory.cs
rename to Hyperbar.Widget/WidgetContainerFactory.cs
index 2ea9953..437ad96 100644
--- a/Hyperbar/Widgets/WidgetContainerFactory.cs
+++ b/Hyperbar.Widget/WidgetContainerFactory.cs
@@ -1,5 +1,5 @@
using Microsoft.Extensions.DependencyInjection;
-namespace Hyperbar;
+namespace Hyperbar.Widget;
public class WidgetContainerFactory(IServiceFactory factory) :
IFactory
diff --git a/Hyperbar/Views/WidgetContainerViewModel.cs b/Hyperbar.Widget/WidgetContainerViewModel.cs
similarity index 94%
rename from Hyperbar/Views/WidgetContainerViewModel.cs
rename to Hyperbar.Widget/WidgetContainerViewModel.cs
index d1a5432..83ea805 100644
--- a/Hyperbar/Views/WidgetContainerViewModel.cs
+++ b/Hyperbar.Widget/WidgetContainerViewModel.cs
@@ -1,7 +1,7 @@
using CommunityToolkit.Mvvm.ComponentModel;
-namespace Hyperbar;
+namespace Hyperbar.Widget;
public partial class WidgetContainerViewModel(ITemplateFactory templateFactory,
IServiceFactory serviceFactory,
diff --git a/Hyperbar/Widgets/WidgetEnumerationHandler.cs b/Hyperbar.Widget/WidgetEnumeratorHandler.cs
similarity index 91%
rename from Hyperbar/Widgets/WidgetEnumerationHandler.cs
rename to Hyperbar.Widget/WidgetEnumeratorHandler.cs
index 8756618..20d36db 100644
--- a/Hyperbar/Widgets/WidgetEnumerationHandler.cs
+++ b/Hyperbar.Widget/WidgetEnumeratorHandler.cs
@@ -2,9 +2,9 @@
using System.Reflection;
using System.Runtime.Loader;
-namespace Hyperbar;
+namespace Hyperbar.Widget;
-public class WidgetEnumerationHandler(IHostEnvironment hostEnvironment,
+public class WidgetEnumeratorHandler(IHostEnvironment hostEnvironment,
IMediator mediator) :
INotificationHandler>
{
diff --git a/Hyperbar/Widgets/WidgetFactory.cs b/Hyperbar.Widget/WidgetFactory.cs
similarity index 89%
rename from Hyperbar/Widgets/WidgetFactory.cs
rename to Hyperbar.Widget/WidgetFactory.cs
index 8f14ea8..25c7b8c 100644
--- a/Hyperbar/Widgets/WidgetFactory.cs
+++ b/Hyperbar.Widget/WidgetFactory.cs
@@ -1,4 +1,4 @@
-namespace Hyperbar;
+namespace Hyperbar.Widget;
public class WidgetFactory :
IFactory
diff --git a/Hyperbar/Widgets/WidgetHandler.cs b/Hyperbar.Widget/WidgetHandler.cs
similarity index 97%
rename from Hyperbar/Widgets/WidgetHandler.cs
rename to Hyperbar.Widget/WidgetHandler.cs
index af55de5..26c75fa 100644
--- a/Hyperbar/Widgets/WidgetHandler.cs
+++ b/Hyperbar.Widget/WidgetHandler.cs
@@ -1,6 +1,6 @@
using Microsoft.Extensions.DependencyInjection;
-namespace Hyperbar;
+namespace Hyperbar.Widget;
public class WidgetHandler(IProxyServiceCollection typedServices,
IServiceProvider provider,
diff --git a/Hyperbar/Widgets/WidgetHost.cs b/Hyperbar.Widget/WidgetHost.cs
similarity index 98%
rename from Hyperbar/Widgets/WidgetHost.cs
rename to Hyperbar.Widget/WidgetHost.cs
index e75f7d5..e3c9b8f 100644
--- a/Hyperbar/Widgets/WidgetHost.cs
+++ b/Hyperbar.Widget/WidgetHost.cs
@@ -1,7 +1,7 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
-namespace Hyperbar;
+namespace Hyperbar.Widget;
public class WidgetHost :
INotificationHandler>,
diff --git a/Hyperbar/Widgets/WidgetHostHandler.cs b/Hyperbar.Widget/WidgetHostHandler.cs
similarity index 84%
rename from Hyperbar/Widgets/WidgetHostHandler.cs
rename to Hyperbar.Widget/WidgetHostHandler.cs
index 7503e4c..0c5d59a 100644
--- a/Hyperbar/Widgets/WidgetHostHandler.cs
+++ b/Hyperbar.Widget/WidgetHostHandler.cs
@@ -1,4 +1,4 @@
-namespace Hyperbar;
+namespace Hyperbar.Widget;
public class WidgetHostHandler(IMediator mediator,
IFactory factory) :
@@ -12,8 +12,8 @@ public class WidgetHostHandler(IMediator mediator,
{
if (factory.Create(host) is WidgetContainerViewModel containerViewModel)
{
- await mediator.PublishAsync(new Created(containerViewModel), nameof(WidgetBarViewModel),
- cancellationToken);
+ await mediator.PublishAsync(new Created(containerViewModel),
+ nameof(WidgetBarViewModel), cancellationToken);
}
}
}
diff --git a/Hyperbar/Widgets/WidgetManager.cs b/Hyperbar.Widget/WidgetManager.cs
similarity index 87%
rename from Hyperbar/Widgets/WidgetManager.cs
rename to Hyperbar.Widget/WidgetManager.cs
index 538c9f5..37d6029 100644
--- a/Hyperbar/Widgets/WidgetManager.cs
+++ b/Hyperbar.Widget/WidgetManager.cs
@@ -1,4 +1,4 @@
-namespace Hyperbar;
+namespace Hyperbar.Widget;
public class WidgetInitializer(IMediator mediator) :
IInitializer
diff --git a/Hyperbar/Views/WidgetMenuViewModel.cs b/Hyperbar.Widget/WidgetMenuViewModel.cs
similarity index 96%
rename from Hyperbar/Views/WidgetMenuViewModel.cs
rename to Hyperbar.Widget/WidgetMenuViewModel.cs
index bf08730..2215470 100644
--- a/Hyperbar/Views/WidgetMenuViewModel.cs
+++ b/Hyperbar.Widget/WidgetMenuViewModel.cs
@@ -1,7 +1,7 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
-namespace Hyperbar;
+namespace Hyperbar.Widget;
[NotificationHandler(nameof(Id))]
public partial class WidgetMenuViewModel(IServiceFactory serviceFactory,
diff --git a/Hyperbar/Widgets/WidgetMonitor.cs b/Hyperbar.Widget/WidgetMonitor.cs
similarity index 82%
rename from Hyperbar/Widgets/WidgetMonitor.cs
rename to Hyperbar.Widget/WidgetMonitor.cs
index 57a73f6..1db1649 100644
--- a/Hyperbar/Widgets/WidgetMonitor.cs
+++ b/Hyperbar.Widget/WidgetMonitor.cs
@@ -1,4 +1,4 @@
-namespace Hyperbar;
+namespace Hyperbar.Widget;
public class WidgetMonitor :
IInitializer
diff --git a/Hyperbar/Widgets/WidgetService.cs b/Hyperbar.Widget/WidgetService.cs
similarity index 94%
rename from Hyperbar/Widgets/WidgetService.cs
rename to Hyperbar.Widget/WidgetService.cs
index f1ad9da..0e69b2b 100644
--- a/Hyperbar/Widgets/WidgetService.cs
+++ b/Hyperbar.Widget/WidgetService.cs
@@ -1,6 +1,6 @@
using Microsoft.Extensions.Hosting;
-namespace Hyperbar;
+namespace Hyperbar.Widget;
public sealed class WidgetService(IEnumerable initializers) :
IHostedService
diff --git a/Hyperbar/Views/WidgetSplitButtonViewModel.cs b/Hyperbar.Widget/WidgetSplitButtonViewModel.cs
similarity index 96%
rename from Hyperbar/Views/WidgetSplitButtonViewModel.cs
rename to Hyperbar.Widget/WidgetSplitButtonViewModel.cs
index 9a1dd89..99d6117 100644
--- a/Hyperbar/Views/WidgetSplitButtonViewModel.cs
+++ b/Hyperbar.Widget/WidgetSplitButtonViewModel.cs
@@ -1,7 +1,7 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
-namespace Hyperbar;
+namespace Hyperbar.Widget;
[NotificationHandler(nameof(Id))]
public partial class WidgetSplitButtonViewModel(IServiceFactory serviceFactory,
diff --git a/Hyperbar.Widget/WidgetViewModelEnumerator.cs b/Hyperbar.Widget/WidgetViewModelEnumerator.cs
new file mode 100644
index 0000000..e7d243a
--- /dev/null
+++ b/Hyperbar.Widget/WidgetViewModelEnumerator.cs
@@ -0,0 +1,11 @@
+namespace Hyperbar.Widget;
+
+public class WidgetViewModelEnumerator :
+ INotificationHandler>
+{
+ public Task Handle(Enumerate notification,
+ CancellationToken cancellationToken)
+ {
+ throw new NotImplementedException();
+ }
+}
\ No newline at end of file
diff --git a/Hyperbar.Windows.Contextual/Hyperbar.Widget.Contextual.csproj b/Hyperbar.Windows.Contextual/Hyperbar.Widget.Contextual.csproj
index 4a8f052..0543aaa 100644
--- a/Hyperbar.Windows.Contextual/Hyperbar.Widget.Contextual.csproj
+++ b/Hyperbar.Windows.Contextual/Hyperbar.Widget.Contextual.csproj
@@ -9,6 +9,7 @@
+
diff --git a/Hyperbar.Windows.MediaController/Hyperbar.Windows.MediaController.csproj b/Hyperbar.Windows.MediaController/Hyperbar.Windows.MediaController.csproj
index 229b8f3..ae10de8 100644
--- a/Hyperbar.Windows.MediaController/Hyperbar.Windows.MediaController.csproj
+++ b/Hyperbar.Windows.MediaController/Hyperbar.Windows.MediaController.csproj
@@ -18,6 +18,7 @@
+
diff --git a/Hyperbar.Windows.MediaController/Lifecycles/MediaControllerWidget.cs b/Hyperbar.Windows.MediaController/Lifecycles/MediaControllerWidget.cs
index 3f0ee59..10de475 100644
--- a/Hyperbar.Windows.MediaController/Lifecycles/MediaControllerWidget.cs
+++ b/Hyperbar.Windows.MediaController/Lifecycles/MediaControllerWidget.cs
@@ -1,3 +1,4 @@
+using Hyperbar.Widget;
using Microsoft.Extensions.DependencyInjection;
using Windows.Media.Control;
diff --git a/Hyperbar.Windows.MediaController/Lifecycles/MediaControllerWidgetConfiguration.cs b/Hyperbar.Windows.MediaController/Lifecycles/MediaControllerWidgetConfiguration.cs
index d25b286..28a34f3 100644
--- a/Hyperbar.Windows.MediaController/Lifecycles/MediaControllerWidgetConfiguration.cs
+++ b/Hyperbar.Windows.MediaController/Lifecycles/MediaControllerWidgetConfiguration.cs
@@ -1,4 +1,6 @@
-namespace Hyperbar.Windows.MediaController;
+using Hyperbar.Widget;
+
+namespace Hyperbar.Windows.MediaController;
public class MediaControllerWidgetConfiguration :
WidgetConfiguration
diff --git a/Hyperbar.Windows.MediaController/Views/MediaButtonViewModel.cs b/Hyperbar.Windows.MediaController/Views/MediaButtonViewModel.cs
index aafbcbd..46b558a 100644
--- a/Hyperbar.Windows.MediaController/Views/MediaButtonViewModel.cs
+++ b/Hyperbar.Windows.MediaController/Views/MediaButtonViewModel.cs
@@ -1,4 +1,5 @@
using CommunityToolkit.Mvvm.Input;
+using Hyperbar.Widget;
using System.Windows.Input;
namespace Hyperbar.Windows.MediaController;
diff --git a/Hyperbar.Windows.MediaController/Views/MediaControllerViewModel.cs b/Hyperbar.Windows.MediaController/Views/MediaControllerViewModel.cs
index ae4ca69..6e4afb3 100644
--- a/Hyperbar.Windows.MediaController/Views/MediaControllerViewModel.cs
+++ b/Hyperbar.Windows.MediaController/Views/MediaControllerViewModel.cs
@@ -1,4 +1,5 @@
using CommunityToolkit.Mvvm.Input;
+using Hyperbar.Widget;
namespace Hyperbar.Windows.MediaController;
diff --git a/Hyperbar.Windows.MediaController/Views/MediaControllerWidgetViewModel.cs b/Hyperbar.Windows.MediaController/Views/MediaControllerWidgetViewModel.cs
index c51a45b..1a2d54d 100644
--- a/Hyperbar.Windows.MediaController/Views/MediaControllerWidgetViewModel.cs
+++ b/Hyperbar.Windows.MediaController/Views/MediaControllerWidgetViewModel.cs
@@ -1,4 +1,6 @@
-namespace Hyperbar.Windows.MediaController;
+using Hyperbar.Widget;
+
+namespace Hyperbar.Windows.MediaController;
public class MediaControllerWidgetViewModel(ITemplateFactory templateFactory,
IServiceFactory serviceFactory,
diff --git a/Hyperbar.Windows.MediaController/Views/MediaInformationViewModel.cs b/Hyperbar.Windows.MediaController/Views/MediaInformationViewModel.cs
index da0dec7..7782320 100644
--- a/Hyperbar.Windows.MediaController/Views/MediaInformationViewModel.cs
+++ b/Hyperbar.Windows.MediaController/Views/MediaInformationViewModel.cs
@@ -1,5 +1,6 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
+using Hyperbar.Widget;
using System.Windows.Input;
namespace Hyperbar.Windows.MediaController;
diff --git a/Hyperbar.Windows.Primary/Hyperbar.Widget.Primary.csproj b/Hyperbar.Windows.Primary/Hyperbar.Widget.Primary.csproj
index b84d4ea..459e51f 100644
--- a/Hyperbar.Windows.Primary/Hyperbar.Widget.Primary.csproj
+++ b/Hyperbar.Windows.Primary/Hyperbar.Widget.Primary.csproj
@@ -10,6 +10,7 @@
+
diff --git a/Hyperbar.Windows.Primary/PrimaryWidget.cs b/Hyperbar.Windows.Primary/PrimaryWidget.cs
index ef6d59c..8fd4f5b 100644
--- a/Hyperbar.Windows.Primary/PrimaryWidget.cs
+++ b/Hyperbar.Windows.Primary/PrimaryWidget.cs
@@ -1,3 +1,4 @@
+using Hyperbar.Widget;
using Microsoft.Extensions.DependencyInjection;
namespace Hyperbar.Windows.Primary;
diff --git a/Hyperbar.Windows.Primary/PrimaryWidgetConfiguration.cs b/Hyperbar.Windows.Primary/PrimaryWidgetConfiguration.cs
index a38afb7..458f9a5 100644
--- a/Hyperbar.Windows.Primary/PrimaryWidgetConfiguration.cs
+++ b/Hyperbar.Windows.Primary/PrimaryWidgetConfiguration.cs
@@ -1,6 +1,9 @@
-namespace Hyperbar.Windows.Primary;
+using Hyperbar.Widget;
-public class PrimaryWidgetConfiguration : WidgetConfiguration
+namespace Hyperbar.Windows.Primary;
+
+public class PrimaryWidgetConfiguration :
+ WidgetConfiguration
{
public List Commands { get; set; } = [];
}
\ No newline at end of file
diff --git a/Hyperbar.Windows.Primary/PrimaryWidgetConfigurationHandler.cs b/Hyperbar.Windows.Primary/PrimaryWidgetConfigurationHandler.cs
index 3f6bf47..3a611db 100644
--- a/Hyperbar.Windows.Primary/PrimaryWidgetConfigurationHandler.cs
+++ b/Hyperbar.Windows.Primary/PrimaryWidgetConfigurationHandler.cs
@@ -1,4 +1,6 @@
-namespace Hyperbar.Windows.Primary;
+using Hyperbar.Widget;
+
+namespace Hyperbar.Windows.Primary;
public class PrimaryWidgetConfigurationHandler(IMediator mediator,
PrimaryWidgetConfiguration configuration,
diff --git a/Hyperbar.Windows.Primary/PrimaryWidgetViewModel.cs b/Hyperbar.Windows.Primary/PrimaryWidgetViewModel.cs
index 8113be3..d6c507e 100644
--- a/Hyperbar.Windows.Primary/PrimaryWidgetViewModel.cs
+++ b/Hyperbar.Windows.Primary/PrimaryWidgetViewModel.cs
@@ -1,4 +1,6 @@
-namespace Hyperbar.Windows.Primary;
+using Hyperbar.Widget;
+
+namespace Hyperbar.Windows.Primary;
[NotificationHandler(nameof(PrimaryWidgetViewModel))]
public class PrimaryWidgetViewModel(ITemplateFactory templateFactory,
diff --git a/Hyperbar.Windows.Primary/WidgetComponentEnumerationHandler.cs b/Hyperbar.Windows.Primary/WidgetComponentEnumerationHandler.cs
index 3220fa4..e73375a 100644
--- a/Hyperbar.Windows.Primary/WidgetComponentEnumerationHandler.cs
+++ b/Hyperbar.Windows.Primary/WidgetComponentEnumerationHandler.cs
@@ -1,4 +1,6 @@
-namespace Hyperbar.Windows.Primary;
+using Hyperbar.Widget;
+
+namespace Hyperbar.Windows.Primary;
public class WidgetComponentEnumerationHandler(PrimaryWidgetConfiguration configuration,
IFactory factory,
diff --git a/Hyperbar.Windows.Primary/WidgetComponentFactory.cs b/Hyperbar.Windows.Primary/WidgetComponentFactory.cs
index 574112f..c2513ed 100644
--- a/Hyperbar.Windows.Primary/WidgetComponentFactory.cs
+++ b/Hyperbar.Windows.Primary/WidgetComponentFactory.cs
@@ -1,4 +1,5 @@
using CommunityToolkit.Mvvm.Input;
+using Hyperbar.Widget;
namespace Hyperbar.Windows.Primary;
diff --git a/Hyperbar.Windows.Primary/WidgetComponentProvider.cs b/Hyperbar.Windows.Primary/WidgetComponentProvider.cs
index fec537c..964eb2f 100644
--- a/Hyperbar.Windows.Primary/WidgetComponentProvider.cs
+++ b/Hyperbar.Windows.Primary/WidgetComponentProvider.cs
@@ -1,4 +1,6 @@
-namespace Hyperbar.Windows.Primary;
+using Hyperbar.Widget;
+
+namespace Hyperbar.Windows.Primary;
public class WidgetComponentProvider(ICache cache) :
IProvider
diff --git a/Hyperbar.Windows/App.xaml.cs b/Hyperbar.Windows/App.xaml.cs
index 4059fa5..046c19b 100644
--- a/Hyperbar.Windows/App.xaml.cs
+++ b/Hyperbar.Windows/App.xaml.cs
@@ -1,4 +1,5 @@
-using Hyperbar.Windows.Controls;
+using Hyperbar.Widget;
+using Hyperbar.Windows.Controls;
using Hyperbar.Windows.Interop;
using Hyperbar.Windows.UI;
using Microsoft.Extensions.Configuration;
diff --git a/Hyperbar.Windows/Hyperbar.Windows.csproj b/Hyperbar.Windows/Hyperbar.Windows.csproj
index 0e35a3b..c66b2fc 100644
--- a/Hyperbar.Windows/Hyperbar.Windows.csproj
+++ b/Hyperbar.Windows/Hyperbar.Windows.csproj
@@ -44,6 +44,7 @@
true
+
diff --git a/Hyperbar.Windows/Lifecycles/AppInitializer.cs b/Hyperbar.Windows/Lifecycles/AppInitializer.cs
index 4cd3176..fdc2a3e 100644
--- a/Hyperbar.Windows/Lifecycles/AppInitializer.cs
+++ b/Hyperbar.Windows/Lifecycles/AppInitializer.cs
@@ -1,4 +1,5 @@
-using Hyperbar.Windows.Controls;
+using Hyperbar.Widget;
+using Hyperbar.Windows.Controls;
using Microsoft.Extensions.DependencyInjection;
namespace Hyperbar.Windows;
diff --git a/Hyperbar.Windows/Views/WidgetView.xaml.cs b/Hyperbar.Windows/Views/WidgetView.xaml.cs
index d77a38f..54d5dfc 100644
--- a/Hyperbar.Windows/Views/WidgetView.xaml.cs
+++ b/Hyperbar.Windows/Views/WidgetView.xaml.cs
@@ -1,3 +1,4 @@
+using Hyperbar.Widget;
using Microsoft.UI.Xaml.Controls;
namespace Hyperbar.Windows;
diff --git a/Hyperbar.sln b/Hyperbar.sln
index db6b6b0..b320946 100644
--- a/Hyperbar.sln
+++ b/Hyperbar.sln
@@ -17,7 +17,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hyperbar.Windows.UI", "Hype
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hyperbar.Windows.Interop", "Hyperbar.Windows.Interop\Hyperbar.Windows.Interop.csproj", "{7263FB8C-4007-4581-8AD7-DCAB2AD7C444}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hyperbar.Windows.MediaController", "Hyperbar.Windows.MediaController\Hyperbar.Windows.MediaController.csproj", "{88C3EC90-C48C-47B9-89A8-740EFFFE5AAD}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hyperbar.Windows.MediaController", "Hyperbar.Windows.MediaController\Hyperbar.Windows.MediaController.csproj", "{88C3EC90-C48C-47B9-89A8-740EFFFE5AAD}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hyperbar.Widget", "Hyperbar.Widget\Hyperbar.Widget.csproj", "{D38F95E6-744B-45DB-AF67-F331FB73615A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -167,6 +169,22 @@ Global
{88C3EC90-C48C-47B9-89A8-740EFFFE5AAD}.Release|x64.Build.0 = Release|Any CPU
{88C3EC90-C48C-47B9-89A8-740EFFFE5AAD}.Release|x86.ActiveCfg = Release|Any CPU
{88C3EC90-C48C-47B9-89A8-740EFFFE5AAD}.Release|x86.Build.0 = Release|Any CPU
+ {D38F95E6-744B-45DB-AF67-F331FB73615A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {D38F95E6-744B-45DB-AF67-F331FB73615A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D38F95E6-744B-45DB-AF67-F331FB73615A}.Debug|ARM64.ActiveCfg = Debug|Any CPU
+ {D38F95E6-744B-45DB-AF67-F331FB73615A}.Debug|ARM64.Build.0 = Debug|Any CPU
+ {D38F95E6-744B-45DB-AF67-F331FB73615A}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {D38F95E6-744B-45DB-AF67-F331FB73615A}.Debug|x64.Build.0 = Debug|Any CPU
+ {D38F95E6-744B-45DB-AF67-F331FB73615A}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {D38F95E6-744B-45DB-AF67-F331FB73615A}.Debug|x86.Build.0 = Debug|Any CPU
+ {D38F95E6-744B-45DB-AF67-F331FB73615A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D38F95E6-744B-45DB-AF67-F331FB73615A}.Release|Any CPU.Build.0 = Release|Any CPU
+ {D38F95E6-744B-45DB-AF67-F331FB73615A}.Release|ARM64.ActiveCfg = Release|Any CPU
+ {D38F95E6-744B-45DB-AF67-F331FB73615A}.Release|ARM64.Build.0 = Release|Any CPU
+ {D38F95E6-744B-45DB-AF67-F331FB73615A}.Release|x64.ActiveCfg = Release|Any CPU
+ {D38F95E6-744B-45DB-AF67-F331FB73615A}.Release|x64.Build.0 = Release|Any CPU
+ {D38F95E6-744B-45DB-AF67-F331FB73615A}.Release|x86.ActiveCfg = Release|Any CPU
+ {D38F95E6-744B-45DB-AF67-F331FB73615A}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/Hyperbar/Extensions/IServiceCollectionExtensions.cs b/Hyperbar/Extensions/IServiceCollectionExtensions.cs
index ff9674f..b166143 100644
--- a/Hyperbar/Extensions/IServiceCollectionExtensions.cs
+++ b/Hyperbar/Extensions/IServiceCollectionExtensions.cs
@@ -149,18 +149,9 @@ public static class IServiceCollectionExtensions
services.AddSingleton();
- services.AddTransient();
- services.AddTransient, WidgetFactory>();
-
- services.AddHandler();
- services.AddHandler();
- services.AddHandler();
- services.AddHandler();
-
- services.AddTransient, WidgetContainerFactory>();
-
return services;
}
+
public static IServiceCollection AddHandler(this IServiceCollection services,
ServiceLifetime lifetime = ServiceLifetime.Transient)
where THandler :
@@ -225,44 +216,4 @@ public static class IServiceCollectionExtensions
return services;
}
-
- public static IServiceCollection AddWidgetTemplate(this IServiceCollection services)
- where TWidgetContent :
- IWidgetViewModel
- {
- Type contentType = typeof(TWidgetContent);
- Type templateType = typeof(IWidgetView);
-
- string key = contentType.Name;
-
- services.AddTransient(typeof(IWidgetViewModel), contentType);
- services.TryAddTransient(templateType, provider => provider.GetService()!);
-
- services.AddKeyedTransient(typeof(IWidgetViewModel), key, contentType);
- services.TryAddKeyedTransient(key, (provider, key) => provider.GetService()!);
-
- services.AddTransient(provider => new ContentTemplateDescriptor { ContentType = contentType, TemplateType = templateType, Key = key });
-
- return services;
- }
-
- public static IServiceCollection AddWidgetTemplate(this IServiceCollection services)
- where TWidgetContent :
- IWidgetViewModel
- {
- Type contentType = typeof(TWidgetContent);
- Type templateType = typeof(TWidgetTemplate);
-
- string key = contentType.Name;
-
- services.AddTransient(typeof(IWidgetViewModel), contentType);
- services.TryAddTransient(templateType);
-
- services.AddKeyedTransient(typeof(IWidgetViewModel), key, contentType);
- services.TryAddKeyedTransient(templateType, key);
-
- services.AddTransient(provider => new ContentTemplateDescriptor { ContentType = contentType, TemplateType = templateType, Key = key });
-
- return services;
- }
}
\ No newline at end of file
diff --git a/Hyperbar/Views/IEnumerator.cs b/Hyperbar/Lifecycles/IEnumerator.cs
similarity index 100%
rename from Hyperbar/Views/IEnumerator.cs
rename to Hyperbar/Lifecycles/IEnumerator.cs
diff --git a/Hyperbar/Views/IInitialization.cs b/Hyperbar/Lifecycles/IInitialization.cs
similarity index 100%
rename from Hyperbar/Views/IInitialization.cs
rename to Hyperbar/Lifecycles/IInitialization.cs
diff --git a/Hyperbar/Views/IObservableCollectionViewModel.cs b/Hyperbar/Lifecycles/IObservableCollectionViewModel.cs
similarity index 100%
rename from Hyperbar/Views/IObservableCollectionViewModel.cs
rename to Hyperbar/Lifecycles/IObservableCollectionViewModel.cs
diff --git a/Hyperbar/Views/ObservableCollectionViewModel.cs b/Hyperbar/Lifecycles/ObservableCollectionViewModel.cs
similarity index 100%
rename from Hyperbar/Views/ObservableCollectionViewModel.cs
rename to Hyperbar/Lifecycles/ObservableCollectionViewModel.cs
diff --git a/Hyperbar/Views/ObservableViewModel.cs b/Hyperbar/Lifecycles/ObservableViewModel.cs
similarity index 100%
rename from Hyperbar/Views/ObservableViewModel.cs
rename to Hyperbar/Lifecycles/ObservableViewModel.cs