Initial navigaiton work; opening Windows
This commit is contained in:
@@ -8,7 +8,6 @@ using Microsoft.UI.Dispatching;
|
||||
using Microsoft.UI.Xaml;
|
||||
using System.Reflection;
|
||||
using Hyperbar.Widget.Windows;
|
||||
using Microsoft.UI.Xaml.Markup;
|
||||
|
||||
namespace Hyperbar.Windows;
|
||||
|
||||
@@ -46,6 +45,8 @@ public partial class App :
|
||||
args.Placement = DesktopApplicationBarPlacemenet.Top;
|
||||
});
|
||||
|
||||
services.AddNavigationHandler<WindowHandler>();
|
||||
|
||||
services.AddSingleton<DesktopApplicationBar>();
|
||||
services.AddContentTemplate<ApplicationBarViewModel, ApplicationBarView>();
|
||||
services.AddContentTemplate<PrimaryViewModel, PrimaryView>();
|
||||
|
||||
@@ -15,9 +15,9 @@ public partial class SecondaryViewModel :
|
||||
IMediator mediator,
|
||||
IDisposer disposer,
|
||||
int index) : base(serviceFactory, mediator, disposer)
|
||||
{
|
||||
{
|
||||
TemplateFactory = templateFactory;
|
||||
this.index = index;
|
||||
this.TemplateFactory = templateFactory;
|
||||
|
||||
Add<SettingsButtonViewModel>();
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
Width="{ThemeResource ButtonWidth}"
|
||||
Height="{ThemeResource ButtonHeight}"
|
||||
Padding="{ThemeResource ButtonPadding}"
|
||||
Command="{x:Bind ViewModel.InvokeCommand}"
|
||||
Content=""
|
||||
FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
||||
FontSize="16" />
|
||||
|
||||
@@ -2,9 +2,12 @@ using Microsoft.UI.Xaml.Controls;
|
||||
|
||||
namespace Hyperbar.Windows;
|
||||
|
||||
public sealed partial class SettingsButtonView :
|
||||
public partial class SettingsButtonView :
|
||||
UserControl
|
||||
{
|
||||
public SettingsButtonView() =>
|
||||
this.InitializeComponent();
|
||||
InitializeComponent();
|
||||
|
||||
protected SettingsButtonViewModel ViewModel =>
|
||||
(SettingsButtonViewModel)DataContext;
|
||||
}
|
||||
|
||||
@@ -1,11 +1,24 @@
|
||||
namespace Hyperbar.Windows;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
|
||||
public class SettingsButtonViewModel(ITemplateFactory templateFactory,
|
||||
IServiceFactory serviceFactory,
|
||||
IMediator mediator,
|
||||
IDisposer disposer) :
|
||||
ObservableViewModel(serviceFactory, mediator, disposer),
|
||||
namespace Hyperbar.Windows;
|
||||
|
||||
public partial class SettingsButtonViewModel :
|
||||
ObservableViewModel,
|
||||
ITemplatedViewModel
|
||||
{
|
||||
public ITemplateFactory TemplateFactory => templateFactory;
|
||||
[ObservableProperty]
|
||||
private IRelayCommand? invokeCommand;
|
||||
|
||||
public SettingsButtonViewModel(ITemplateFactory templateFactory,
|
||||
IServiceFactory serviceFactory,
|
||||
IMediator mediator,
|
||||
IDisposer disposer) : base(serviceFactory, mediator, disposer)
|
||||
{
|
||||
TemplateFactory = templateFactory;
|
||||
InvokeCommand = new AsyncRelayCommand(async () =>
|
||||
await mediator.PublishAsync(new Navigate("Settings")));
|
||||
}
|
||||
|
||||
public ITemplateFactory TemplateFactory { get; }
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<UserControl
|
||||
<Window
|
||||
x:Class="Hyperbar.Windows.SettingsView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Grid />
|
||||
</UserControl>
|
||||
<Button>afsdfdg</Button>
|
||||
</Window>
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
|
||||
namespace Hyperbar.Windows
|
||||
{
|
||||
public sealed partial class SettingsView :
|
||||
UserControl
|
||||
public sealed partial class SettingsView :
|
||||
Window
|
||||
{
|
||||
public SettingsView() =>
|
||||
InitializeComponent();
|
||||
|
||||
Reference in New Issue
Block a user