private void bgRefresh_DoWork(object sender, DoWorkEventArgs e) { RefreshParams parameters = (RefreshParams)e.Argument; RefreshResult result = new RefreshResult(); result.totalPages = Permit.GetCount(parameters.database, parameters.dateStart, parameters.dateFinish, parameters.entryPoint, parameters.defaultState); result.List = LoadPermitList(parameters.database, parameters.dateStart, parameters.dateFinish, parameters.entryPoint, parameters.defaultState, parameters.pageNumber); e.Result = result; }