2026-05-06 09:02:00 +02:00
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
|
|
|
using CommunityToolkit.Mvvm.Input;
|
|
|
|
|
|
|
|
|
|
namespace TournamentOrganizer.ViewModels;
|
|
|
|
|
|
|
|
|
|
public partial class MainViewModel : ViewModelBase
|
|
|
|
|
{
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
private ViewModelBase _currentView;
|
|
|
|
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
private string _title = "Tournament Organizer";
|
|
|
|
|
|
|
|
|
|
public MainViewModel()
|
|
|
|
|
{
|
|
|
|
|
CurrentView = new HomeViewModel();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[RelayCommand]
|
|
|
|
|
private void NavigateToHome()
|
|
|
|
|
{
|
|
|
|
|
CurrentView = new HomeViewModel();
|
|
|
|
|
Title = "Tournament Organizer";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[RelayCommand]
|
|
|
|
|
private async Task NavigateToTeams()
|
|
|
|
|
{
|
|
|
|
|
var teamsVm = new TeamsViewModel();
|
|
|
|
|
CurrentView = teamsVm;
|
|
|
|
|
Title = "Teams Management";
|
|
|
|
|
await teamsVm.LoadTeams();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public partial class HomeViewModel : ViewModelBase
|
|
|
|
|
{
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
private string _welcomeMessage = "Welcome to Tournament Organizer!";
|
|
|
|
|
}
|