public void updateChildren(Car car, int oldCarHashCode, CarListOperations operation) { foreach (UpdateableView f in MdiChildren) { f.updateView(car, oldCarHashCode, operation); } statusStripLabel2.Text = cars.Count().ToString(); }
public void updateView(Car updatedCar, int oldCarHashCode, CarListOperations op) { ListViewItem item = null; if (op == CarListOperations.CarAdd) { item = new ListViewItem(); filteredCarsListView.Items.Add(item); } else { foreach (ListViewItem l in filteredCarsListView.Items) { if ((int)(l.Tag) == oldCarHashCode) { item = l; break; } } } if (item != null) { if (op != CarListOperations.CarRemove) { while (item.SubItems.Count < 4) { item.SubItems.Add(new ListViewItem.ListViewSubItem()); } item.SubItems[0].Text = updatedCar.Brand; item.SubItems[1].Text = updatedCar.MaxSpeed.ToString(); item.SubItems[2].Text = updatedCar.ProductionDate.ToShortDateString(); item.SubItems[3].Text = updatedCar.Type; item.Tag = updatedCar.GetHashCode(); } else { filteredCarsListView.Items.Remove(item); } } getFilteredResults(); toolStripStatusLabel2.Text = filteredCarsListView.Items.Count.ToString(); }
public void updateView(Car updatedCar, int oldCarHashCode, CarListOperations operation) { }