示例#1
0
 private void btnAddProgram_Click(object sender, EventArgs e)
 {
     try
     {
         Verifiers.VerifyName(txbFood.Text);
         if (Verifiers.VerifyProgram(txbFood.Text))
         {
             throw new CustomExceptions("Programa já existente.");
         }
         Verifiers.VerifyTimer(txbTimer.Text);
         int  timer     = int.Parse(txbTimer.Text);
         int  power     = Verifiers.VerifyPower(txbPower.Text);
         char character = Verifiers.VerifyChar(txbChar.Text);
         DefaultPrograms.AddCustomProgram(txbFood.Text, txbInstruction.Text, character, power, timer);
         ReadPrograms();
     }
     catch (CustomExceptions errorMessage)
     {
         MessageBox.Show(errorMessage.Message);
     }
     catch (FormatException errorMessage)
     {
         MessageBox.Show(errorMessage.Message);
     }
 }
示例#2
0
        public void OutOfRange()
        {
            string minValue = "0";
            string maxValue = "121";

            Verifiers.VerifyTimer(minValue);
            Verifiers.VerifyTimer(maxValue);
            Verifiers.VerifyPower(minValue);
            Verifiers.VerifyPower(maxValue);
        }
示例#3
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            try
            {
                Verifiers.VerifyName(txbFood.Text);
                string path = "";
                string food = txbFood.Text;
                if (FileIO.IsFile(txbFood.Text))
                {
                    path = txbFood.Text;
                    food = FileIO.ReadFile(path);
                }

                Verifiers.VerifyTimer(txbTimer.Text);
                int timer = int.Parse(txbTimer.Text);

                int power = Verifiers.VerifyPower(txbPower.Text);
                txbPower.Text = power.ToString();

                char character = Verifiers.VerifyChar(txbChar.Text);

                plate = new Plate(food, timer, power, character);

                if (path != "")
                {
                    displayTimerCount = plate.Timer;
                    timerDisplay.Start();
                    plate.StartCook(path);
                }
                else
                {
                    displayTimerCount = plate.Timer;
                    timerDisplay.Start();
                    plate.StartCook();
                }
            }
            catch (CustomExceptions errorMessage)
            {
                MessageBox.Show(errorMessage.Message);
            }
            catch (FormatException errorMessage)
            {
                MessageBox.Show(errorMessage.Message);
            }
            catch (IOException errorMessage)
            {
                MessageBox.Show(errorMessage.Message);
            }
            catch (Exception errorMessage)
            {
                MessageBox.Show(errorMessage.Message);
            }
        }