void AddListboxResponse(ListBox list, ConversationalResponseItem responseItem) { if (starter.GetCharStat("intelligence") < 4 && responseItem.AltResponse != "") { responseItem.altResponse = true; } list.Items.Add(responseItem); }
private void conversationResponseListBox_MouseClick(object sender, MouseEventArgs e) { string botName = (string)whichBotTestComboBox.SelectedItem; int selectedItem = conversationResponseListBox.IndexFromPoint(e.X, e.Y); if (selectedItem == -1) { } else { ConversationalResponseItem cri = (ConversationalResponseItem)conversationResponseListBox.Items[selectedItem]; if (cri.EngineCommand != "") { MessageBox.Show("Parse engine command " + cri.EngineCommand); } if (cri.To != 0) { ConversationalItem ci = Conversational.Instance.GetBotConversationByID(botName, cri.To); if (ci != null) { ChangeConversation(ci); } else { tableLayoutPanel1.Visible = false; MessageBox.Show("There is no conversation at ID: " + cri.To.ToString() + "\nPlease check your logic", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { tableLayoutPanel1.Visible = false; whichBotTestComboBox.SelectedIndex = 0; whichBotTestComboBox.Text = string.Empty; MessageBox.Show("You have completed your conversation with " + botName, "Notice", MessageBoxButtons.OK, MessageBoxIcon.Information); tabControl.SelectTab(tabPageConfig); } } }
void conversationResponseListBox_SelectedIndexChange(ListBox sender) { int selectedItem = conversationResponseListBox.SelectedIndex; if (selectedItem == -1) { } else { ConversationalResponseItem cri = (ConversationalResponseItem)conversationResponseListBox.Items[conversationResponseListBox.SelectedIndex]; if (cri.EngineCommand != "") { string[] commandsList = cri.EngineCommand.Split(' '); foreach (string command in commandsList) { ParseEngineCommand(command.Split('$')); } } if (cri.To != 0) { ConversationalItem ci = Conversational.Instance.GetBotConversationByID(BotName, cri.To); if (ci != null) { ChangeConversation(ci); } } else { SetShouldDetach(); } } }