コード例 #1
0
 private async Task DeleteEmployeesAsync()
 {
     await Task.Run(() =>
     {
         foreach (var employeeWrapper in EmployeeItems.ToList())
         {
             if (employeeWrapper.IsSelected)
             {
                 if (employeeWrapper != null)
                 {
                     string Name = employeeWrapper.FirstName + " " + employeeWrapper.LastName;
                     employeeWrapper.IsDeleted = true;
                     _clientService.Delete <Employee>(employeeWrapper.Model);
                     EmployeeItems.Remove(employeeWrapper);
                     _eventAggregator.GetEvent <StatusBarEvent>().Publish(Name + "was deleted");
                     Thread.Sleep(1000);
                 }
             }
         }
     });
 }
コード例 #2
0
 private async Task DeleteCustomerAsync()
 {
     await Task.Run(() =>
     {
         foreach (var customerWrapper in CustomerItems.ToList())
         {
             if (customerWrapper.IsSelected)
             {
                 if (customerWrapper != null)
                 {
                     string Name = customerWrapper.FirstName + " " + customerWrapper.LastName;
                     customerWrapper.IsDeleted = true;
                     _clientService.Delete <Customer>(customerWrapper.Model);
                     CustomerItems.Remove(customerWrapper);
                     _eventAggregator.GetEvent <StatusBarEvent>().Publish(Name + "was deleted");
                     Thread.Sleep(1000);
                 }
             }
         }
     });
 }