Make custom widgets independent of any WinUI framework concerns. Although one can add WinUI concerns to ther widget if they want to build a fully customized widget. In theory, it may also be possible to host a widget of WPF, Avalonia, or Blazor.
This commit is contained in:
@@ -1,15 +0,0 @@
|
||||
using Hyperbar.Lifecycles;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace Hyperbar.Windows.Contextual;
|
||||
|
||||
public class ContextualCommandWidgetBuilder :
|
||||
ICommandWidgetBuilder
|
||||
{
|
||||
public void Create(IServiceCollection services)
|
||||
{
|
||||
services
|
||||
.AddWritableConfiguration<ContextualCommandWidgetConfiguration>()
|
||||
.AddCommandTemplate<ContextualCommandWidgetViewModel, ContextualCommandWidgetView>();
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
namespace Hyperbar.Windows.Contextual;
|
||||
|
||||
public class ContextualCommandWidgetConfiguration
|
||||
{
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<Page
|
||||
x:Class="Hyperbar.Windows.Contextual.ContextualCommandWidgetView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Grid>
|
||||
<Button Click="Button_Click" Content="This is a test" />
|
||||
</Grid>
|
||||
</Page>
|
||||
@@ -1,15 +0,0 @@
|
||||
using Hyperbar.Windows.Win32;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Windows.System;
|
||||
|
||||
namespace Hyperbar.Windows.Contextual;
|
||||
|
||||
public sealed partial class ContextualCommandWidgetView : Page
|
||||
{
|
||||
public ContextualCommandWidgetView() => InitializeComponent();
|
||||
|
||||
private void Button_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
|
||||
{
|
||||
KeyInterop.Type(VirtualKey.L, VirtualKey.LeftWindows, VirtualKey.Control);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using Hyperbar.Lifecycles;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace Hyperbar.Extensions.Contextual;
|
||||
|
||||
public class ContextualWidgetBuilder :
|
||||
IWidgetBuilder
|
||||
{
|
||||
public void Create(IServiceCollection services)
|
||||
{
|
||||
services
|
||||
.AddConfiguration<ContextualWidgetConfiguration>()
|
||||
.AddWidgetTemplate<ContextualWidgetViewModel>();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
namespace Hyperbar.Extensions.Contextual;
|
||||
|
||||
public class ContextualWidgetConfiguration
|
||||
{
|
||||
}
|
||||
+3
-3
@@ -1,10 +1,10 @@
|
||||
using Hyperbar.Lifecycles;
|
||||
using Hyperbar.Templates;
|
||||
|
||||
namespace Hyperbar.Windows.Contextual;
|
||||
namespace Hyperbar.Extensions.Contextual;
|
||||
|
||||
public class ContextualCommandWidgetViewModel(ITemplateFactory templateFactory) :
|
||||
ICommandWidgetViewModel,
|
||||
public class ContextualWidgetViewModel(ITemplateFactory templateFactory) :
|
||||
IWidgetViewModel,
|
||||
ITemplatedViewModel
|
||||
{
|
||||
public ITemplateFactory TemplateFactory { get; } = templateFactory;
|
||||
Reference in New Issue
Block a user