private void ButtonIniciar_Click(object sender, EventArgs e) { if (listViewsessoesExecutadas.Items.Count == 0) { MessageBox.Show("Por favor, selecione pelo menos uma Sessão para executar!", "Advertência"); return; } List <Sessao> sessoes = new List <Sessao>(); foreach (ListViewItem sessao in listViewsessoesExecutadas.Items) { sessoes.Add(SessaoService.GetById(long.Parse(sessao.SubItems[1].Text))); } Experimentador experimentador = CriaExperimentadorPelosCampos(); Participante participante = CriarParticipantePelosCampos(); TelaMensagem background = new TelaMensagem(""); background.BackColor = Color.White; background.Show(); new TelaExperimento(sessoes, experimentador, participante).ShowDialog(); background.Close(); }
private void ButtonSelecioarSessao_Click(object sender, EventArgs e) { if (listViewSessoes.SelectedItems.Count == 0) { MessageBox.Show("Nenhuma sessão selecionada/cadastrada!", "Advertência"); return; } long id = ViewUtils.GetIdSelecionadoInListView(listViewSessoes); Sessao sessao = SessaoService.GetById(id); textBoxNomeSessao.Text = sessao.Nome; numericAcertosConsec.Value = sessao.CriterioAcertosConcecutivos; numericDuracao.Value = sessao.CriterioDuracaoSegundos; numericNTentativas.Value = sessao.CriterioNumeroTentativas; checkBoxTentativasAgrp.Checked = !sessao.OrdemAleatoria; checkBoxTentativasRand.Checked = sessao.OrdemAleatoria; if (sessao.Instrucao != null) { textInstrucao.Text = sessao.Instrucao.Texto; } listViewCCSessao.Items.Clear(); foreach (ContingenciaColateral CC in sessao.CCs) { ListViewItem itemCC = new ListViewItem(CC.Nome); itemCC.SubItems.Add(CC.Id.ToString()); listViewCCSessao.Items.Add(itemCC); } }
private void ButtonExcluirSessao_Click(object sender, EventArgs e) { if (listViewSessoes.SelectedItems.Count == 0) { MessageBox.Show("Nenhuma sessão selecionada/cadastrada!", "Advertência"); return; } long id = ViewUtils.GetIdSelecionadoInListView(listViewSessoes); Sessao sessao = SessaoService.GetById(id); SessaoService.Deletar(sessao); listViewSessoes.Items.Remove(listViewSessoes.SelectedItems[0]); ListViewItem[] sessaoExecutada = listViewsessoesExecutadas.Items.Find(sessao.Nome, false); if (sessaoExecutada.Length != 0) { listViewsessoesExecutadas.Items.Remove(sessaoExecutada[0]); } }