Пример #1
0
        void btnChatTriggerAdd_Click(object sender, MVControlEventArgs e)
        {
            try
            {
                if (edtChatTriggerPattern.Text.Length <= 0)
                {
                    throw new Exception("You have to enter a Pattern for your ChatTrigger.");
                }

                ChatTrigger trigger = new ChatTrigger(
                    edtChatTriggerPattern.Text,
                    (Webhook)chcChatTriggerWebhook.Data[chcChatTriggerWebhook.Selected],
                    edtChatTriggerMessage.Text,
                    true);

                ChatTriggers.Add(trigger);

                RefreshChatTriggerList();
                SaveSettings();
            }
            catch (Exception ex)
            {
                Util.WriteToChat("Error adding new ChatTrigger: " + ex.Message);
                Util.LogError(ex);
            }
        }
Пример #2
0
        private void lstChatTriggers_Click(object sender, int row, int col)
        {
            try
            {
                switch (col)
                {
                case ChatTriggersList.Enabled:
                    bool enabled = (bool)lstChatTriggers[row][col][0];

                    if (enabled)
                    {
                        ChatTriggers[row].Enable();
                    }
                    else
                    {
                        ChatTriggers[row].Disable();
                    }

                    SaveSettings();

                    break;

                case ChatTriggersList.Delete:
                    ChatTriggers.RemoveAt(row);
                    RefreshChatTriggerList();

                    SaveSettings();

                    break;

                default:
                    PrintChatTrigger(ChatTriggers[row]);

                    break;
                }
                ;
            }
            catch (Exception ex)
            {
                Util.LogError(ex);
            }
        }