public SwitchBlockModel(LinkDefinition.LinkWrapper lw, IdeCollection <IdeBaseItem> source) : base(source) //load { _wrapper = lw; _property = (PropertyItemModel)CustomProperties.FirstOrDefault(x => ((PropertyItemModel)x)._property.Name == _wrapper.Conditional.switchProperty); Items = new IdeCollection <IdeBaseItem>(this); if (lw.Conditional.switchNodeList != null) { foreach (var switchcase in lw.Conditional.switchNodeList) { Items.Add(new SwitchCaseModel(switchcase, Items)); } } Items.CollectionChanged += (a, b) => { BuildSwitchDefinitions(b); }; if (lw.Conditional.elseNode != null) { Items.Add(new DefaultCaseModel(lw.Conditional.elseNode, Items)); } Messenger.Default.Register <CustomPropertyChangedMessage>(this, action => CustomPropertyChanged(action)); AddCaseCommand = new RelayCommand(AddCase); AddDefaultCommand = new RelayCommand(AddDefault); }
public MatchModel(Property property, IdeCollection <IdeBaseItem> source) : base(source) //load match { _match = property; _property = (PropertyItemModel)CustomProperties.FirstOrDefault(x => ((PropertyItemModel)x)._property.Name == _match.Name); Messenger.Default.Register <CustomPropertyChangedMessage>(this, action => CustomPropertyChanged(action)); }
public void AddItem() { var ret = new PropertyItemModel(Items); Items.Add(ret); Items.SelectedItem = ret; }
// GET: Admin/PropertyItem/Create public async Task <ActionResult> Create() { var model = new PropertyItemModel { Items = await db.Items.ToListAsync(), Propertys = await db.Propertys.ToListAsync() }; return(View(model)); }
public TextLinkPropertyModel(TextLinkPropertyModel lp, IdeCollection <IdeBaseItem> source) : base(source) //copy { _property = new Property() { Name = lp._property.Name, Format = lp._property.Format }; _activeProperty = lp._activeProperty; Messenger.Default.Register <CustomPropertyChangedMessage>(this, action => CustomPropertyChanged(action)); }
public PropertyTabViewModel() { Items = new IdeCollection <IdeBaseItem>(this); foreach (var property in ViewModelLocator.GameLoader.Game.CustomProperties) { Items.Add(new PropertyItemModel(property, Items)); } Items.CollectionChanged += (sender, args) => { ViewModelLocator.GameLoader.Game.CustomProperties = Items.Select(x => ((PropertyItemModel)x)._property).ToList(); Messenger.Default.Send(new CustomPropertyChangedMessage(args)); }; AddCommand = new RelayCommand(AddItem); //TODO: Make sure these property names aren't already set NameProperty = new PropertyItemModel(new PropertyDef() { Name = "Name" }, Items); IdProperty = new PropertyItemModel(new PropertyDef() { Name = "Id" }, Items); AlternateProperty = new PropertyItemModel(new PropertyDef() { Name = "Alternate" }, Items); SizeProperty = new PropertyItemModel(new PropertyDef() { Name = "CardSize" }, Items); //Proxy Properties ProxyNameProperty = new PropertyItemModel(new PropertyDef() { Name = "CardName" }, Items); SizeNameProperty = new PropertyItemModel(new PropertyDef() { Name = "CardSizeName" }, Items); SizeHeightProperty = new PropertyItemModel(new PropertyDef() { Name = "CardSizeHeight" }, Items); SizeWidthProperty = new PropertyItemModel(new PropertyDef() { Name = "CardSizeWidth" }, Items); }
public static async Task <PropertyItemModel> Convert( this PropertyItem PropertyItem, ApplicationDbContext db, bool addListData = true) { var model = new PropertyItemModel { ItemId = PropertyItem.ItemId, PropertyId = PropertyItem.PropertyId, Items = addListData ? await db.Items.ToListAsync() : null, Propertys = addListData ? await db.Propertys.ToListAsync() : null, ItemTitle = (await db.Items.FirstOrDefaultAsync(i => i.Id.Equals(PropertyItem.ItemId))).Title, PropertyTitle = (await db.Propertys.FirstOrDefaultAsync(p => p.Id.Equals(PropertyItem.PropertyId))).Title }; return(model); }
public CardPropertyModel(AlternateModel parent, PropertyItemModel property) { Parent = parent; LinkedProperty = property; }
public TextLinkPropertyModel(Property prop, IdeCollection <IdeBaseItem> source) : base(source) //load { _property = prop; _activeProperty = (PropertyItemModel)CustomProperties.FirstOrDefault(x => ((PropertyItemModel)x)._property.Name == _property.Name); Messenger.Default.Register <CustomPropertyChangedMessage>(this, action => CustomPropertyChanged(action)); }