using Awesomeness.Core; using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Awesomeness.GUI.ViewModels; partial class MainViewModel : ObservableObject { private Person scratchPerson; private Person selectedPerson; private CatalogOfPeople catalog; public ObservableCollection AvailableNames; public MainViewModel() { scratchPerson = new Person(); catalog = new CatalogOfPeople(); AvailableNames = new ObservableCollection(); AvailableNames.Add("Bullshit"); AvailableNames.Add("Another Crap"); } [ObservableProperty] [NotifyCanExecuteChangedFor(nameof(ResetNameCommand))] private string firstName = String.Empty; [RelayCommand(CanExecute = nameof(CanResetName))] private void ResetName() { FirstName = String.Empty; } private bool CanResetName() { return FirstName != String.Empty; } [RelayCommand] private void SetName() { scratchPerson.FirstName = FirstName; } [RelayCommand] private void GetName() { FirstName = scratchPerson.FirstName; } [RelayCommand] private void AddNameToCatalog() { AvailableNames.Add("Kastöga"); } }