Exemple #1
0
            public void Write(string txt)
            {
                var rc = RichTextBox;

                if (MCCClient != null)
                {
                    MCCClient.SendText(txt);
                }
                if (rc != null && rc.InvokeRequired)
                {
                    rc.Invoke((MethodInvoker)(() => rc.AppendText(txt + "\n")));
                }
            }
        /// <summary>
        /// Send the input in the input box, if any, by pressing the "Send" button.
        /// Handle "/quit" command to properly disconnect and close the GUI.
        /// </summary>

        private void btn_send_Click(object sender, EventArgs e)
        {
            if (Client != null)
            {
                if (box_input.Text.Trim().ToLower() == "/quit")
                {
                    Client.Close();
                    ((BotBox)(this.Parent.Parent.Parent)).DelBot();
                }
                else
                {
                    Client.SendText(box_input.Text);
                    previous.AddLast(box_input.Text);
                    box_input.Text = "";
                }
            }
        }