コード例 #1
0
 public static byte GetUserID()
 {
     using (EmotivEntities db = new EmotivEntities())
     {
         db.Participants.AddObject(new Participant());
         db.SaveChanges();
         return(db.Participants.Max(p => p.UserID));
     }
 }
コード例 #2
0
 public static byte getEventType(EmotivEntities db, string eventType)
 {
     if (!db.EventTypes.Any(e => e.EventName == eventType))
     {
         db.EventTypes.AddObject(new EventType {
             EventName = eventType
         });
         db.SaveChanges();
     }
     return(db.EventTypes.First(e => e.EventName == eventType).EventTypeID);
 }
コード例 #3
0
 public static void StoreEvent(byte User, string eventType)
 {
     using (EmotivEntities db = new EmotivEntities())
     {
         db.SavedEvents.AddObject(
             new SavedEvent
         {
             UserID      = User,
             EventTypeID = getEventType(db, eventType),
             EventTime   = DateTime.Now
         });
         db.SaveChanges();
     }
 }
コード例 #4
0
 public static void StoreValue(byte User, string eventType, float?value)
 {
     using (EmotivEntities db = new EmotivEntities())
     {
         db.SavedEventValues.AddObject(
             new SavedEventValue
         {
             UserID      = User,
             EventTypeID = getEventType(db, eventType),
             EventTime   = DateTime.Now,
             Value       = value
         });
         db.SaveChanges();
     }
 }
コード例 #5
0
 public static void uploadEmotivEvent(byte User, DateTime time, Dictionary <string, float> values)
 {
     using (EmotivEntities db = new EmotivEntities())
     {
         foreach (var keyvalue in values)
         {
             db.SavedEventValues.AddObject(
                 new SavedEventValue
             {
                 UserID      = User,
                 EventTypeID = getEventType(db, keyvalue.Key),
                 EventTime   = time,
                 Value       = keyvalue.Value
             });
         }
         db.SaveChanges();
     }
 }
コード例 #6
0
 public static void uploadEmotivRaw(byte User, DateTime time, Dictionary <Emotiv.EdkDll.EE_DataChannel_t, double[]> input)
 {
     using (EmotivEntities db = new EmotivEntities())
     {
         foreach (var keyvalue in input)
         {
             foreach (double value in keyvalue.Value)
             {
                 db.SavedEventValues.AddObject(
                     new SavedEventValue
                 {
                     UserID      = User,
                     EventTypeID = getEventType(db, keyvalue.Key.ToString()),
                     EventTime   = time,
                     Value       = (float)value
                 });
             }
         }
         db.SaveChanges();
     }
 }