public CardItemModel() //for adding new items { var guid = Guid.NewGuid(); _card = new Card( guid, ViewModelLocator.SetTabViewModel.SelectedSet.Id, "Card", guid.ToString(), "", ViewModelLocator.SizeTabViewModel.DefaultSize._size, new Dictionary <string, CardPropertySet>()); var alt = new AltItemModel() { ParentCard = this }; alt._altCard.Type = ""; _card.Properties.Add("", alt._altCard); AltItems = new ObservableCollection <AltItemModel>() { alt }; AltItems.CollectionChanged += (a, b) => { RefreshAltItems(); }; }
public void AddAlt() { var ret = new AltItemModel() { ParentCard = SelectedCard }; SelectedCard.AltItems.Add(ret); SelectedAlt = ret; RaisePropertyChanged("SelectedAlt"); }
public AltItemModel(AltItemModel a) //for copying the item { _altCard = a._altCard.Clone() as CardPropertySet; _altCard.Type = Guid.NewGuid().ToString(); ParentCard = a.ParentCard; CardSize = a.CardSize; Properties = new ObservableCollection <CardPropertyItemModel>(_altCard.Properties.Where(x => x.Key.Name != "Name").Select(x => new CardPropertyItemModel(x.Key, x.Value) { _alt = this })); AltTypeVisibility = Visibility.Visible; }
public void CopyAlt() { if (SelectedAlt == null) { return; } var ret = new AltItemModel(SelectedAlt); SelectedCard.AltItems.Add(ret); SelectedAlt = ret; RaisePropertyChanged("SelectedAlt"); }