private void CreateUpdateSymbolWithPM(PersistentMessage pm, int currentStartPhase, int currentEndPhase) { // is this an update or a new symbol var foundSymbol = _phaseSymbols.FirstOrDefault(sl => sl.ItemSVM.Model.Values.ContainsKey(Message.IdPropertyName) && sl.ItemSVM.Model.Values[Message.IdPropertyName] == pm.ID); //if (foundSymbol != null && foundSymbol.Any()) if (foundSymbol != null) { // symbol is in list, do an update var ps = foundSymbol;//.ElementAt(0); ps.EndPhase = currentEndPhase; } else { // symbol is missing, ADD a new one PropertyItem first = pm.PropertyItems.FirstOrDefault(pi => pi.Key == "sic"); if (first != null) { var psvm = new PhaseSymbolViewModel { StartPhase = currentStartPhase, EndPhase = currentEndPhase, ItemSVM = SymbolLoader.Search(first.Value), VisibleTimeExtent = pm.VisibleTimeExtent }; // create SVM if (!psvm.ItemSVM.Model.Values.ContainsKey(Message.IdPropertyName)) { psvm.ItemSVM.Model.Values.Add(Message.IdPropertyName, pm.ID); } _phaseSymbols.Add(psvm); } } }
private void CreateUpdateSymbolWithPM(PersistentMessage pm, int currentStartPhase, int currentEndPhase) { // is this an update or a new symbol var foundSymbol = _phaseSymbols.FirstOrDefault(sl => sl.ItemSVM.Model.Values.ContainsKey(Message.IdPropertyName) && sl.ItemSVM.Model.Values[Message.IdPropertyName] == pm.ID); //if (foundSymbol != null && foundSymbol.Any()) if(foundSymbol != null) { // symbol is in list, do an update var ps = foundSymbol;//.ElementAt(0); ps.EndPhase = currentEndPhase; } else { // symbol is missing, ADD a new one PropertyItem first = pm.PropertyItems.FirstOrDefault(pi => pi.Key == "sic"); if (first != null) { var psvm = new PhaseSymbolViewModel { StartPhase = currentStartPhase, EndPhase = currentEndPhase, ItemSVM = SymbolLoader.Search(first.Value), VisibleTimeExtent = pm.VisibleTimeExtent }; // create SVM if (!psvm.ItemSVM.Model.Values.ContainsKey(Message.IdPropertyName)) { psvm.ItemSVM.Model.Values.Add(Message.IdPropertyName, pm.ID); } _phaseSymbols.Add(psvm); } } }