public void AddEmotion(EmotionDTO newEmotion) { var resultingEmotion = _emotionalAppraisalAsset.AddActiveEmotion(newEmotion); Emotions.DataSource.Add(resultingEmotion); Emotions.Refresh(); }
public void UpdateEmotion(EmotionDTO oldEmotion, EmotionDTO newEmotion) { _emotionalAppraisalAsset.RemoveEmotion(oldEmotion); _emotionalAppraisalAsset.AddActiveEmotion(newEmotion); Emotions.DataSource = _emotionalAppraisalAsset.ActiveEmotions.ToList(); Emotions.Refresh(); }
public void UpdateEmotion(EmotionDTO oldEmotion, EmotionDTO newEmotion) { _rpcAsset.RemoveEmotion(oldEmotion); _rpcAsset.AddActiveEmotion(newEmotion); Emotions.DataSource = _rpcAsset.GetAllActiveEmotions().ToList(); Emotions.Refresh(); }
private void addOrEditButton_Click(object sender, EventArgs e) { try { var newEmotion = new EmotionDTO { Type = comboBoxEmotionType.Text, Intensity = int.Parse(comboBoxIntensity.Text), CauseEventId = uint.Parse(textBoxCauseId.Text) }; if (_emotionToEdit == null) { _emotionalStateVm.AddEmotion(newEmotion); } else { this._emotionalStateVm.UpdateEmotion(_emotionToEdit, newEmotion); } Close(); } catch (Exception ex) { MessageBox.Show(ex.Message, Resources.ErrorDialogTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public AddOrEditEmotionForm(EmotionalStateVM emotionalStateVM, EmotionDTO emotionToEdit = null) { InitializeComponent(); _emotionalStateVm = emotionalStateVM; _emotionToEdit = emotionToEdit; //Default Values comboBoxIntensity.Text = "1"; comboBoxEmotionType.DataSource = EmotionalAppraisalAsset.EmotionTypes; if (emotionToEdit != null) { this.Text = "Update Emotion"; this.addOrEditButton.Text = "Update"; comboBoxIntensity.Text = Math.Round(emotionToEdit.Intensity).ToString(); comboBoxEmotionType.Text = emotionToEdit.Type; textBoxCauseId.Text = emotionToEdit.CauseEventId.ToString(); if (emotionToEdit.Target != null) { targetBox.Text = emotionToEdit.Target.ToString(); } } }
public void RemoveEmotion(EmotionDTO emotion) { var activeEmotion = new ActiveEmotion(emotion, this.DefaultEmotionDisposition.Decay, this.DefaultEmotionDisposition.Threshold); string hash = calculateHashString(activeEmotion, m_parent.m_am); emotionPool.Remove(hash); }
public void AddEmotion(EmotionDTO newEmotion) { var resultingEmotion = _rpcAsset.AddActiveEmotion(newEmotion); Emotions.DataSource.Add(resultingEmotion); Emotions.Refresh(); _mainForm.SetModified(); }
public EmotionDTO AddActiveEmotion(EmotionDTO emotion, AM am) { var activeEmotion = new ActiveEmotion(emotion, am, 1, 1); if (emotionPool.ContainsKey(calculateHashString(activeEmotion))) { throw new ArgumentException("This given emotion is already related to given cause", nameof(emotion)); } emotionPool.Add(calculateHashString(activeEmotion), activeEmotion); activeEmotion.GetCause(am).LinkEmotion(activeEmotion.EmotionType); return(activeEmotion.ToDto(am)); }
public EmotionDTO AddActiveEmotion(EmotionDTO emotion) { EmotionDisposition disposition = GetEmotionDisposition(emotion.Type); var activeEmotion = new ActiveEmotion(emotion, disposition.Threshold, disposition.Decay); string hash = calculateHashString(activeEmotion, m_parent.m_am); if (emotionPool.ContainsKey(hash)) { throw new Exception("Emotion already exists"); } emotionPool.Add(hash, activeEmotion); activeEmotion.GetCause(m_parent.m_am).LinkEmotion(activeEmotion.EmotionType); return(activeEmotion.ToDto(m_parent.m_am)); }
//TODO: Discuss with Pedro this hierarchy. Problem: ActiveEmotion might be a bit too tied to OCCEmotion public ActiveEmotion(EmotionDTO emotionDTO, int threshold, int decay) { var occType = OCCEmotionType.Parse(emotionDTO.Type); if (occType == null) { throw new Exception("Unknown emotion type"); } this.EmotionType = occType.Name; this.Valence = occType.Valence; this.AppraisalVariables = occType.AppraisalVariables.ToArray(); this.InfluenceMood = occType.InfluencesMood; this.CauseId = emotionDTO.CauseEventId; this.Direction = null; //TODO: handle direction correctly this.Threshold = threshold; this.Decay = decay; this.Intensity = emotionDTO.Intensity; }
public AddOrEditEmotionForm(EmotionalStateVM emotionalStateVM, EmotionDTO emotionToEdit = null) { InitializeComponent(); _emotionalStateVm = emotionalStateVM; _emotionToEdit = emotionToEdit; //Default Values comboBoxIntensity.Text = "1"; comboBoxEmotionType.DataSource = _emotionalStateVm.EmotionTypes; if (emotionToEdit != null) { this.Text = Resources.EditEmotionFormTitle; this.addOrEditButton.Text = Resources.UpdateButtonLabel; comboBoxIntensity.Text = Math.Round(emotionToEdit.Intensity).ToString(); comboBoxEmotionType.Text = emotionToEdit.Type; textBoxCauseId.Text = emotionToEdit.CauseEventId.ToString(); } }
public void RemoveEmotion(EmotionDTO emotion) { m_emotionalState.RemoveEmotion(emotion, m_am); }
/// <summary> /// Creates a new <b>Active Emotion</b> and adds it to the asset's currently experiencing emotions set. /// </summary> /// <exception cref="ArgumentException"> /// Thrown if the given emotion is already being experienced by the asset. /// This can happend if in the given EmotionDTO the pair of parameters <b>Type</b> and <b>CauseEventId</b> /// are equal to an already existent ActiveEmotion in the asset. /// </exception> /// <param name="emotion">The DTO containing the emotion parameters to be used in the active emotion creation process</param> /// <returns>The DTO representing the actual emotion added to the active emotion set.</returns> public EmotionDTO AddActiveEmotion(EmotionDTO emotion) { return(m_emotionalState.AddActiveEmotion(emotion, m_am)); }
public void RemoveEmotion(EmotionDTO emotion, AM am) { var activeEmotion = new ActiveEmotion(emotion, am, 1, 1); emotionPool.Remove(calculateHashString(activeEmotion)); }