private void addTrial_Click(object sender, EventArgs e) { string value = ""; if (sessionDisplay.SelectedIndex > -1) { DialogResult result = MainInterface.InputBox("Create New Trial", "Trial Name:", ref value); if (result == DialogResult.OK) { Trial t = new Trial(value, DateTime.Now.ToString("H:mm:ss"), currentStudy, currentSubject, currentSession); database.AddTrial(t); trialDisplay.DataSource = null; trialDisplay.DataSource = database.GetTrials(currentSession); trialDisplay.ClearSelected(); trialDisplay.SetSelected(database.GetTrialIndex(t), true); } } }
private void addNewStudy_Click(object sender, EventArgs e) { string value = ""; DialogResult result = MainInterface.InputBox("New Study", "New study name:", ref value); if (result == DialogResult.OK && value != "") { currentStudy = new Study(value); database.AddStudy(currentStudy); studyDisplay.DataSource = null; studyDisplay.DataSource = database.GetStudies(); studyDisplay.ClearSelected(); Console.WriteLine(database.GetStudies()); studyDisplay.SetSelected(database.GetStudyIndex(currentStudy), true); } else if (result == DialogResult.OK) { MessageBox.Show("Invalid study name."); } }
private void addNewSession_Click(object sender, EventArgs e) { string value = ""; if (subjectDisplay.SelectedIndex > -1) { DialogResult result = MainInterface.InputBox("Create New Session", "Session Name:", ref value); if (result == DialogResult.OK) { Session s = new Session(value, DateTime.Now.ToString("M/d/yyyy"), currentStudy, currentSubject); database.AddSession(s); sessionDisplay.DataSource = null; sessionDisplay.DataSource = database.GetSessions(currentSubject); ((CurrencyManager)sessionDisplay.BindingContext[sessionDisplay.DataSource]).Refresh(); sessionDisplay.ClearSelected(); sessionDisplay.SetSelected(database.GetSessionIndex(s), true); Console.WriteLine(value); } } }