Ejemplo n.º 1
0
        private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }
            var next = dataGridView1.Rows[e.RowIndex].Cells[0].Value as ConversationError <ConversationNode>;

            if (next != null)
            {
                if (next != m_current)
                {
                    m_current = next;
                    m_node    = m_current.Nodes.GetEnumerator();
                }

                if (m_node.MoveNext())
                {
                    HightlightNode.Execute(m_node.Current);
                }
                else
                {
                    m_node = m_current.Nodes.GetEnumerator();
                    if (m_node.MoveNext())
                    {
                        HightlightNode.Execute(m_node.Current);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        protected async Task HandleErrorAsync(ConversationError error, string input)
        {
            var errorMsg = _userLocalization["errors"] as Dictionary <string, object>;

            var backgroundNotFound = errorMsg["background_not_found"].ToString()
                                     .Replace("{background}", input)
                                     .Replace("{backgrounds}", _backgroundString);

            var msg = error switch
            {
                ConversationError.BackgroundNotFound => backgroundNotFound,
                ConversationError.LengthTooShort => errorMsg["length_too_short"].ToString(),
                ConversationError.MessageNotFound => errorMsg["no_message"].ToString(),
                ConversationError.MessageTooLong => errorMsg["message_too_long"].ToString(),
                ConversationError.WrongCharacterSet => errorMsg["wrong_character_set"].ToString(),
                ConversationError.PoseNotFound => errorMsg["pose_not_exist"].ToString(),
                ConversationError.ClothesNotFound => errorMsg["clothes_not_exist"].ToString(),
                ConversationError.FaceNotFound => errorMsg["face_not_exist"].ToString(),
                _ => string.Empty
            };

            if (!string.IsNullOrEmpty(msg))
            {
                await Context.Channel.SendMessageAsync(msg);
            }
        }
    }
Ejemplo n.º 3
0
 public void OnExceptionReThrow()
 {
     try
     {
         using (var t = new ConversationError())
         {
             Assert.Throws <ConversationException>(t.Start);
             Assert.Throws <ConversationException>(t.Resume);
             Assert.Throws <ConversationException>(t.Pause);
             Assert.Throws <ConversationException>(t.FlushAndPause);
             Assert.Throws <ConversationException>(t.End);
             Assert.Throws <ConversationException>(t.Abort);
         }
     }
     catch (NotImplementedException)
     {
         // The Abort during Dispose
     }
 }
Ejemplo n.º 4
0
 public void OnExceptionWithoutReThrow()
 {
     try
     {
         using (var t = new ConversationError())
         {
             t.OnException += AssertException;
             t.Start();
             t.Pause();
             t.FlushAndPause();
             t.Resume();
             t.End();
             t.Abort();
         }
     }
     catch (NotImplementedException)
     {
         // The Abort during Dispose is not managed by the OnException events
     }
 }
Ejemplo n.º 5
0
 public static IErrorListElement MakeElement(ConversationError <ConversationNode> error, IConversationEditorControlData <ConversationNode, TransitionNoduleUIInfo> file)
 {
     return(new Element(error, file));
 }
Ejemplo n.º 6
0
 public Element(ConversationError <ConversationNode> error, IConversationEditorControlData <ConversationNode, TransitionNoduleUIInfo> file)
 {
     Nodes   = error.Nodes;
     File    = file;
     Message = error.Message;
 }
Ejemplo n.º 7
0
        public void ConversationError_Constructor_SetsProperties()
        {
            // Arrange
            var code = 1;
            var description = "Description";

            // Act
            var error = new ConversationError(code, description);

            // Assert
            Assert.Equal(code, error.Code);
            Assert.Equal(description, error.Description);
        }