private void auxAddOrUpdateItem(SocialExchangeDTO item) { var diag = new AddSocialExchange(_loadedAsset, item); diag.ShowDialog(this); if (diag.UpdatedGuid != Guid.Empty) { // _socialExchangeList.DataSource = LoadedAsset.GetAllSocialExchanges().ToList(); this._socialExchangeList.DataSource = _loadedAsset.GetAllSocialExchanges().ToList(); EditorTools.HighlightItemInGrid <SocialExchangeDTO> (gridSocialExchanges, diag.UpdatedGuid); } _socialExchangeList.Refresh(); }
public AddSocialExchange(CommeillFautAsset asset, SocialExchangeDTO dto) { InitializeComponent(); this.dto = dto; this.asset = asset; //Validators EditorTools.AllowOnlyGroundedLiteral(nameTextBox); EditorTools.AllowOnlyVariable(wfNameTarget); nameTextBox.Value = dto.Name; textBoxDescription.Text = dto.Description; wfNameTarget.Value = dto.Target; stepsTextBox.Text = dto.Steps; buttonAdd.Text = (dto.Id == Guid.Empty) ? "Add" : "Update"; }
public void Test_CIF_LoadFromDTO() { var cif = BuildCIFAsset(); var seDTO = new SocialExchangeDTO() { Name = Name.BuildName("Compliment"), Description = "When we are friends..", StartingConditions = new Conditions.DTOs.ConditionSetDTO(), Steps = new List <Name>(), InfluenceRules = new List <InfluenceRuleDTO>(), Target = Name.BuildName("[x]") }; var cifDTO = new CommeillFautDTO() { _SocialExchangesDtos = new[] { seDTO } }; cif.LoadFromDTO(cifDTO); Assert.AreEqual(cif.GetAllSocialExchanges().FirstOrDefault().Name.ToString(), "Compliment"); }
private static CommeillFautAsset BuildCIFAsset() { var seDTO = new SocialExchangeDTO() { Name = Name.BuildName("Flirt"), Description = "When I'm atracted to...", Target = Name.BuildName("[t]"), StartingConditions = new Conditions.DTOs.ConditionSetDTO() { ConditionSet = new string[] { "Has(Floor) = SELF" } }, Steps = new List <Name>() { (Name)"Start", (Name)"Answer", (Name)"Finish" }, InfluenceRules = new List <InfluenceRuleDTO>() { new InfluenceRuleDTO() { Value = 5, Mode = (Name)"General", Rule = new Conditions.DTOs.ConditionSetDTO() { ConditionSet = new string[] { "Likes([t]) = True" } } }, new InfluenceRuleDTO() { Value = 10, Mode = (Name)"Love", Rule = new Conditions.DTOs.ConditionSetDTO() { ConditionSet = new string[] { "Likes([t]) = True", "EventId(Action-End, [i], Speak(*, *, *, *), [t])>0" } } } } }; var cif1 = new CommeillFautAsset(); cif1.AddOrUpdateExchange(seDTO); var seDTO2 = new SocialExchangeDTO() { Name = Name.BuildName("Insult"), Description = "I hate you ", Target = Name.BuildName("[t]"), StartingConditions = new Conditions.DTOs.ConditionSetDTO() { ConditionSet = new string[] { "IsAgent(SELF) = True" } }, Steps = new List <Name>() { (Name)"Start" }, InfluenceRules = new List <InfluenceRuleDTO>() { new InfluenceRuleDTO() { Value = 4, Rule = new Conditions.DTOs.ConditionSetDTO() { ConditionSet = new string[] { "Likes([t]) = False" } } } } }; cif1.AddOrUpdateExchange(seDTO2); return(cif1); }
private void UpdateConditions(SocialExchangeDTO reaction) { conditions.SetData(reaction?.StartingConditions); }
public void UpdateSocialExchange(SocialExchangeDTO newReaction) { m_SocialExchanges.Remove(m_SocialExchanges.Find(x => x.Name == newReaction.Name)); m_SocialExchanges.Add(new SocialExchange(newReaction)); }