private void ElementMappings_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) { ElementMapping = _map.GetBySourceId(ElementNodeProxy.Id); if (ElementMapping != null) { _map.ElementMappings.CollectionChanged -= ElementMappings_CollectionChanged; } }
private void MapSequence(ISequence sequence, ElementMap elementMap) { List <EffectNode> effectsToRemove = new List <EffectNode>(); foreach (var unmappedEffect in sequence.SequenceData.EffectData.Cast <EffectNode>()) { if (elementMap.GetBySourceId(unmappedEffect.Effect.TargetNodes.First().Id, out Guid targetId)) { var node = VixenSystem.Nodes.GetElementNode(targetId); if (node != null) { unmappedEffect.Effect.TargetNodes = new[] { node }; } else { effectsToRemove.Add(unmappedEffect); } } else { effectsToRemove.Add(unmappedEffect); } } sequence.SequenceData.EffectData.RemoveRangeData(effectsToRemove); }
public ElementNodeProxyViewModel(ElementNodeProxy proxy, IElementMapService elementMapService) { _elementMapService = elementMapService; ElementNodeProxy = proxy; _map = elementMapService.ElementMap; ElementMapping = _map.GetBySourceId(proxy.Id); elementMapService.RegisterMapMessages(this, OnElementMapChanged); if (ElementMapping == null) { _elementMapService.ElementMap.ElementMappings.CollectionChanged += ElementMappings_CollectionChanged; } }