private void HandleChangePhoneCommand(object obj) { this.currentPhone = null; // forces update OnPropertyChanged("Phones"); //DataPersister.UpdatePhone(this.CurrentPhone, this.CurrentPhone.Name, "..\\..\\..\\ViewModels\\Phones.xml"); }
private void HandleAddPhoneCommand(object obj) { var newPhone = new PhoneViewModel(); newPhone.Model = "New Phone"; newPhone.OS = new OSViewModel(); if (this.CurrentPhone != null) { newPhone.Features = new List<FeatureViewModel>(this.CurrentPhone.Features); foreach (var item in newPhone.Features) { item.Value = ""; } } else { newPhone.Features = new List<FeatureViewModel>(); } //DataPersister.AddNewPhone(newPhone, "..\\..\\..\\ViewModels\\Phones.xml"); this.Phones.Add(newPhone); var phonesCollectionView = CollectionViewSource.GetDefaultView(this.Phones); phonesCollectionView.MoveCurrentToLast(); this.CurrentPhone = newPhone; OnPropertyChanged("Phones"); }