moer changes

This commit is contained in:
TheXamlGuy
2024-02-09 20:58:50 +00:00
parent 41d003f436
commit ecfac99868
39 changed files with 210 additions and 190 deletions
+34
View File
@@ -0,0 +1,34 @@
using Microsoft.UI.Xaml;
using Microsoft.Xaml.Interactivity;
namespace Hyperbar.UI.Windows;
public sealed class NavigateAction :
DependencyObject,
IAction
{
public static readonly DependencyProperty PathProperty =
DependencyProperty.Register(nameof(Path),
typeof(string), typeof(NavigateAction),
new PropertyMetadata(null));
public string Path
{
get => (string)GetValue(PathProperty);
set => SetValue(PathProperty, value);
}
public object Execute(object sender, object parameter)
{
if (sender is FrameworkElement frameworkElement)
{
if (frameworkElement.DataContext is IObservableViewModel observableViewModel)
{
observableViewModel.Mediator.PublishAsync(new Navigate(Path))
.GetAwaiter().GetResult();
}
}
return true;
}
}