コード例 #1
0
 private async Task HandleCustomerDeleted(CustomerItemRow arg)
 {
     if (ContentDialogResult.Primary == await this.messageDialog.ShowAsync())
     {
         arg.ItemDeleteClicked -= HandleCustomerDeleted;
         this.customers.Remove(arg);
         await this.customerRepository.Delete(arg.Customer);
     }
 }
コード例 #2
0
 private void populateVendors()
 {
     this.clearVendors();
     foreach (var customer in this.customerRepository.GetAllCustomers())
     {
         CustomerItemRow vendorItemRow = new CustomerItemRow
         {
             Customer = customer
         };
         vendorItemRow.ItemDeleteClicked += HandleCustomerDeleted;
         this.customers.Add(vendorItemRow);
     }
 }
コード例 #3
0
 private void HandleCellEditEnded(DataGridCellEditEndingEventArgs obj)
 {
     if (obj.EditingElement is TextBox textBox && obj.EditAction == DataGridEditAction.Commit)
     {
         string          column           = obj.Column.Tag.ToString();
         int             rowIndex         = obj.Row.GetIndex();
         CustomerItemRow existingCustomer = Customers[rowIndex];
         existingCustomer.Customer.GetType().GetProperty(column).SetValue(existingCustomer.Customer, textBox.Text);
         existingCustomer.ItemDeleteClicked -= this.HandleCustomerDeleted;
         CustomerItemRow vendorItem = new CustomerItemRow
         {
             Customer = existingCustomer.Customer
         };
         vendorItem.ItemDeleteClicked += this.HandleCustomerDeleted;
         this.Customers.RemoveAt(rowIndex);
         this.Customers.Add(vendorItem);
         this.customerRepository.Create(existingCustomer.Customer);
     }
 }