Пример #1
0
 public AreaVisitEvent(DeviceLabelEvent _labelEvent,  Area _area, LastAreaAccess _areaAccess, int _nTimeDelay)
 {
     device = _labelEvent.device;
     label = _labelEvent.label;
     signal = _labelEvent.signal;
     area = _area;
     areaAccess = _areaAccess;
     timeDelay = _nTimeDelay;
 }
Пример #2
0
 private void _deviceModule_WorkerDeviceLabelEvent(object _sender, DeviceLabelEvent _e)
 {
     Area area = findArea(_e.label.areaId);
     if (area == null)
     {
         System.Diagnostics.Debug.Write("\n Device found label from unknown area: label id" + _e.label.labelId + ", labelData: " + _e.label.labelData + ", areaId: " + _e.label.areaId);
         return;
     }
     TimeSpan span = DateTime.Now.Subtract(new DateTime(1970, 1, 1, 0, 0, 0));
     int nTimeNow = (int)span.TotalSeconds;
     LastAreaAccess areaAccess = findOrCreateLastAreaAccess(area, _e.device);
     int nAccessDelay = nTimeNow - areaAccess.accessTime;
     areaAccess.accessTime = nTimeNow;
     db.SaveChanges();
     AreaVisitEventHandler(this, new AreaVisitEvent(_e, area, areaAccess, nAccessDelay));
 }