// method untuk menampilkan data customer ke listview private void FillToListView(Customer customer) { int noUrut = lvwCustomer.Items.Count + 1; ListViewItem item = new ListViewItem(noUrut.ToString()); item.SubItems.Add(customer.CustomerId); item.SubItems.Add(customer.CompanyName); item.SubItems.Add(customer.ContactName); lvwCustomer.Items.Add(item); }
public void AddCustomer(Customer customer) { Clients.All.RefreshData(customer); }
private void btnSave_Click(object sender, EventArgs e) { var customer = new Customer { CustomerId = txtCustomerId.Text, CompanyName = txtCompanyName.Text, ContactName = txtContactName.Text }; // panggil method server hubProxy.Invoke("AddCustomer", customer); }
private void RefreshData(Customer customer) { lvwCustomer.Invoke(new MethodInvoker(() => FillToListView(customer))); }