예제 #1
0
        private void golfToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem sel_item = sender as ToolStripMenuItem;

            if (sel_item.Checked)
            {
                //foreach (ToolStripMenuItem item in selectToolStripMenuItem.DropDownItems)
                //{
                //    if (!item.Text.Equals(sel_item.Text))
                //        item.Checked = false;

                //    else
                //        item.Checked = true;

                //}

                if (IsProcessRunning)
                {
                    MessageBox.Show("A process is already running");
                    sel_item.Checked = false;
                    return;
                }
                else
                {
                    if (sel_item.Name == "Golf")
                    {
                        Form childForm = new GolfCrawler(sel_item.Name);
                        childForm.Name      = sel_item.Name;
                        childForm.MdiParent = this;
                        childForm.Show();
                    }
                    else
                    {
                        Form childForm = new OddsCrawler(sel_item.Name);
                        childForm.Name      = sel_item.Name;
                        childForm.MdiParent = this;
                        childForm.Show();
                    }
                }
            }
            else
            {
                foreach (Form form in this.MdiChildren)
                {
                    if (form.Name.Equals(sel_item.Name))
                    {
                        form.Close();
                    }
                }
            }
        }
        private void golfToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem sel_item = sender as ToolStripMenuItem;
            if (sel_item.Checked)
            {
                //foreach (ToolStripMenuItem item in selectToolStripMenuItem.DropDownItems)
                //{
                //    if (!item.Text.Equals(sel_item.Text))
                //        item.Checked = false;

                //    else
                //        item.Checked = true;

                //}

                if (IsProcessRunning)
                {
                    MessageBox.Show("A process is already running");
                    sel_item.Checked = false;
                    return;
                }
                else
                {
                    if (sel_item.Name == "Golf")
                    {
                        Form childForm = new GolfCrawler(sel_item.Name);
                        childForm.Name = sel_item.Name;
                        childForm.MdiParent = this;
                        childForm.Show();
                    }
                    else
                    {
                        Form childForm = new OddsCrawler(sel_item.Name);
                        childForm.Name = sel_item.Name;
                        childForm.MdiParent = this;
                        childForm.Show();
                    }
                }
            }
            else
            {
                foreach (Form form in this.MdiChildren)
                {
                    if (form.Name.Equals(sel_item.Name))
                    {
                        form.Close();
                    }
                }
            }
        }