public bool criarNovoPrograma() { Console.WriteLine("Escreva o alimento que o programa irá esquentar"); String nome = Console.ReadLine().Trim(); Console.WriteLine("Escreva a potencia com um numero de {0} a {1}", Constants.minPowerPossible, Constants.maxPowerPossible); String potenciaString = Console.ReadLine(); int potencia; if (!Int32.TryParse(potenciaString, out potencia)) { potencia = -1; } Console.WriteLine("Escreva o tempo com um numero de {0} a {1}", Constants.minTimePossible, Constants.maxTimePossible); String tempoString = Console.ReadLine(); int tempo; if (!Int32.TryParse(tempoString, out tempo)) { tempo = -1; } Console.WriteLine("Escreva o caractere de aquecimento que o programa irá esquentar"); char caracter = Console.ReadLine().ToCharArray()[0]; Console.WriteLine("Escreva o alimento que o programa irá esquentar"); String instrucao = Console.ReadLine(); ResponseSchema response = programsController.criarPrograma(nome, potencia, tempo, caracter, instrucao); Console.WriteLine(response.getMessage()); return(response.getError()); }
public ResponseSchema definePrograma(ProgramsSchema programa) { ResponseSchema resNome = model.setAlimento(programa.getName()); ResponseSchema resChar = model.setCaractere(programa.getCharacter()); ResponseSchema resTempo = model.setTempo(programa.getTime()); ResponseSchema resPotencia = model.setPotencia(programa.getPower()); if (resNome.getError()) { return(resNome); } if (resChar.getError()) { return(resChar); } if (resPotencia.getError()) { return(resPotencia); } if (resTempo.getError()) { return(resTempo); } return(new ResponseSchema(false, Constants.messageSuccessSetProgram)); }
public bool aquecer() { ResponseSchema response = microWaveController.aquecer(); Console.WriteLine(response.getMessage()); return(response.getError()); }
private bool defineTempo(int valor) { ResponseSchema response = microWaveController.defineTempo(valor); Console.WriteLine(response.getMessage()); return(response.getError()); }
protected void UpdateResponse(ResponseSchema dataResponse) { try { // Create an instance of our AppDelegate AppDelegate appDelegate = UIApplication.SharedApplication.Delegate as AppDelegate; // Update Data appDelegate.Storage = api.toString(dataResponse); } catch (Exception ex) { // Console Console.WriteLine(ex.ToString()); } }
protected void UpdateResponse(ResponseSchema dataResponse) { try { // Updated Session ISharedPreferencesEditor session_editor = session.Edit(); // Update Data session_editor.PutString("storage", api.toString(dataResponse)); session_editor.Commit(); } catch (Exception ex) { // Console Console.WriteLine(ex.ToString()); } }
public string GetResponseSchemaName() { switch (ResponseSchema) { case null: return("@undefined"); case JValue value: return($"@{((string)value).ToLowerInvariant()}"); case JObject schema: return((string)schema["title"]); default: throw new ApplicationException($"unexpected ResponseSchema type: {ResponseSchema.GetType()}"); } }
public string GetResponseSchemaName() { switch (ResponseSchema) { case null: return("@undefined"); case string value: return($"@{value.ToLowerInvariant()}"); case Dictionary <string, object?> schema: return((string?)schema["title"] ?? throw new NotSupportedException($"invalid ResponseSchema: {schema["title"]}")); default: throw new ApplicationException($"unexpected ResponseSchema type: {ResponseSchema.GetType()}"); } }
public bool defineAlimento(String valor) { ProgramsSchema programa = programsController.buscarPrograma(valor); if (programa.getName() != "default") { ResponseSchema response = microWaveController.definePrograma(programa); Console.WriteLine(response.getMessage()); return(response.getError()); } Console.WriteLine(Constants.messageErrorGetProgram); Console.WriteLine(""); Console.WriteLine(programsController.buscarNomeProgramas()); Console.WriteLine(""); return(true); }