public void BuildNPCFromEmbed(Embed embed) { foreach (var aspectField in embed.Fields.Where(fld => fld.Name == StarforgedNPCResources.Aspect)) { Aspects.Add(aspectField.Value); } foreach (var dispositionField in embed.Fields.Where(fld => fld.Name == StarforgedNPCResources.Disposition)) { Dispositions.Add(dispositionField.Value); } foreach (var firstLook in embed.Fields.Where(fld => fld.Name == StarforgedNPCResources.FirstLook)) { FirstLooks.Add(firstLook.Value); } foreach (var goal in embed.Fields.Where(fld => fld.Name == NPCResources.Goal)) { Goals.Add(goal.Value); } foreach (var role in embed.Fields.Where(fld => fld.Name == NPCResources.Role)) { Roles.Add(role.Value); } Name = embed.Fields.FirstOrDefault(fld => fld.Name == NPCResources.Name).Value; IconUrl = embed.Thumbnail.HasValue ? embed.Thumbnail.Value.Url : null; EmbedDesc = embed.Description; }
private void AddNewAspect(object obj) { var newAspect = new AspectConfiguration { PluginName = SelectedNewAspect }; SelectedConfiguration.Aspects.Add(newAspect); Aspects.Add(newAspect); NotifyOfPropertyChange(nameof(Aspects)); }
/// <summary> /// Load all object types defined in tblObjectTypes table (This is project independent /// </summary> public void Load() { using (EDBEntities eDB = new EDBEntities()) { foreach (tblAspect Rec in (from a in eDB.tblAspects where (a.Project_ID == Globals.Project_ID) orderby a.AspectName select a)) { AspectModel aspectItem = new AspectModel { ID = Rec.ID, AspectName = Rec.AspectName, Description = Rec.Description, HardIO = Rec.HardIO.GetValueOrDefault(), ExtIO = Rec.ExtIO.GetValueOrDefault(), PLCTag = Rec.PLCTag.GetValueOrDefault(), SCADATag = Rec.SCADATag.GetValueOrDefault(), AlarmTag = Rec.AlarmTag.GetValueOrDefault(), TrendTag = Rec.TrendTag.GetValueOrDefault(), Note = Rec.Note }; Aspects.Add(aspectItem); } } }
public void Add() { // Instanciate a new object AspectModel aspectItem = new AspectModel { ID = Guid.NewGuid(), Project_ID = Globals.Project_ID, AspectName = "New Aspect", Description = "New Aspect Description", HardIO = false, ExtIO = false, PLCTag = false, SCADATag = false, AlarmTag = false, TrendTag = false, Note = "", IsChanged = false, IsNew = true, }; // If no item has been selected, put the object in the root of the tree Aspects.Add(aspectItem); IsChanged = true; }