Ejemplo n.º 1
0
        // Далее
        private void menuItem1_Click(object sender, EventArgs e)
        {
            if (comboBox2.SelectedIndex == -1)
            {
                MessageBox.Show("Не выбран тип игры!", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                return;
            }


            // Folder
            if (combobox1.SelectedIndex == -1)
            {
                this.Folder_Id   = -1;
                this.Folder_Name = combobox1.Text.Trim();
            }
            else
            {
                this.Folder_Id   = ((comboitem_id_name)combobox1.Items[combobox1.SelectedIndex]).GetId();
                this.Folder_Name = "";
            }

            // N
            if (comboBox3.SelectedIndex == -1)
            {
                this.N_Id   = -1;
                this.N_Name = comboBox3.Text.Trim();
            }
            else
            {
                this.N_Id   = ((comboitem_id_name)comboBox3.Items[comboBox3.SelectedIndex]).GetId();
                this.N_Name = "";
            }

            // S
            if (comboBox4.SelectedIndex == -1)
            {
                this.S_Id   = -1;
                this.S_Name = comboBox4.Text.Trim();
            }
            else
            {
                this.S_Id   = ((comboitem_id_name)comboBox4.Items[comboBox4.SelectedIndex]).GetId();
                this.S_Name = "";
            }

            // E
            if (comboBox5.SelectedIndex == -1)
            {
                this.E_Id   = -1;
                this.E_Name = comboBox5.Text.Trim();
            }
            else
            {
                this.E_Id   = ((comboitem_id_name)comboBox5.Items[comboBox5.SelectedIndex]).GetId();
                this.E_Name = "";
            }

            // W
            if (comboBox6.SelectedIndex == -1)
            {
                this.W_Id   = -1;
                this.W_Name = comboBox6.Text.Trim();
            }
            else
            {
                this.W_Id   = ((comboitem_id_name)comboBox6.Items[comboBox6.SelectedIndex]).GetId();
                this.W_Name = "";
            }

            //Place
            this.Place = textbox1.Text.Trim();

            //Comment
            this.Comment = textBox2.Text.Trim();



            if (edit_mode)
            {
                done2steps        = true;
                this.DialogResult = DialogResult.OK;
            }
            else
            {
                // Форма настроек игры (зависит от типа)
                if (comboBox2.SelectedIndex == 0)
                {
                    // 0 - Роббер
                    GameOptionsForm_Robber formR = new GameOptionsForm_Robber();
                    if (formR.ShowDialog() == DialogResult.OK && formR.accepted == true)
                    {
                        // скопировать частные опции игры:
                        this.GameTip     = (byte)(GameType.Robber);
                        this.GameOptions = formR.GameOptions;
                        this.FirstDealer = (byte)(formR.FirstDealer);
                        this.DealsCount  = DBNull.Value;
                        this.ZoneSwims   = DBNull.Value;

                        done2steps = true;

                        this.DialogResult = DialogResult.OK;
                    }
                }
                else if (comboBox2.SelectedIndex == 1)
                {
                    // 1 - Дубл
                    GameOptionsForm_Double formD = new GameOptionsForm_Double();
                    if (formD.ShowDialog() == DialogResult.OK && formD.accepted == true)
                    {
                        // скопировать частные опции игры:
                        this.GameTip     = (byte)(GameType.Sport);
                        this.GameOptions = DBNull.Value;
                        this.FirstDealer = (byte)(formD.FirstDealer);
                        this.DealsCount  = formD.DealsCount;
                        this.ZoneSwims   = formD.ZoneSwims;

                        done2steps = true;

                        this.DialogResult = DialogResult.OK;
                    }
                }
                else if (comboBox2.SelectedIndex == 2)
                {
                    // 2 - Комп
                    GameOptionsForm_Comp formC = new GameOptionsForm_Comp();
                    if (formC.ShowDialog() == DialogResult.OK && formC.accepted == true)
                    {
                        // скопировать частные опции игры:
                        this.GameTip     = (byte)(GameType.Compensat);
                        this.GameOptions = formC.GameOptions;
                        this.FirstDealer = (byte)(formC.FirstDealer);
                        this.DealsCount  = formC.DealsCount;
                        this.ZoneSwims   = formC.ZoneSwims;

                        done2steps = true;

                        this.DialogResult = DialogResult.OK;
                    }
                }
                else if (comboBox2.SelectedIndex == 3)
                {
                    // 3 - IMP
                    GameOptionsForm_SimpleIMP formI = new GameOptionsForm_SimpleIMP();
                    if (formI.ShowDialog() == DialogResult.OK && formI.accepted == true)
                    {
                        // скопировать частные опции игры:
                        this.GameTip     = (byte)(GameType.SimpleIMP);
                        this.GameOptions = DBNull.Value;
                        this.FirstDealer = (byte)(formI.FirstDealer);
                        this.DealsCount  = formI.DealsCount;
                        this.ZoneSwims   = formI.ZoneSwims;

                        done2steps = true;

                        this.DialogResult = DialogResult.OK;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        // Далее
        private void menuItem1_Click(object sender, EventArgs e)
        {
            if (comboBox2.SelectedIndex == -1)
            {
                MessageBox.Show("Не выбран тип игры!", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                return;
            }

            // Folder
            if (combobox1.SelectedIndex == -1)
            {
                this.Folder_Id = -1;
                this.Folder_Name = combobox1.Text.Trim();
            }
            else
            {
                this.Folder_Id = ((comboitem_id_name)combobox1.Items[combobox1.SelectedIndex]).GetId();
                this.Folder_Name = "";
            }

            // N
            if (comboBox3.SelectedIndex == -1)
            {
                this.N_Id = -1;
                this.N_Name = comboBox3.Text.Trim();
            }
            else
            {
                this.N_Id = ((comboitem_id_name)comboBox3.Items[comboBox3.SelectedIndex]).GetId();
                this.N_Name = "";
            }

            // S
            if (comboBox4.SelectedIndex == -1)
            {
                this.S_Id = -1;
                this.S_Name = comboBox4.Text.Trim();
            }
            else
            {
                this.S_Id = ((comboitem_id_name)comboBox4.Items[comboBox4.SelectedIndex]).GetId();
                this.S_Name = "";
            }

            // E
            if (comboBox5.SelectedIndex == -1)
            {
                this.E_Id = -1;
                this.E_Name = comboBox5.Text.Trim();
            }
            else
            {
                this.E_Id = ((comboitem_id_name)comboBox5.Items[comboBox5.SelectedIndex]).GetId();
                this.E_Name = "";
            }

            // W
            if (comboBox6.SelectedIndex == -1)
            {
                this.W_Id = -1;
                this.W_Name = comboBox6.Text.Trim();
            }
            else
            {
                this.W_Id = ((comboitem_id_name)comboBox6.Items[comboBox6.SelectedIndex]).GetId();
                this.W_Name = "";
            }

            //Place
            this.Place = textbox1.Text.Trim();

            //Comment
            this.Comment = textBox2.Text.Trim();

            if (edit_mode)
            {
                done2steps = true;
                this.DialogResult = DialogResult.OK;
            }
            else
            {
                // Форма настроек игры (зависит от типа)
                if (comboBox2.SelectedIndex == 0)
                {
                    // 0 - Роббер
                    GameOptionsForm_Robber formR = new GameOptionsForm_Robber();
                    if (formR.ShowDialog() == DialogResult.OK && formR.accepted == true)
                    {
                        // скопировать частные опции игры:
                        this.GameTip = (byte)(GameType.Robber);
                        this.GameOptions = formR.GameOptions;
                        this.FirstDealer = (byte)(formR.FirstDealer);
                        this.DealsCount = DBNull.Value;
                        this.ZoneSwims = DBNull.Value;

                        done2steps = true;

                        this.DialogResult = DialogResult.OK;
                    }
                }
                else if (comboBox2.SelectedIndex == 1)
                {
                    // 1 - Дубл
                    GameOptionsForm_Double formD = new GameOptionsForm_Double();
                    if (formD.ShowDialog() == DialogResult.OK && formD.accepted == true)
                    {
                        // скопировать частные опции игры:
                        this.GameTip = (byte)(GameType.Sport);
                        this.GameOptions = DBNull.Value;
                        this.FirstDealer = (byte)(formD.FirstDealer);
                        this.DealsCount = formD.DealsCount;
                        this.ZoneSwims = formD.ZoneSwims;

                        done2steps = true;

                        this.DialogResult = DialogResult.OK;
                    }
                }
                else if (comboBox2.SelectedIndex == 2)
                {
                    // 2 - Комп
                    GameOptionsForm_Comp formC = new GameOptionsForm_Comp();
                    if (formC.ShowDialog() == DialogResult.OK && formC.accepted == true)
                    {
                        // скопировать частные опции игры:
                        this.GameTip = (byte)(GameType.Compensat);
                        this.GameOptions = formC.GameOptions;
                        this.FirstDealer = (byte)(formC.FirstDealer);
                        this.DealsCount = formC.DealsCount;
                        this.ZoneSwims = formC.ZoneSwims;

                        done2steps = true;

                        this.DialogResult = DialogResult.OK;
                    }
                }
                else if (comboBox2.SelectedIndex == 3)
                {
                    // 3 - IMP
                    GameOptionsForm_SimpleIMP formI = new GameOptionsForm_SimpleIMP();
                    if (formI.ShowDialog() == DialogResult.OK && formI.accepted == true)
                    {
                        // скопировать частные опции игры:
                        this.GameTip = (byte)(GameType.SimpleIMP);
                        this.GameOptions = DBNull.Value;
                        this.FirstDealer = (byte)(formI.FirstDealer);
                        this.DealsCount = formI.DealsCount;
                        this.ZoneSwims = formI.ZoneSwims;

                        done2steps = true;

                        this.DialogResult = DialogResult.OK;
                    }
                }
            }
        }