using Caliburn.Micro; using friaLabbar.Models; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; namespace friaLabbar.ViewModels { public class SkalViewModel : PropertyChangedBase { string name; public string Name { get { return name; } set { name = value; NotifyOfPropertyChange(() => Name); NotifyOfPropertyChange(() => CanSayHello); } } public bool CanSayHello { get { return !string.IsNullOrWhiteSpace(Name); } } public BindableCollection AFewNumbers { get; set; } public BindableCollection AFewPeople { get; set; } public SkalViewModel() { RandomPersonGenerator pg = new RandomPersonGenerator(); AFewNumbers = new BindableCollection(new List { 1, 3, 3, 7, 58, 48, 690 }); AFewPeople= new BindableCollection(pg.GetPeople()); } public void SayHello() { MessageBox.Show(string.Format("Hello {0}!", Name)); //Don't do this in real life :) AFewNumbers[2] = 15981; } } }