todo: wenn neuer mod aufgerufen wird, soll die zurückfunktion deaktviert sein oder so das sie den mod mit aktualisiert zu dem der davor ausgewählt war (:
35 lines
1015 B
C#
35 lines
1015 B
C#
using Avalonia;
|
|
using ReactiveUI;
|
|
using System.ComponentModel;
|
|
using System.Reactive;
|
|
|
|
namespace Valheim_Dashboard.ViewModels;
|
|
|
|
public class StoreViewModel : ViewModelBase
|
|
{
|
|
|
|
public ViewModelBase CurrentStoreView { get; set; }
|
|
public ReactiveCommand<Unit, Unit> BackCommand { get; }
|
|
public ReactiveCommand<Unit, ViewModelBase> ShowThunderstoreCommand { get; }
|
|
public ReactiveCommand<Unit, ViewModelBase> ShowNexusCommand { get; }
|
|
|
|
private readonly MainWindowViewModel _main;
|
|
|
|
public StoreViewModel(MainWindowViewModel main)
|
|
{
|
|
|
|
_main = main;
|
|
|
|
BackCommand = ReactiveCommand.Create(() =>
|
|
{
|
|
_main.SwitchToServerDashboard();
|
|
});
|
|
|
|
ShowThunderstoreCommand = ReactiveCommand.Create(() => CurrentStoreView = new ThunderstoreViewModel());
|
|
ShowNexusCommand = ReactiveCommand.Create(() => CurrentStoreView = new NexusViewModel());
|
|
|
|
// Default → Thunderstore
|
|
CurrentStoreView = new ThunderstoreViewModel();
|
|
}
|
|
|
|
} |