public void addEvent(LessonEvent ev) { if (eventlist == null) { eventlist = new List <LessonEvent>(); } eventlist.Add(ev); }
public static int AddEvent(string action, string request, string filepath, string tm) { if (curLessonEvents == null) { curLessonEvents = new LessonEvents(); curLessonEvents.lessonid = Global.getLessonID();//之前有网,上课过程中突然中断。。。 } LessonEvent ev = new LessonEvent(action, request, filepath, tm); string strEvent = ev.toJson(); LessonEventType type = (LessonEventType)ev.type; if (type == LessonEventType.Unknown) { Log.Info("Offline LessonEvent_Ignore: " + strEvent); return(0); } Log.Info("Offline LessonEvent: " + strEvent); if (type == LessonEventType.ClassOn) { if (curLessonEvents != null) { WriteFile(curLessonEvents); curLessonEvents = null; } curLessonEvents = new LessonEvents(); curLessonEvents.addEvent(ev); } else if (type == LessonEventType.ClassOff) { curLessonEvents.addEvent(ev); //TODO: 写文件 WriteFile(curLessonEvents); curLessonEvents = null; } else { curLessonEvents.addEvent(ev); } return(0); }