Ejemplo n.º 1
0
        private void buttonAddOrUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                var newDA = new DialogueStateActionDTO
                {
                    CurrentState = textBoxCurrentState.Value.ToString(),
                    NextState    = textBoxNextState.Value.ToString(),
                    Meaning      = textBoxMeaning.Value.ToString(),
                    Style        = textBoxStyle.Value.ToString(),
                    Utterance    = textBoxUtterance.Text
                };

                if (dto.Id == Guid.Empty)
                {
                    UpdatedGuid = asset.AddDialogAction(newDA);
                }
                else
                {
                    UpdatedGuid = asset.EditDialogAction(dto, newDA);
                }
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Save the notes for this crew member or position
        /// </summary>
        public void SaveNote(string subject, string note)
        {
            var newNote = new DialogueStateActionDTO
            {
                CurrentState = "Player_Note",
                NextState    = subject.NoSpaces(),
                Meaning      = Name.NIL_STRING,
                Style        = Name.NIL_STRING,
                Utterance    = note
            };
            var savedNote = iat.GetDialogueActionsByState("Player_Note").FirstOrDefault(s => s.NextState == subject.NoSpaces());

            if (savedNote == null)
            {
                iat.AddDialogAction(newNote);
            }
            else
            {
                iat.EditDialogAction(savedNote, newNote);
            }
            iat.Save();
        }