Exemplo n.º 1
0
        //----------------------------------  GENERIC COMMANDS FOR THERA-MEM DIALOG -----------------------//

        private void btnPlay_Click(object sender, EventArgs e)
        {
            int    numCommands           = 1;
            string boxValue              = numCommands.ToString() + "{";
            bool   CorrectOptionSelected = false;

            if (btnPlay.Text == "Stop")
            {
                CorrectOptionSelected = true;
                boxValue = numCommands.ToString() + "{$TheraMem_Stop";
            }
            else
            {
                // Game is starting
                string tmpString = "";
                tmpString += comboGameStyle.SelectedItem.ToString();

                if (tmpString == "TheraMem ( Original )")
                {
                    CorrectOptionSelected = true;
                    boxValue += "$TheraMemOriginal";
                }
                else if (tmpString == "TheraMem ( Memory )")
                {
                    CorrectOptionSelected = true;
                    boxValue += "$TheraMemMemory";
                }
                else if (tmpString == "TheraMem ( One-Handed )")
                {
                    CorrectOptionSelected = true;
                    boxValue += "$TheraMemOneHanded";

                    Form leftOrRightChoice = new TheraMemLeftOrRight(this);
                    leftOrRightChoice.ShowDialog();
                    boxValue += "_" + this.leftOrRight;
                }
                else
                {
                    // Nothing
                }
            }

            boxValue += "};";

            if (CorrectOptionSelected)
            {
                string toSend = "";
                toSend += applicationCode + "," + boxValue;

                sendString(toSend);

                warning.Text = "";
                if (btnPlay.Text == "Play")
                {
                    gameRunning            = true;
                    comboGameStyle.Enabled = false;
                    btnPause.Enabled       = true;
                    btnPause.Text          = "Resume";
                    btnPlay.Text           = "Stop";
                }
                else if (btnPlay.Text == "Stop")
                {
                    gameRunning            = false;
                    comboGameStyle.Enabled = true;
                    btnPause.Text          = "Pause";
                    btnPause.Enabled       = false;
                    btnPlay.Text           = "Play";
                }
            }
            else
            {
                warning.Text = "Select one of the available game options and then Play";
            }
        }
Exemplo n.º 2
0
        //----------------------------------  GENERIC COMMANDS FOR THERA-MEM DIALOG -----------------------//
        private void btnPlay_Click(object sender, EventArgs e)
        {
            int numCommands = 1;
            string boxValue = numCommands.ToString() + "{";
            bool CorrectOptionSelected = false;

            if (btnPlay.Text == "Stop")
            {
                CorrectOptionSelected = true;
                boxValue = numCommands.ToString() + "{$TheraMem_Stop";
            }
            else
            {
                // Game is starting
                string tmpString = "";
                tmpString += comboGameStyle.SelectedItem.ToString();

                if (tmpString == "TheraMem ( Original )")
                {
                    CorrectOptionSelected = true;
                    boxValue += "$TheraMemOriginal";
                }
                else if (tmpString == "TheraMem ( Memory )")
                {
                    CorrectOptionSelected = true;
                    boxValue += "$TheraMemMemory";
                }
                else if (tmpString == "TheraMem ( One-Handed )")
                {
                    CorrectOptionSelected = true;
                    boxValue += "$TheraMemOneHanded";

                    Form leftOrRightChoice = new TheraMemLeftOrRight(this);
                    leftOrRightChoice.ShowDialog();
                    boxValue += "_" + this.leftOrRight;
                }
                else
                {
                    // Nothing
                }
            }

            boxValue += "};";

            if (CorrectOptionSelected)
            {
                string toSend = "";
                toSend += applicationCode + "," + boxValue;

                sendString(toSend);

                warning.Text = "";
                if (btnPlay.Text == "Play")
                {
                    gameRunning = true;
                    comboGameStyle.Enabled = false;
                    btnPause.Enabled = true;
                    btnPause.Text= "Resume";
                    btnPlay.Text = "Stop";
                }
                else if (btnPlay.Text == "Stop")
                {
                    gameRunning = false;
                    comboGameStyle.Enabled = true;
                    btnPause.Text = "Pause";
                    btnPause.Enabled = false;
                    btnPlay.Text = "Play";
                }
            }
            else
            {
                warning.Text = "Select one of the available game options and then Play";
            }
        }