public ListaDeProgramasForm(ProgramasCadastrados programas)
 {
     InitializeComponent();
     this.programaService = new ProgramaService(programas);
     this.programas       = programaService.buscarProgramas();
     foreach (Programa programa in this.programas.buscarTodos())
     {
         programasListView.Items.Add(programa.getNome());
     }
 }
예제 #2
0
 private void salvarButton_Click(object sender, EventArgs e)
 {
     try
     {
         if (editar)
         {
             programaService.editar(programa);
         }
         else
         {
             programaService.salvar(
                 new Programa(boxDeNome.Text.Trim(),
                              boxDeInstrucoes.Text.Trim(),
                              Int32.Parse(boxDePotencia.Text.Trim()),
                              Int32.Parse(boxDeTempo.Text.Trim()),
                              boxDeCaracter.Text.First()));
         }
     }catch (Exception saveE) {
         MessageBox.Show(saveE.Message);
     }
     this.Close();
     new ListaDeProgramasForm(programaService.buscarProgramas()).Show();
 }