private async void PopulateUser() { try { var ctx = await RemoteDatabase.GetDbContextAsync(); var lstDev = ctx.GrantedUsers .Where(u => u.UserRankId > 1).ToList(); EditedUser = new UsersViewModel(); DataUser.Clear(); foreach (var dv in lstDev) { UsersViewModel uvm = new UsersViewModel() { Id = dv.GrantedUserId, Login = dv.Login, FirstName = dv.FirstName, LastName = dv.LastName, BadgeId = dv.BadgeNumber, Fingerprints = dv.Fingerprints.Count }; DataUser.Add(uvm); } ctx.Database.Connection.Close(); ctx.Dispose(); } catch (Exception error) { await mainview0.Dispatcher.BeginInvoke(new System.Action(() => { ExceptionMessageBox exp = new ExceptionMessageBox(error, "Error in Populate Device"); exp.ShowDialog(); })); } }