示例#1
0
        private void AsyncLoadSessionIds(object state)
        {
            var args = (UserSessionQueryParameters)state;

            try
            {
                using (var db = FindByUserDatabase.GetDatabase(_context))
                {
                    var sessionIds = db.FindSessions(args.User, args.Date);
                    lock (_lock)
                    {
                        _sessionIds = sessionIds;
                    }
                }
            }
            catch (Exception ex)
            {
                _context.Log.ReportException(ex, ExtentionDefinition.LogCategory, true, false);
                lock (_lock)
                {
                    _sessionIds = new HashSet <Guid>();
                }
            }

            var del = new MethodInvoker(UpdateSelectedSessions);

            Invoke(del);
        }
示例#2
0
 private void AsyncLoadUserList(object state)
 {
     try
     {
         using (var db = FindByUserDatabase.GetDatabase(_context))
         {
             ThreadSafeRefreshUsers(db.LoadUsernames(DataRetentionDays));
         }
     }
     catch (Exception ex)
     {
         _context.Log.RecordException(ex, ExtentionDefinition.LogCategory, true);
         ThreadSafeRefreshUsers(new List <string>());
         Enabled = true;
     }
 }
示例#3
0
        private void RefreshUserList()
        {
            if (!Enabled || _context == null)
            {
                return;
            }

            Enabled           = false;
            _selectedUsername = cboUser.SelectedIndex >= 0 ? cboUser.Items[cboUser.SelectedIndex].ToString() : null;
            cboUser.Items.Clear();
            cboUser.Items.Add("<All Users>");

            // Check if the database is available
            using (var db = FindByUserDatabase.GetDatabase(_context))
            {
                if (db == null || FindByUserDatabase.DatabaseUnavailable)
                {
                    ShowError = true;
                    return;
                }
            }

            ThreadPool.QueueUserWorkItem(AsyncLoadUserList, null);
        }
 public SessionScanner(ISession session, IRepositoryContext context)
 {
     _session = session;
     _db      = FindByUserDatabase.GetDatabase(context);
 }