public ProjectBehavioralTestControl(Project project, int behavioralTestIndex, ErrorProvider errorProvider) { _BehavioralTest = project.BehavioralTests[behavioralTestIndex]; InitializeComponent(); _ErrorProvider = errorProvider; lblBehavioralTest.Text = project.BehavioralTests[behavioralTestIndex].Name; }
void AddBehavioralTestControl(BehavioralTest behavioralTest, int index) { ProjectBehavioralTestControl projectBehavioralTestControl1 = new ProjectBehavioralTestControl(_project, index, errorProvider); projectBehavioralTestControl1.Anchor = AnchorStyles.Left | AnchorStyles.Right; projectBehavioralTestControl1.TabIndex = 61; projectBehavioralTestControl1.Tag = behavioralTest; flowLayoutPanel1.Controls.Add(projectBehavioralTestControl1); }
public static Project CreateDefaultFst(Researcher researcher, String name) { if (researcher == null) { Logger.logError("Invalid Researcher"); return null; } var project = new Project { Name = name }; var preTest = new BehavioralTest { Name = "preTest", BehavioralTestType = BehavioralTestType.Fst, }; project.AddBehavioralTest(preTest); var test = new BehavioralTest { Name = "test", BehavioralTestType = BehavioralTestType.Fst, }; project.AddBehavioralTest(test); Researcher.Current.AddProject(project); var preTestSession = new Session { Name = "", }; preTest.AddSession(preTestSession); var preTestTrial = new Trial { Name = "", Duration = 15 * 60, }; preTestSession.AddTrial(preTestTrial); var testSession = new Session { Name = "", }; test.AddSession(testSession); var testTrial2 = new Trial { Name = "", Duration = 5 * 60, }; testSession.AddTrial(testTrial2); Researcher.Current.Save(); return project; }
public virtual List <string> Headers() { Trial trial = run.Trial; List <string> headers = new List <string>(); BehavioralTest behavioralTest = trial.Session.BehavioralTest; headers.Add("Project"); headers.Add("SubjectID"); headers.Add("SubjectGroup"); headers.Add("Strain"); headers.Add("Sex"); headers.Add("TrialName"); headers.Add("TrialDuration"); headers.Add("DateRun"); headers.Add("TimeRun"); headers.Add("Number of Events"); // Duration foreach (Behavior behavior in behavioralTest.GetBehaviors()) { if (behavior.Type == Behavior.BehaviorType.State) { headers.Add(behavior.Name + " Duration"); } } // Frequency foreach (Behavior behavior in behavioralTest.GetBehaviors()) { headers.Add(behavior.Name + " Frequency"); } // Latency foreach (Behavior behavior in behavioralTest.GetBehaviors()) { if (behavior.Type == Behavior.BehaviorType.State) { headers.Add(behavior.Name + " Latency"); } } if (exportSettings.UseTimeBins) { if (trial.Runs.Count > 0) { ExportTimeBin exportTimeBin = new ExportTimeBin(trial.Runs[0], exportSettings, stateRunEventsInRange); headers.AddRange(exportTimeBin.headers()); } } return(headers); }
private void bNewSave_Click(object sender, EventArgs e) { if (!ValidateChildren()) { ShowInputError(); return; } EntityTemplate entityTemplate = (EntityTemplate)(cbTemplate.SelectedItem); BehavioralTest behavioralTest = EntityTemplate.GetAsBehavioralTest(entityTemplate); behavioralTest.Name = txtNewBehavioralTestName.Text; _project.AddBehavioralTest(behavioralTest); _project.Save(); _project.Refresh(); _Reload(); }
public BehavioralTestTemplateForm(EntityTemplate entityTemplate = null) { InitializeComponent(); flowLayoutPanel1.HorizontalScroll.Visible = false; List <BehavioralTestType> cbBehavioralTestTypes = new List <BehavioralTestType>(); BehavioralTestType emptyBehavioralTestType = new BehavioralTestType(); emptyBehavioralTestType.Id = -1; emptyBehavioralTestType.Name = "[Please Select]"; cbBehavioralTestTypes.Add(emptyBehavioralTestType); foreach (BehavioralTestType type in BehavioralTestType.All()) { cbBehavioralTestTypes.Add(type); } cmbBehavioralTestType.DataSource = cbBehavioralTestTypes; cmbBehavioralTestType.SelectedIndex = 0; _BehavioralTestTemplate = new BehavioralTest(); if (entityTemplate != null) { _entityTemplate = entityTemplate; txtName.Text = _entityTemplate.Name; // deserialize template and read duration txtDuration.Text = entityTemplate. BehavioralTest behavioralTest = EntityTemplate.GetAsBehavioralTest(_entityTemplate); _BehavioralTestTemplate = behavioralTest; cmbBehavioralTestType.SelectedItem = behavioralTest.BehavioralTestType; for (int index = 0; index < behavioralTest.Sessions.Count; index++) { Session session = behavioralTest.Sessions[index]; AddSessionControl(session, index); } } cmbSessionCount.SelectedItem = _BehavioralTestTemplate.Sessions.Count.ToString(); }
public BehavioralTestTemplateSessionControl(BehavioralTest behavioralTest, int sessionIndex, ErrorProvider errorProvider) { _Session = behavioralTest.Sessions[sessionIndex]; InitializeComponent(); _ErrorProvider = errorProvider; cmbTrialCount.SelectedIndex = _Session.Trials.Count; groupBox1.Text = String.Format("Session: {0}", _Session.Name); txtName.Text = _Session.Name; txtName.Enabled = (behavioralTest.Sessions.Count == 1) ? false : true; RemoveTrialControls(); for (int index = 0; index < _Session.Trials.Count; index++) { Trial trial = _Session.Trials[index]; AddTrialControl(trial, index); } }
public BehavioralTestTemplateForm(EntityTemplate entityTemplate = null) { InitializeComponent(); flowLayoutPanel1.HorizontalScroll.Visible = false; List<BehavioralTestType> cbBehavioralTestTypes = new List<BehavioralTestType>(); BehavioralTestType emptyBehavioralTestType = new BehavioralTestType(); emptyBehavioralTestType.Id = -1; emptyBehavioralTestType.Name = "[Please Select]"; cbBehavioralTestTypes.Add(emptyBehavioralTestType); foreach (BehavioralTestType type in BehavioralTestType.All()) { cbBehavioralTestTypes.Add(type); } cmbBehavioralTestType.DataSource = cbBehavioralTestTypes; cmbBehavioralTestType.SelectedIndex = 0; _BehavioralTestTemplate = new BehavioralTest(); if (entityTemplate != null) { _entityTemplate = entityTemplate; txtName.Text = _entityTemplate.Name; // deserialize template and read duration txtDuration.Text = entityTemplate. BehavioralTest behavioralTest = EntityTemplate.GetAsBehavioralTest(_entityTemplate); _BehavioralTestTemplate = behavioralTest; cmbBehavioralTestType.SelectedItem = behavioralTest.BehavioralTestType; for (int index = 0; index < behavioralTest.Sessions.Count; index++) { Session session = behavioralTest.Sessions[index]; AddSessionControl(session, index); } } cmbSessionCount.SelectedItem = _BehavioralTestTemplate.Sessions.Count.ToString(); }
static private void InsertProject() { Random rnd = new Random(); var researcher = new Researcher { Username = "******" + rnd.Next(1, 10000).ToString(), Password = "******" }; var project = new Project { Name = "my project" + rnd.Next(1, 10000).ToString() }; //var behavioralTestType = null;// NHibernateHelper.OpenSession().Get<BehavioralTestType>(1); var behavioralTest = new BehavioralTest { Name = "first test", Project = project }; project.AddBehavioralTest(behavioralTest); researcher.AddProject(project); researcher.Save(); }
public static Project CreateDefaultEpm(Researcher researcher, String name) { if (researcher == null) { Logger.logError("Invalid Researcher"); return(null); } var project = new Project { Name = name }; var test = new BehavioralTest { Name = "test", BehavioralTestType = BehavioralTestType.Epm, }; project.AddBehavioralTest(test); Researcher.Current.AddProject(project); var testSession = new Session { Name = "", }; test.AddSession(testSession); var testTrial = new Trial { Name = "", Duration = 300, }; testSession.AddTrial(testTrial); Researcher.Current.Save(); return(project); }
public void testBehaviorAndBehavioralTestSetup() { Assert.NotNull(Fixtures.Fixtures.FstSwimming); Assert.NotNull(Fixtures.Fixtures.FstClimbing); Assert.NotNull(Fixtures.Fixtures.FstFloating); Assert.NotNull(Fixtures.Fixtures.FstDiving); Assert.NotNull(Fixtures.Fixtures.FstHeadSwinging); Assert.NotNull(Fixtures.Fixtures.OrObjectA); Assert.NotNull(Fixtures.Fixtures.OrObjectB); Assert.NotNull(Fixtures.Fixtures.OrGeneralArea); BehavioralTest fstTest = Fixtures.Fixtures.fstLightTest; Trial trial = fstTest.Sessions[0].Trials[0]; Subject subject = Researcher.Current.ActiveProject.Subjects[1]; Assert.AreEqual(fstTest.BehavioralTestType, BehavioralTestType.Fst); Assert.AreEqual("T1", trial.Name); Assert.AreEqual("2", subject.Code); Assert.AreEqual(2, trial.Runs.Count); Assert.AreEqual(0, trial.CompleteRunCount); }
private void _Reload() { if (_project != null) { RemoveBehavioralTestControls(); for (int index = 0; index < _project.BehavioralTests.Count; index++) { BehavioralTest behavioralTest = _project.BehavioralTests[index]; AddBehavioralTestControl(behavioralTest, index); } } lBehavioralTests.Text = _project.BehavioralTests.Count > 0 ? "Existing Behavioral Tests" : "No Behavioral Tests"; int height = 180 + _project.BehavioralTests.Count * 70; this.Size = new System.Drawing.Size(400, height); this.Text = String.Format("Project: {0}", _project); List <EntityTemplate> cbEntityTemplates = new List <EntityTemplate>(); EntityTemplate emptyEntityTemplate = new EntityTemplate(); emptyEntityTemplate.Id = -1; emptyEntityTemplate.Name = "[Please Select]"; cbEntityTemplates.Add(emptyEntityTemplate); foreach (EntityTemplate entityTemplate in EntityTemplate.All()) { cbEntityTemplates.Add(entityTemplate); } cbTemplate.DataSource = cbEntityTemplates; cbTemplate.SelectedIndex = 0; txtNewBehavioralTestName.Text = ""; pAddNew.Visible = false; pAddNew.Enabled = false; lnkAddBehavioralTest.Visible = true; }
static private void InsertProject() { Random rnd = new Random(); var researcher = new Researcher { Username = "******" + rnd.Next(1, 10000).ToString(), Password = "******" }; var project = new Project { Name = "my project" + rnd.Next(1, 10000).ToString() }; var behavioralTestType = NHibernateHelper.OpenSession().Get <BehavioralTestType>(1); var behavioralTest = new BehavioralTest { Name = "first test", Project = project, BehavioralTestType = behavioralTestType }; project.AddBehavioralTest(behavioralTest); researcher.AddProject(project); researcher.Save(); System.Console.WriteLine("inserted new researcher with project!"); FindResearcherById((int)researcher.Id); }
private static void SerializeTest(string[] args) { BehavioralTest test = new BehavioralTest(); System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.XmlSerializer(test.GetType()); FileStream stream; if (args.Length >= 2 && args[1] == "u") { stream = new FileStream("a.xml", FileMode.Open); test = (BehavioralTest)x.Deserialize(stream); foreach (Session s in test.SessionsForSerialization) { test.Sessions.Add(s); foreach (Trial t in s.TrialsForSerialization) { s.Trials.Add(t); } } stream.Close(); return; } Project project = new Project(); test.BehavioralTestType = BehavioralTestType.Fst; Session session = new Session(); Trial trial = new Trial(); trial.Duration = 360; session.TrialsForSerialization.Add(trial); test.SessionsForSerialization.Add(session); stream = new FileStream("a.xml", FileMode.Create); x.Serialize(stream, test); stream.Close(); }
private static Project createLightFstProject() { Project project = new Project(); Researcher.Current.ActiveProject = project; //needed due to trial.populateWithRuns dependency on ActiveProject project.Name = "UnitTest Project"; Subject subject = new Subject(); subject.Code = "1"; project.AddSubject(subject); Subject subject2 = new Subject(); subject2.Code = "2"; project.AddSubject(subject2); project.Save(); fstLightTest = new BehavioralTest(); Session fstLightSession = new Session(); fstLightTrial = new Trial(); fstLightTrial.Duration = 15; fstLightTrial.Name = "T1"; fstLightTrial.PopulateWithRuns(); fstLightSession.Name = "S1"; fstLightSession.AddTrial(fstLightTrial); fstLightTest.Name = "FST light"; fstLightTest.BehavioralTestType = BehavioralTestType.Fst; fstLightTest.AddSession(fstLightSession); project.AddBehavioralTest(fstLightTest); fstTest = new BehavioralTest(); Session session = new Session(); fstTrial = new Trial(); fstTrial.Duration = 300; fstTrial.Name = "T1"; fstTrial.PopulateWithRuns(); session.Name = "S1"; session.AddTrial(fstTrial); fstTest.Name = "FST Regular"; fstTest.BehavioralTestType = BehavioralTestType.Fst; fstTest.AddSession(session); project.AddBehavioralTest(fstTest); orTest = new BehavioralTest(); Session orSession = new Session(); orTrial = new Trial(); orTrial.Duration = 100; orTrial.Name = "T1"; orTrial.PopulateWithRuns(); orSession.Name = "S1"; orSession.AddTrial(orTrial); orTest.Name = "Object Recognition"; orTest.BehavioralTestType = BehavioralTestType.ObjectRecognition; orTest.AddSession(orSession); project.AddBehavioralTest(orTest); project.Save(); return(project); }
private static void InsertProject() { Random rnd = new Random(); var researcher = new Researcher { Username = "******" + rnd.Next(1, 10000).ToString(), Password = "******" }; var project = new Project { Name = "my project" + rnd.Next(1, 10000).ToString() }; var behavioralTestType = NHibernateHelper.OpenSession().Get<BehavioralTestType>(1); var behavioralTest = new BehavioralTest { Name = "first test", Project = project, BehavioralTestType = behavioralTestType}; project.AddBehavioralTest(behavioralTest); researcher.AddProject(project); researcher.Save(); System.Console.WriteLine("inserted new researcher with project!"); FindResearcherById((int)researcher.Id); }
private static void InsertProject() { Random rnd = new Random(); var researcher = new Researcher { Username = "******" + rnd.Next(1, 10000).ToString(), Password = "******" }; var project = new Project { Name = "my project" + rnd.Next(1, 10000).ToString() }; //var behavioralTestType = null;// NHibernateHelper.OpenSession().Get<BehavioralTestType>(1); var behavioralTest = new BehavioralTest { Name = "first test", Project = project }; project.AddBehavioralTest(behavioralTest); researcher.AddProject(project); researcher.Save(); }
public static Project CreateDefaultObjectRecognition(Researcher researcher, String name) { if (researcher == null) { Logger.logError("Invalid Researcher"); return null; } var project = new Project { Name = name }; var test = new BehavioralTest { Name = "Test1", BehavioralTestType = BehavioralTestType.ObjectRecognition, }; project.AddBehavioralTest(test); Researcher.Current.AddProject(project); var testSession = new Session { Name = "S1", }; test.AddSession(testSession); var testTrial = new Trial { Name = "T1", Duration = 300, }; testSession.AddTrial(testTrial); testTrial = new Trial { Name = "T2", Duration = 300, }; testSession.AddTrial(testTrial); testTrial = new Trial { Name = "T3", Duration = 300, }; testSession.AddTrial(testTrial); testSession = new Session { Name = "S2", }; test.AddSession(testSession); testTrial = new Trial { Name = "T1", Duration = 300, }; testSession.AddTrial(testTrial); testTrial = new Trial { Name = "T2", Duration = 300, }; testSession.AddTrial(testTrial); testTrial = new Trial { Name = "T3", Duration = 300, }; testSession.AddTrial(testTrial); Researcher.Current.Save(); return project; }