protected void UpdateViewModel(string name, SavedListConfig item) { if (string.IsNullOrEmpty(name)) { throw new ArgumentNullException("name"); } if (item == null) { throw new ArgumentNullException("item"); } if (_configs != null) { SavedListConfigViewModel vmdl = this._configs.Rw.SingleOrDefault(i => i.Object.Name == name && i.IsMyOwn); if (vmdl == null) { vmdl = ViewModelFactory.CreateViewModel <SavedListConfigViewModel.Factory>().Invoke(DataContext, this, item, true); _configs.Rw.Add(vmdl); SelectedItem = vmdl; } else { vmdl.Object = item; } } }
protected SavedListConfig ExtractItem(string name, SavedListConfigurationList obj) { var item = obj.Configs.FirstOrDefault(i => i.Name == name); if (item == null) { item = new SavedListConfig(); item.Name = name; obj.Configs.Add(item); } return(item); }
public SavedListConfigViewModel(IViewModelDependencies appCtx, IZetboxContext dataCtx, SavedListConfiguratorViewModel parent, SavedListConfig obj, bool isMyOwn) : base(appCtx, dataCtx, parent) { this._object = obj; this.IsMyOwn = isMyOwn; }