//TODO: review remove algorithm void removeOrderEvent(object sender, EventArgs e) { OrderEventArgs eventArgs = (OrderEventArgs)e; for (int i = 0; i < ServicedView.Items.Count; i++) { if (ServicedView.Items[i] == eventArgs.VTemplate.OrderTemplate) { ServicedView.Items.RemoveAt(i); NetworkUtil.NotifyWebService((int)eventArgs.VTemplate.ID, "SERVICED"); OrderHolder.RemoveOrderWithID(eventArgs.VTemplate.ID); this.ServicedCounter.Content = this.ServicedView.Items.Count; return; } } for (int i = 0; i < InboxView.Items.Count; i++) { if (InboxView.Items[i] == eventArgs.VTemplate.OrderTemplate) { InboxView.Items.RemoveAt(i); OrderHolder.RemoveOrderWithID(eventArgs.VTemplate.ID); this.InboxCounter.Content = this.InboxView.Items.Count; return; } } }
private void SwitchOrderTree() { if (InboxView.SelectedItem != null) { ITemplate mock1 = new DynamicVisualTemplate(); mock1.OrderTemplate = (Border)InboxView.SelectedItem; NetworkUtil.NotifyWebService((int)mock1.ID, "ACCEPTED"); OrderHolder.RemoveOrderWithID(mock1.ID); InboxView.Items.Remove(InboxView.SelectedItem); this.ServicedView.Items.Add(mock1.OrderTemplate); //TODO:Override the view control to create custom event for items.add / remove this.ServicedCounter.Content = this.ServicedView.Items.Count; this.InboxCounter.Content = this.InboxView.Items.Count; // this.InboxView.SelectedIndex = -1; } }