UX-Update 2.0, Neues Dashboard
This commit is contained in:
@@ -21,10 +21,12 @@ public partial class MainWindowViewModel : ObservableObject
|
||||
[ObservableProperty] private ObservableObject? _currentPage;
|
||||
[ObservableProperty] private NavItem _activeNavItem = NavItem.Dashboard;
|
||||
[ObservableProperty] private string _currentSchoolYear = "";
|
||||
[ObservableProperty] private bool _isCommandPaletteOpen;
|
||||
|
||||
public SyncStatusViewModel SyncStatus { get; }
|
||||
public ObservableCollection<ToastItem> Toasts { get; }
|
||||
public AppLockViewModel AppLock { get; }
|
||||
public GlobalSearchViewModel CommandPalette { get; }
|
||||
|
||||
public bool IsDashboardActive => ActiveNavItem == NavItem.Dashboard;
|
||||
public bool IsGroupsActive => ActiveNavItem == NavItem.Groups;
|
||||
@@ -37,18 +39,32 @@ public partial class MainWindowViewModel : ObservableObject
|
||||
|
||||
public MainWindowViewModel(IServiceProvider services,
|
||||
DashboardViewModel dashboard, SchoolYearService sy,
|
||||
SyncStatusViewModel syncStatus, NotificationService notifications, AppLockViewModel appLock)
|
||||
SyncStatusViewModel syncStatus, NotificationService notifications, AppLockViewModel appLock,
|
||||
GlobalSearchViewModel commandPalette)
|
||||
{
|
||||
_services = services;
|
||||
SyncStatus = syncStatus;
|
||||
Toasts = notifications.Toasts;
|
||||
AppLock = appLock;
|
||||
CommandPalette = commandPalette;
|
||||
CommandPalette.OnClose = CloseCommandPalette;
|
||||
CurrentSchoolYear = sy.CurrentSchoolYear();
|
||||
CurrentPage = dashboard;
|
||||
AppLock.ApplyConfig();
|
||||
SyncStatus.DataChanged += OnSyncDataChanged;
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void OpenCommandPalette()
|
||||
{
|
||||
if (AppLock.IsLocked) return;
|
||||
CommandPalette.Reset();
|
||||
IsCommandPaletteOpen = true;
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void CloseCommandPalette() => IsCommandPaletteOpen = false;
|
||||
|
||||
// EventApplier schreibt bei eingehenden Sync-Ereignissen absichtlich direkt auf die rohe
|
||||
// LiteDB-Collection, an jedem ViewModel vorbei (Ping-Pong-Vermeidung, siehe EventApplier-
|
||||
// Klassenkommentar) - ohne diesen Hook blieb die gerade sichtbare Seite bis zum nächsten
|
||||
|
||||
Reference in New Issue
Block a user