Пример #1
0
        // 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);
        }
Пример #2
0
 public void AddCustomer(Customer customer)
 {
     Clients.All.RefreshData(customer);
 }
Пример #3
0
        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);
        }
Пример #4
0
 private void RefreshData(Customer customer)
 {
     lvwCustomer.Invoke(new MethodInvoker(() => FillToListView(customer)));
 }