Example #1
0
 public async Task InicioRapido(string entrada)
 {
     try
     {
         var tempo  = new TimeSpan(0, 0, 30);
         var funcao = new FuncaoMicroondas(8, tempo);
         await Iniciar(funcao, entrada);
     }
     catch (Exception e)
     {
         if (!OnErro(e.Message))
         {
             throw;
         }
     }
 }
Example #2
0
        public void CadastrarFuncao(int potencia, TimeSpan tempo, string nome, string instrucao, char caractere, string alimento, bool SalvarAoInserir = true)
        {
            if (nome.Trim() == "")
            {
                if (!OnErro("O nome da função não informado"))
                {
                    throw new NomeFuncaoNaoInformadaException("O nome da função não informado");
                }
            }

            var funcao = new FuncaoMicroondas(potencia, tempo, nome, instrucao, caractere, alimento);

            funcao.Validar(); // garante que está dentro das restrições.
            Funcoes.Add(funcao);

            if (SalvarAoInserir)
            {
                SalvarFuncoesCadastradas();
            }
        }
Example #3
0
        public async Task Iniciar(FuncaoMicroondas funcao, string entrada)
        {
            try
            {
                funcao.Validar();
                funcao.ValidarEntrada(entrada.Trim());

                FuncaoAtual     = funcao;
                EntradaAquecida = entrada;
                TempoRestante   = FuncaoAtual.Tempo;

                contadorSegundos = TimeSpan.Zero;

                await Ligar(entrada);
            }
            catch (Exception e)
            {
                if (!OnErro(e.Message))
                {
                    throw;
                }
            }
        }