예제 #1
0
        public SensorReading(Study study, Subject subject, Session session, Trial trial, long recordnum, TrackerInterface.Record rec)
        {
            this.study = study;
            this.subject = subject;
            this.session = session;
            this.trial = trial;
            this.time = rec.time[0];

            sensors = new Sensor[32];

            for (int i = 0; i < sensors.Length; i++)
            {
                sensors[i] = new Sensor();
                sensors[i].active = rec.active[i];
                sensors[i].x = rec.x[i];
                sensors[i].y = rec.y[i];
                sensors[i].z = rec.z[i];
                sensors[i].pitch = rec.pitch[i];
                sensors[i].yaw = rec.yaw[i];
                sensors[i].roll = rec.roll[i];
                sensors[i].time = rec.time[i];
                if (this.time == 0)
                {
                    time = rec.time[i];
                }
                sensors[i].quality = rec.quality[i];
                sensors[i].button = rec.button[i];
            }
        }
예제 #2
0
        public MainInterface()
        {
            InitializeComponent();
            database = new DatabaseControl();
            bw.WorkerSupportsCancellation = true;
            bw.WorkerReportsProgress = true;

            blankList = new List<bool>();

            //studies = database.Load();
            currentStudy = new Study();
            studyDisplay.DataSource = database.GetStudies();

            currentSubject = new Subject();
            //subjectDisplay.DataSource = currentStudy.subjects;

            currentSession = new Session();
            //sessionDisplay.DataSource = currentSubject.sessions;

            currentTrial = new Trial();
            //trialDisplay.DataSource = currentSession.trials;

            radiusSettings.SelectedIndex = 1;

            this.Refresh();
        }
예제 #3
0
 public Trial_PreMongo(string name, string time, Study study, Subject subject, Session session)
 {
     this.study = study;
     this.subject = subject;
     this.session = session;
     this.name = name;
     this.data = new ConcurrentQueue<SensorReading>();
 }
예제 #4
0
        // This function will return a list of all of the times that the sync key was hit
        public List<int> FindSyncTimes(DatabaseControl db, Study study, Subject sub, Session sess)
        {
            List<int> times = new List<int>();

            return times;
        }
예제 #5
0
 public void SetTrial(Trial trial)
 {
     this.trial = trial;
     this.session = trial.session;
     this.subject = session.subject;
     this.study = session.study;
 }
예제 #6
0
 public void UpdateSession(Session s)
 {
     session_collection.Save(s);
 }
예제 #7
0
 public void RemoveSession(Session s)
 {
     var query = Query.Or(
         Query.EQ("_id", s._Id),
         Query.EQ("session._id", s._Id)
         );
     session_collection.Remove(query);
     trial_collection.Remove(query);
     sensor_readings_collection.Remove(query);
 }
예제 #8
0
 public ObservableCollection<Trial> GetTrials(Session session)
 {
     ObservableCollection<Trial> trials = new ObservableCollection<Trial>();
     var query = Query.And(
         Query.EQ("study._id", session.study._Id),
         Query.EQ("subject._id", session.subject._Id),
         Query.EQ("session._id", session._Id)
         );
     foreach (Trial trial in trial_collection.Find(query))
     {
         trials.Add(trial);
     }
     ObservableCollection<Trial> trialsSort = new ObservableCollection<Trial>(
         trials.OrderBy(trial => trial.name)
         );
     return trials;
 }
예제 #9
0
 public int GetSessionIndex(Session session)
 {
     ObservableCollection<Session> sessions = GetSessions(session.subject);
     for (int i = 0; i < sessions.Count; i++)
     {
         Session s = sessions[i];
         if (session._Id == s._Id)
         {
             return i;
         }
     }
     return -1;
 }
예제 #10
0
 public void AddSession(Session s)
 {
     session_collection.Insert(s);
 }
예제 #11
0
        private void sessionDisplay_SelectedIndexChanged(object sender, EventArgs e)
        {
            Console.WriteLine(sessionDisplay.SelectedIndex);
            if (sessionDisplay.SelectedIndex == -1)
            {
                sessionDisplay.ClearSelected();
            }
            else
            {
                currentSession = database.GetSessions(currentSubject)[sessionDisplay.SelectedIndex];

                // Refresh the data windows
                trialDisplay.DataSource = database.GetTrials(currentSession);
                ((CurrencyManager)trialDisplay.BindingContext[trialDisplay.DataSource]).Refresh();
                trialDisplay.ClearSelected();
                //trialDisplay.DataSource = null;
                //trialDisplay.DataSource = currentSession.trials;
                //trialDisplay.ClearSelected();
            }
        }
예제 #12
0
        private void removeSession_Click(object sender, EventArgs e)
        {
            Console.WriteLine(sessionDisplay.SelectedIndex);
            if (sessionDisplay.SelectedIndex > -1)
            {
                DialogResult result = MessageBox.Show("Are you sure you want to delete this session?", "Remove Session", MessageBoxButtons.YesNo);

                if (result == DialogResult.Yes)
                {
                    currentSession = database.GetSessions(currentSubject)[sessionDisplay.SelectedIndex];
                    database.RemoveSession(currentSession);
                    currentSession = null;

                    sessionDisplay.DataSource = null;
                    sessionDisplay.DataSource = database.GetSessions(currentSubject);
                }
            }
        }
예제 #13
0
        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);
                }
            }
        }