|
|
@ -25,7 +25,6 @@ public partial class MainWindowViewModel : ViewModelBase |
|
|
|
private readonly ISettingsManager settingsManager; |
|
|
|
private readonly ISettingsManager settingsManager; |
|
|
|
private readonly ServiceManager<ViewModelBase> dialogFactory; |
|
|
|
private readonly ServiceManager<ViewModelBase> dialogFactory; |
|
|
|
private readonly IDiscordRichPresenceService discordRichPresenceService; |
|
|
|
private readonly IDiscordRichPresenceService discordRichPresenceService; |
|
|
|
private readonly INavigationService navigationService; |
|
|
|
|
|
|
|
public string Greeting => "Welcome to Avalonia!"; |
|
|
|
public string Greeting => "Welcome to Avalonia!"; |
|
|
|
|
|
|
|
|
|
|
|
[ObservableProperty] |
|
|
|
[ObservableProperty] |
|
|
@ -46,13 +45,11 @@ public partial class MainWindowViewModel : ViewModelBase |
|
|
|
public MainWindowViewModel( |
|
|
|
public MainWindowViewModel( |
|
|
|
ISettingsManager settingsManager, |
|
|
|
ISettingsManager settingsManager, |
|
|
|
IDiscordRichPresenceService discordRichPresenceService, |
|
|
|
IDiscordRichPresenceService discordRichPresenceService, |
|
|
|
ServiceManager<ViewModelBase> dialogFactory, |
|
|
|
ServiceManager<ViewModelBase> dialogFactory) |
|
|
|
INavigationService navigationService) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
this.settingsManager = settingsManager; |
|
|
|
this.settingsManager = settingsManager; |
|
|
|
this.dialogFactory = dialogFactory; |
|
|
|
this.dialogFactory = dialogFactory; |
|
|
|
this.discordRichPresenceService = discordRichPresenceService; |
|
|
|
this.discordRichPresenceService = discordRichPresenceService; |
|
|
|
this.navigationService = navigationService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ProgressManagerViewModel = dialogFactory.Get<ProgressManagerViewModel>(); |
|
|
|
ProgressManagerViewModel = dialogFactory.Get<ProgressManagerViewModel>(); |
|
|
|
UpdateViewModel = dialogFactory.Get<UpdateViewModel>(); |
|
|
|
UpdateViewModel = dialogFactory.Get<UpdateViewModel>(); |
|
|
@ -65,8 +62,6 @@ public partial class MainWindowViewModel : ViewModelBase |
|
|
|
// Set only if null, since this may be called again when content dialogs open |
|
|
|
// Set only if null, since this may be called again when content dialogs open |
|
|
|
CurrentPage ??= Pages.FirstOrDefault(); |
|
|
|
CurrentPage ??= Pages.FirstOrDefault(); |
|
|
|
SelectedCategory ??= Pages.FirstOrDefault(); |
|
|
|
SelectedCategory ??= Pages.FirstOrDefault(); |
|
|
|
|
|
|
|
|
|
|
|
EventManager.Instance.PageChangeRequested += OnPageChangeRequested; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public override async Task OnLoadedAsync() |
|
|
|
public override async Task OnLoadedAsync() |
|
|
@ -198,19 +193,4 @@ public partial class MainWindowViewModel : ViewModelBase |
|
|
|
|
|
|
|
|
|
|
|
await dialog.ShowAsync(); |
|
|
|
await dialog.ShowAsync(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void OnPageChangeRequested(object? sender, Type e) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
CurrentPage = Pages.FirstOrDefault(p => p.GetType() == e); |
|
|
|
|
|
|
|
SelectedCategory = Pages.FirstOrDefault(p => p.GetType() == e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
partial void OnSelectedCategoryChanged(object? value) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (value is PageViewModelBase page) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// CurrentPage = page; |
|
|
|
|
|
|
|
// navigationService.NavigateTo(page); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|