using System; using System.Collections.Generic; using System.ComponentModel; using System.Text; using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; using WinWARP.Core.Services; namespace WinWARP.Core.ViewModels; public partial class MainViewModel : ObservableObject { private readonly INavigationService _navigationService; public MainViewModel(INavigationService navigationService) { _navigationService = navigationService; } [ObservableProperty] public partial string Title { get; set; } = "WinWARP"; [ObservableProperty] public partial Type CurrentViewModelType { get; set; } [RelayCommand] private void Navigate(object? tagParameter) { if (tagParameter is Type viewModelType) { var method = _navigationService.GetType().GetMethod("NavigateTo")?.MakeGenericMethod(viewModelType); method?.Invoke(_navigationService, [null]); } } }