Exemplo n.º 1
0
        public void Start()
        {
            _groups = AttendanceManager.GetAttendanceGroups();
            _times  = _groups.Select(e => new AttendanceTime(e)).ToList();
            var defaultGroup = _groups.FirstOrDefault(e => e.Default);

            _userGroups   = AttendanceManager.GetUserGroups().ToDictionary(e => e.Key, e => e.Value == 0 ? defaultGroup : _groups.FirstOrDefault(g => g.ID == e.Value));
            _minBeginTime = _times.Min(e => e.AMBeginTime);
            _maxEndTime   = _times.Min(e => e.PMBeginTime);
            _worker       = new Thread(() =>
            {
                while (!_stop)
                {
                    try
                    {
                        Dowork();
                    }
                    catch (Exception ex)
                    {
                        LogWriter.Instance.WriteLog($"[{DateTime.Now}]\t{ex.Message}\r\n{ex.StackTrace}\r\n");
                    }
                }
            });
            _worker.Start();
        }