private void Misc_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { var args = e as TECChangedEventArgs; if (e.PropertyName == "Type") { TECMisc old = args.OldValue as TECMisc; TECMisc current = sender as TECMisc; if (old.Type == CostType.TEC) { TECCostCollection.Remove(sender as TECMisc); } else if (old.Type == CostType.Electrical) { ElectricalCostCollection.Remove(sender as TECMisc); } if (current.Type == CostType.TEC) { TECCostCollection.Add(current); } else if (current.Type == CostType.Electrical) { ElectricalCostCollection.Add(current); } } }
private void handleRemoveMisc(TECMisc misc) { misc.PropertyChanged -= Misc_PropertyChanged; if (misc.Type == CostType.TEC) { TECCostCollection.Remove(misc); } else if (misc.Type == CostType.Electrical) { ElectricalCostCollection.Remove(misc); } }