using System; using System.Collections.Generic; using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; using Microsoft.Extensions.DependencyInjection; using Policlinica.DB; namespace Policlinica.ViewModels; public partial class DoctorViewModel : ViewModelBase { private readonly IServiceProvider _provider; private readonly Navigation _navigation; [ObservableProperty] string username; [ObservableProperty] string name; [ObservableProperty] List _doctorList; [ObservableProperty] Doctor selectedDoctor; // [ObservableProperty] string g; public DoctorViewModel(IServiceProvider provider, DoctorRepository repository, Navigation navigation) { _provider = provider; _doctorList = repository.GetDoctorsByTest(); _navigation = navigation; } [RelayCommand] public void StartTest() { if (SelectedDoctor == null) return; var vm = _provider.GetRequiredService(); _navigation.Navigate(vm); } }