Exemplo n.º 1
0
        private void ThreadFinished(GThread th)
        {
            // cast GThread back to eduGRID_Thread
            eduGRID_Thread thread = (eduGRID_Thread)th;

            this.Append_Queryset(this.Queryset.GetUpperBound(0), "", "", "Bot", thread.Result);
            this.Refresh_Display();
            //tmr_Scroll.Enabled = true;
            //ga.Threads.Clear();
            //ga.Stop();
        }
Exemplo n.º 2
0
        private void btn_Send_Click(object sender, EventArgs e)
        {
            if (txt_Query.Text.Trim() == "")
            {
                return;
            }

            switch (txt_Query.Text.Trim().ToLower())
            {
            case "close":
                if (MessageBox.Show("Are you sure you want to exit?", "Confirmation", MessageBoxButtons.YesNoCancel) == DialogResult.Yes)
                {
                    if (ga != null)
                    {
                        ga.Stop();
                    }
                    this.Close();
                    Application.Exit();
                    return;
                }
                break;

            case "quit":
                if (MessageBox.Show("Are you sure you want to exit?", "Confirmation", MessageBoxButtons.YesNoCancel) == DialogResult.Yes)
                {
                    if (ga != null)
                    {
                        ga.Stop();
                    }
                    this.Close();
                    Application.Exit();
                    return;
                }
                break;

            case "exit":
                if (MessageBox.Show("Are you sure you want to exit?", "Confirmation", MessageBoxButtons.YesNoCancel) == DialogResult.Yes)
                {
                    if (ga != null)
                    {
                        ga.Stop();
                    }
                    this.Close();
                    Application.Exit();
                    return;
                }
                break;
            }
            if (!connected)
            {
                if (lookingforManagerIP)
                {
                    ManagerIP      = txt_Query.Text;
                    Queryset[0].As = "Me";
                    Queryset[0].A  = txt_Query.Text;
                    System.Array.Resize(ref Queryset, 2);
                    Queryset[1].Qs = "Bot";
                    Queryset[1].Q  = "Roger. Also tell me the Port to connect to..";
                    Queryset[1].As = "";
                    Queryset[1].A  = "";
                    Refresh_Display();
                    lookingforManagerIP = false;
                }
                else
                {
                    Add_new_Queryset("Bot", "Roger that. Connecting...", "", "");
                    Refresh_Display();
                    this.Refresh();
                    //Chat_Display.Refresh();
                    tmr_Scroll.Enabled = true;

                    Port = System.Convert.ToInt32(txt_Query.Text.ToString());
                    tmr_connect.Enabled = true;
                }
            }
            else
            {
                eduGRID_Thread thread = new eduGRID_Thread(txt_Query.Text.ToString());
                //ga.Threads.Clear();
                //ga.Threads.Add(thread);
                Add_new_Queryset("Me", txt_Query.Text.ToString(), "", "");
                Refresh_Display();
                //ga.Stop();
                //ga.Start();
                ga.StartThread(thread);
                tmr_Scroll.Enabled = true;
            }
            txt_Query.Text = "";
        }
Exemplo n.º 3
0
        private void btn_Send_Click(object sender, EventArgs e)
        {
            if (txt_Query.Text.Trim() == "")
                return;

            switch (txt_Query.Text.Trim().ToLower())
            {
                case "close":
                    if (MessageBox.Show("Are you sure you want to exit?", "Confirmation", MessageBoxButtons.YesNoCancel) == DialogResult.Yes)
                    {
                        if(ga!=null)
                            ga.Stop();
                        this.Close();
                        Application.Exit();
                        return;
                    }
                    break;
                case "quit":
                    if (MessageBox.Show("Are you sure you want to exit?", "Confirmation", MessageBoxButtons.YesNoCancel) == DialogResult.Yes)
                    {
                        if (ga != null)
                            ga.Stop();
                        this.Close();
                        Application.Exit();
                        return;
                    }
                    break;
                case "exit":
                    if (MessageBox.Show("Are you sure you want to exit?", "Confirmation", MessageBoxButtons.YesNoCancel) == DialogResult.Yes)
                    {
                        if (ga != null)
                            ga.Stop();
                        this.Close();
                        Application.Exit();
                        return;
                    }
                    break;
            }
            if (!connected)
            {
                if (lookingforManagerIP)
                {
                    ManagerIP = txt_Query.Text;
                    Queryset[0].As = "Me";
                    Queryset[0].A = txt_Query.Text;
                    System.Array.Resize(ref Queryset, 2);
                    Queryset[1].Qs = "Bot";
                    Queryset[1].Q = "Roger. Also tell me the Port to connect to..";
                    Queryset[1].As = "";
                    Queryset[1].A = "";
                    Refresh_Display();
                    lookingforManagerIP = false;
                }
                else
                {
                    Add_new_Queryset("Bot", "Roger that. Connecting...", "", "");
                    Refresh_Display();
                    this.Refresh();
                    //Chat_Display.Refresh();
                    tmr_Scroll.Enabled = true;

                    Port = System.Convert.ToInt32(txt_Query.Text.ToString());
                    tmr_connect.Enabled = true;

                }

            }
            else
            {
                eduGRID_Thread thread = new eduGRID_Thread(txt_Query.Text.ToString());
                //ga.Threads.Clear();
                //ga.Threads.Add(thread);
                Add_new_Queryset("Me", txt_Query.Text.ToString(), "", "");
                Refresh_Display();
                //ga.Stop();
                //ga.Start();
                ga.StartThread(thread);
                tmr_Scroll.Enabled = true;

            }
            txt_Query.Text = "";
        }