|
@@ -1,4 +1,6 @@
|
|
|
-using System.Linq;
|
|
|
+using System;
|
|
|
+using System.Linq;
|
|
|
+using Avalonia.Threading;
|
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
|
using InABox.Avalonia;
|
|
|
using InABox.Avalonia.Router;
|
|
@@ -30,9 +32,15 @@ public partial class MainViewModel : ViewModelBase
|
|
|
Content.Deactivate();
|
|
|
IsTransitioning = true;
|
|
|
Content = viewModel;
|
|
|
- Title = viewModel is IModuleViewModel module
|
|
|
- ? module.Title
|
|
|
- : Repositories.MaybeMe?.Name ?? "PRS Avalonia";
|
|
|
+ if(viewModel is IModuleViewModel module)
|
|
|
+ {
|
|
|
+ Title = module.GetTitle();
|
|
|
+ module.OnTitleChanged += title => Dispatcher.UIThread.InvokeAsync(() => Title = title);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ Title = Repositories.MaybeMe?.Name ?? "PRS Avalonia";
|
|
|
+ }
|
|
|
PrimaryMenu = viewModel.PrimaryMenu;
|
|
|
SecondaryMenu = viewModel.SecondaryMenu;
|
|
|
BackButtonVisible = viewModel.BackButtonVisible;
|
|
@@ -53,7 +61,7 @@ public partial class MainViewModel : ViewModelBase
|
|
|
PropertyChanged += MainViewModel_PropertyChanged;
|
|
|
|
|
|
// change to HomeView
|
|
|
- Navigation.Reset<TestViewModel>();
|
|
|
+ Navigation.Reset<LoginViewModel>();
|
|
|
}
|
|
|
|
|
|
public override bool OnBackButtonPressed()
|