Пример #1
0
        private void OnModelChanged(object sender, ModelChangedEventArgs args)
        {
            if (Decision == null)
            {
                return;
            }
            switch (args.Type)
            {
            case ModelChangedType.RemovedElement:
                OnModelChangeElementRemoved(args);
                break;

            case ModelChangedType.ModifiedElement:
                OnModelChangeElementModified(args);
                break;

            case ModelChangedType.RemovedConnector:
                OnModelChangeConnectorRemoved(args);
                break;

            case ModelChangedType.NewConnector:
                OnModelChangeConnectorAdded(args);
                break;
            }
        }
Пример #2
0
        void ISuperGraphRelationshipFactory.DeleteTranscludedNode(List <Node> nodes, INode map, bool isQuiet)
        {
            foreach (var node in nodes)
            {
                var deleteTranscludedNodesOperation = new DeleteTranscludedNodeOperation(MapManager);
                deleteTranscludedNodesOperation.Context      = map.Proxy;
                deleteTranscludedNodesOperation.Node         = node.Proxy;
                deleteTranscludedNodesOperation.ViewModeNode = node;
                deleteTranscludedNodesOperation.ExecuteOperation();
                if (!isQuiet)
                {
                    var modelChangedEventArgs = new ModelChangedEventArgs <Node, Relationship>();
                    modelChangedEventArgs.Nodes.Add(new KeyValuePair <Node, ModelOperationType>(node, ModelOperationType.Deleted));

                    foreach (Proxy.IRelationship modelRelationship in deleteTranscludedNodesOperation.Response.Relationships)
                    {
                        var viewModelRelationship = new Relationship();
                        viewModelRelationship.LoadRelationship(modelRelationship);

                        modelChangedEventArgs.Relationships.Add(new KeyValuePair <Relationship, ModelOperationType>(viewModelRelationship, ModelOperationType.Deleted));
                    }
                    ModelChanged(this, modelChangedEventArgs);
                }
            }
        }
Пример #3
0
 private void OnModelChangeElementModified(ModelChangedEventArgs args)
 {
     if (Decision.HasTopic() && args.GUID.Equals(Decision.Topic.GUID))
     {
         Decision.Topic.DiscardChanges();
     }
 }
 protected override void OnModelRepositoryChanged(ModelChangedEventArgs obj)
 {
     if ((obj.ChangeType == ChangeType.Add || obj.ChangeType == ChangeType.Remove) && obj.Entity.GetType().Assembly == typeof(SystemInfoViewModel).Assembly)
     {
         _timer.Enabled = true;
     }
 }
Пример #5
0
        void ISuperGraphRelationshipFactory.ConnectMultipleTranscludedNodes(List <Relationship> relationships, List <Node> fullNodes, INode map)
        {
            if (relationships.Any())
            {
                var modelChangedEventArgs        = new ModelChangedEventArgs <Node, Relationship>();
                var batchTransclusionConnections = new BatchConnectTranscludedNodesOperation(MapManager);
                foreach (var viewModelRelationship in relationships)
                {
                    var from = fullNodes.FirstOrDefault(q => q.Id == viewModelRelationship.From);
                    var to   = fullNodes.FirstOrDefault(q => q.Id == viewModelRelationship.To);

                    if (from != null && to != null)
                    {
                        var operation = new ConnectTranscludedNodesOperation(MapManager);
                        operation.Context = Context.Proxy;
                        operation.From    = from.Proxy;
                        operation.To      = to.Proxy;

                        batchTransclusionConnections.AddConnectTranscludedNodesOperation(operation);
                    }

                    if (viewModelRelationship.Proxy.RelationshipType != viewModelRelationship.Proxy.MapManager.RelationshipTypes["MapContainerRelationship"])
                    {
                        modelChangedEventArgs.Relationships.Add(new KeyValuePair <Relationship, ModelOperationType>(viewModelRelationship, ModelOperationType.New));
                    }
                }
                batchTransclusionConnections.ExecuteOperation();
                ModelChanged(this, modelChangedEventArgs);
            }
        }
Пример #6
0
        private void OnModelChangeConnectorAdded(ModelChangedEventArgs args)
        {
            IEAConnector connector = EAMain.Repository.GetConnectorByGUID(args.GUID);

            if (connector.ClientId != Decision.ID && connector.SupplierId != Decision.ID)
            {
                return;
            }
            if (EAMain.IsDecisionRelationship(connector))
            {
                var related = new DecisionRelation(Decision, connector);
                if (EAMain.IsAlternativeRelationship(connector))
                {
                    Decision.Alternatives.Add(related);
                }
                else
                {
                    Decision.RelatedDecisions.Add(related);
                }
            }
            else if (EAMain.IsTrace(connector))
            {
                Decision.Traces.Add(new TraceLink(Decision, connector));
            }
            else if (EAMain.IsStakeholderAction(connector))
            {
                Decision.Stakeholders.Add(new StakeholderAction(Decision, connector));
            }
        }
Пример #7
0
 protected virtual void OnModelChanged(object sender, ModelChangedEventArgs e)
 {
     if (ModelChangedEvent != null)
     {
         ModelChangedEvent(this, e);
     }
 }
 protected override void OnModelRepositoryChanged(ModelChangedEventArgs obj)
 {
     if (obj.Source is ScraperConfigurationModel)
     {
         UpdateScraperConfigs();
         SendUpdate(_model);
     }
 }
Пример #9
0
 protected override void OnModelRepositoryChanged(ModelChangedEventArgs obj)
 {
     // TODO handle in debtmodel
     if (obj.Source is PaymentModel && obj.PropertyName == nameof(PaymentModel.DebtId))
     {
         _collection.Dispose();
         Init();
     }
 }
Пример #10
0
        // implement IChangeDataValue for undo/redo
        public void ChangeDataValue(ModelChangedEventArgs e, bool undo)
        {
            switch (e.PropertyName)
            {
            case "Color": this.Color = (String)e.GetValue(undo); break;

            default: throw new NotImplementedException("Socket change: " + e.ToString());
            }
        }
Пример #11
0
        void ISuperGraphNodeFactory.DeleteNode(Node viewModelNode)
        {
            var deleteNodeOperation = new DeleteNodeOperation(viewModelNode, MapManager);

            deleteNodeOperation.ExecuteOperation();
            var modelChangedEventArgs = new ModelChangedEventArgs <Node, Relationship>();

            modelChangedEventArgs.Nodes.Add(new KeyValuePair <Node, ModelOperationType>(viewModelNode, ModelOperationType.Deleted));
            ModelChanged(this, modelChangedEventArgs);
        }
Пример #12
0
        void ISuperGraphRelationshipFactory.DeleteRelationship(Relationship viewModelRelationship)
        {
            var deleteRelationshipOperation = new DeleteRelationshipOperation(MapManager);

            deleteRelationshipOperation.ViewModeRelationship = viewModelRelationship;
            var modelChangedEventArgs = new ModelChangedEventArgs <Node, Relationship>();

            modelChangedEventArgs.Relationships.Add(new KeyValuePair <Relationship, ModelOperationType>(viewModelRelationship, ModelOperationType.Deleted));
            ModelChanged(this, modelChangedEventArgs);
            deleteRelationshipOperation.ExecuteOperation();
        }
Пример #13
0
        private void CloneNodeCompleted(object sender, NodeOperationCompletedArgs e)
        {
            var response = e.Response;
            var modelChangedEventArgs = new ModelChangedEventArgs <Node, Relationship>();

            foreach (Proxy.INode modelNode in response.Nodes)
            {
                modelChangedEventArgs.Nodes.Add(new KeyValuePair <Node, ModelOperationType>(new Node(modelNode), ModelOperationType.Clone));
            }
            ModelChanged(this, modelChangedEventArgs);
        }
Пример #14
0
        private void OnModelChanged(object sender, ModelChangedEventArgs e)
        {
            ModelItem root = this.ModelService.Root;

            if (root == this._root)
            {
                return;
            }
            this._root = root;
            this.PopulateDataChildren();
        }
Пример #15
0
            private void handler(ModelChangedEventArgs obj)
            {
                switch (obj.ChangeType)
                {
                case ChangeType.Add:
                    items.Add(obj.Source);
                    break;

                case ChangeType.Remove:
                    items.Remove(obj.Source);
                    break;
                }
            }
Пример #16
0
        private void ModelService_ModelChanged(object sender, ModelChangedEventArgs e)
        {
            IsDirty = true;
            try
            {
                if (e.ModelChangeInfo != null && e.ModelChangeInfo.Value != null && e.ModelChangeInfo.OldValue == null && e.ModelChangeInfo.ModelChangeType != ModelChangeType.CollectionItemRemoved)
                {
                    //新增activity
                    var currentItem = e.ModelChangeInfo.Value;
                    if (currentItem.ItemType.Name == "FlowStep")
                    {
                        //flowchart设计器拖动时要特殊处理
                        currentItem = e.ModelChangeInfo.Value.Content.Value;
                    }
                    else
                    {
                    }

                    //var assemblyQualifiedName = currentItem.ItemType.AssemblyQualifiedName;//Switch<T>的类型需要特殊判断
                    var assemblyQualifiedName = currentItem.ItemType.Namespace + "." + currentItem.ItemType.Name + "," + currentItem.ItemType.Assembly;
                    assemblyQualifiedName = assemblyQualifiedName.Replace(" ", "");

                    if (!ViewModelLocator.Instance.Activities.ActivityTreeItemAssemblyQualifiedNameDic.ContainsKey(assemblyQualifiedName))
                    {
                        assemblyQualifiedName = currentItem.ItemType.AssemblyQualifiedName;
                        assemblyQualifiedName = assemblyQualifiedName.Replace(" ", "");
                    }

                    if (ViewModelLocator.Instance.Activities.ActivityTreeItemAssemblyQualifiedNameDic.ContainsKey(assemblyQualifiedName))
                    {
                        var item = ViewModelLocator.Instance.Activities.ActivityTreeItemAssemblyQualifiedNameDic[assemblyQualifiedName];
                        Messenger.Default.Send(item, "AddToRecent");

                        if (currentItem.View == null && !item.IsSystem)
                        {
                            currentItem.Properties["DisplayName"].SetValue(item.Name);
                        }
                    }
                }
            }
            catch (Exception err)
            {
                Logger.Warn(err, logger);
            }

            DoSourceCodeConnect();

            System.GC.Collect();//提醒系统回收内存,避免内存占用过高
        }
Пример #17
0
        protected void RaisePropertyChanged(String pname, Object oldval, Object newval)
        {
            ModelChangedEventArgs e = new ModelChangedEventArgs(pname, this, oldval, newval);

            // implement INotifyPropertyChanged:
            if (this.PropertyChanged != null)
            {
                this.PropertyChanged(this, e);
            }
            // implement support for model and undo/redo:
            if (this.Unit != null)
            {
                this.Unit.OnPropertyChanged(e);
            }
        }
Пример #18
0
 override public void ChangeDataValue(ModelChangedEventArgs e, bool undo)
 {
     if (e == null)
     {
         return;
     }
     if (e.PropertyName == "IsDynamic")
     {
         this.IsDynamic = (bool)e.GetValue(undo);
     }
     else
     {
         base.ChangeDataValue(e, undo);
     }
 }
        private void Handler(ModelChangedEventArgs obj)
        {
            if (obj.Source is T model)
            {
                if (obj.ChangeType == ChangeType.Add)
                {
                    Add(model);
                }

                if (obj.ChangeType == ChangeType.Remove)
                {
                    Remove(model);
                }
            }
        }
Пример #20
0
        void ISuperGraphNodeFactory.UpdateNode(Node viewModelNode, ChangeNodeTypeEnum changedTo)
        {
            var updateNodeType = new UpdateNodeTypeOperation(MapManager);

            updateNodeType.Context   = Context.Proxy;
            updateNodeType.Node      = viewModelNode;
            updateNodeType.ChangedTo = changedTo;

            updateNodeType.ExecuteOperation();
            updateNodeType.OperationCompleted += UpdateNodeTypeOnOperationCompleted;
            ThemeManager.DressNode(updateNodeType.Node);
            var modelChangedEventArgs = new ModelChangedEventArgs <Node, Relationship>();

            modelChangedEventArgs.Nodes.Add(new KeyValuePair <Node, ModelOperationType>(updateNodeType.Node, ModelOperationType.Modified));
            ModelChanged(this, modelChangedEventArgs);
        }
Пример #21
0
 private void OnModelChangeElementRemoved(ModelChangedEventArgs args)
 {
     if (args.GUID.Equals(Decision.GUID))
     {
         DetailViewHandler.Instance.CloseDecisionDetailView(Decision);
     }
     if (Decision.Topic != null && args.GUID.Equals(Decision.Topic.GUID))
     {
         //topic has been removed.
         txtTopicName.DataBindings.Clear();
         rtbTopicDescription.DataBindings.Clear();
         txtTopicName.Name            = "";
         rtbTopicDescription.RichText = "";
         DisableTopicGroupBox();
     }
 }
Пример #22
0
 private void ObservedPanel_AnimatingChanged(object sender, ModelChangedEventArgs e)
 {
     if (sender is DiagramPanel)
     {
         this.IsAnimatingScrolling = (bool)e.NewValue;
         UpdateBox();
     }
     else if (sender is LayoutManager)
     {
         this.IsAnimatingLayout = (bool)e.NewValue;
         // UpdateNodesAndLinks when no longer IsAnimating
         if (!this.IsAnimatingLayout)
         {
             UpdateNodesAndLinks();
         }
     }
 }
Пример #23
0
        void ISuperGraphRelationshipFactory.ConnectNodes(Node from, Node to)
        {
            var connectNodesOperation = new ConnectNodesOperation(MapManager);

            connectNodesOperation.From = from.Proxy;
            connectNodesOperation.To   = to.Proxy;
            connectNodesOperation.ExecuteOperation();
            var modelChangedEventArgs = new ModelChangedEventArgs <Node, Relationship>();

            foreach (Proxy.IRelationship modelRelationship in connectNodesOperation.Response.Relationships)
            {
                var viewModelRelationship = new Relationship();
                viewModelRelationship.LoadRelationship(modelRelationship);
                modelChangedEventArgs.Relationships.Add(new KeyValuePair <Relationship, ModelOperationType>(viewModelRelationship, ModelOperationType.New));
            }
            ModelChanged(this, modelChangedEventArgs);
        }
Пример #24
0
        void ISuperGraphNodeFactory.CloneNodes(IEnumerable <Node> nodes, IEnumerable <Relationship> relationships)
        {
            var cloneNodeOperation = new BatchCloneNodesOperation(MapManager, Context.Proxy, nodes, relationships);

            cloneNodeOperation.OperationCompleted += CloneNodeCompleted;
            cloneNodeOperation.ExecuteOperation();
            AddClonedNodes(cloneNodeOperation.Response);
            var modelChangedEventArgs = new ModelChangedEventArgs <Node, Relationship>();

            foreach (Proxy.IRelationship modelRelationship in cloneNodeOperation.Response.Relationships)
            {
                var viewModelRelationship = new Relationship();
                viewModelRelationship.LoadRelationship(modelRelationship);
                modelChangedEventArgs.Relationships.Add(new KeyValuePair <Relationship, ModelOperationType>(viewModelRelationship, ModelOperationType.New));
            }
            ModelChanged(this, modelChangedEventArgs);
        }
Пример #25
0
        void ISuperGraphRelationshipFactory.DeleteRelationships(IEnumerable <Relationship> relationships)
        {
            var enumerable = relationships as IList <Relationship> ?? relationships.ToList();

            if (enumerable.Any())
            {
                var deleteRelationshipsOperation = new DeleteRelationships(MapManager);
                var modelChangedEventArgs        = new ModelChangedEventArgs <Node, Relationship>();
                foreach (var relationship in enumerable)
                {
                    deleteRelationshipsOperation.Relationships.Add(new KeyValuePair <Relationship, ModelOperationType>(relationship, ModelOperationType.Deleted));
                    modelChangedEventArgs.Relationships.Add(new KeyValuePair <Relationship, ModelOperationType>(relationship, ModelOperationType.Deleted));
                }
                ModelChanged(this, modelChangedEventArgs);
                deleteRelationshipsOperation.ExecuteOperation();
            }
        }
Пример #26
0
        private void OnModelChangeConnectorRemoved(ModelChangedEventArgs args)
        {
            IEAConnector connector = EAMain.Repository.GetConnectorByGUID(args.GUID);

            if (EAMain.IsDecisionRelationship(connector))
            {
                foreach (IDecisionRelation related in Decision.RelatedDecisions.ToArray())
                {
                    if (related.RelationGUID.Equals(args.GUID))
                    {
                        Decision.RelatedDecisions.Remove(related);
                        return;
                    }
                }
                foreach (IDecisionRelation related in Decision.Alternatives.ToArray())
                {
                    if (related.RelationGUID.Equals(args.GUID))
                    {
                        Decision.Alternatives.Remove(related);
                        return;
                    }
                }
            }
            else if (EAMain.IsTrace(connector))
            {
                foreach (ITraceLink trace in Decision.Traces.ToArray())
                {
                    if (trace.ConnectorGUID.Equals(args.GUID))
                    {
                        Decision.Traces.Remove(trace);
                        return;
                    }
                }
            }
            else if (EAMain.IsStakeholderAction(connector))
            {
                foreach (IStakeholderAction action in Decision.Stakeholders.ToArray())
                {
                    if (action.ConnectorGUID.Equals(args.GUID))
                    {
                        Decision.Stakeholders.Remove(action);
                        return;
                    }
                }
            }
        }
Пример #27
0
        void ISuperGraphRelationshipFactory.TranscludeNodes(List <Node> nodes, INode map, Point location, Point?oldLocation = null)
        {
            if (nodes.Any())
            {
                var modelChangedEventArgs = new ModelChangedEventArgs <Node, Relationship>();
                var batchTransclusions    = new BatchTranscludeNodesOperation(MapManager);
                foreach (var node in nodes)
                {
                    var newOperation = new TranscludeNodesOperation(MapManager);
                    newOperation.NewMap        = Context.Proxy;
                    newOperation.OriginalMap   = map.Proxy;
                    newOperation.ViewModelNode = node;
                    var oldRelativeLocation = oldLocation != null
                        ? node.Location.Subtract(oldLocation.Value)
                        : node.Location;

                    newOperation.Location = oldRelativeLocation.Add(location);
                    node.IsTranscluded    = true;
                    node.NumTranclusions++;
                    batchTransclusions.AddTranscludeNodeOperation(newOperation);

                    var newNodeViewModel = new Node(node);
                    newNodeViewModel.Location = newOperation.Location;
                    newNodeViewModel.CommitLocation();

                    newNodeViewModel.PropertyChanged += ViewModelNode_PropertyChanged;

                    batchTransclusions.Nodes.Add(new KeyValuePair <Node, ModelOperationType>(newNodeViewModel, ModelOperationType.New));
                }
                batchTransclusions.ExecuteOperation();


                modelChangedEventArgs.Nodes = batchTransclusions.Nodes;
                foreach (Proxy.IRelationship modelRelationship in batchTransclusions.Response.Relationships)
                {
                    if (modelRelationship.RelationshipType != modelRelationship.MapManager.RelationshipTypes["MapContainerRelationship"])
                    {
                        var viewModelRelationship = new Relationship();
                        viewModelRelationship.LoadRelationship(modelRelationship);
                        modelChangedEventArgs.Relationships.Add(new KeyValuePair <Relationship, ModelOperationType>(viewModelRelationship, ModelOperationType.New));
                    }
                }
                ModelChanged(this, modelChangedEventArgs);
            }
        }
Пример #28
0
        // Property change for undo/redo:
        // We treat adding and removing socket as property changes, and
        // there are settable properties of Socket for each socket to handle.
        public override void ChangeDataValue(ModelChangedEventArgs e, bool undo)
        {
            // Data might be either a Unit or a Socket
            Socket sock = e.Data as Socket;

            if (sock != null)
            {  // if it's a Socket, let it handle undo/redo changes
                sock.ChangeDataValue(e, undo);
            }
            else
            {
                // assume we're dealing with a change to this Unit
                switch (e.PropertyName)
                {
                case "AddedSocket":
                    sock = e.OldValue as Socket;
                    if (undo)
                    {
                        RemoveSocket(sock);
                    }
                    else
                    {
                        InsertSocket(sock);
                    }
                    break;

                case "RemovedSocket":
                    sock = e.OldValue as Socket;
                    if (undo)
                    {
                        InsertSocket(sock);
                    }
                    else
                    {
                        RemoveSocket(sock);
                    }
                    break;

                // if you add undo-able properties to Unit, handle them here
                default:
                    base.ChangeDataValue(e, undo);
                    break;
                }
            }
        }
Пример #29
0
        public virtual void OnModelChanged(object sender, ModelChangedEventArgs e)
        {
            if (sender.Equals(Model))
            {
                if (e.Type == ModelChangedEventArgs.EventType.Update && e.Properties != null)
                {
                    foreach (string property in e.Properties)
                    {
                        RaisePropertyChanged(property);
                    }
                }

                else if (e.Type == ModelChangedEventArgs.EventType.Delete)
                {
                    Dispose();
                }
            }
        }
Пример #30
0
        void ISuperGraphRelationshipFactory.DeleteNodes(List <Node> nodes, INode map, bool isSameMap)
        {
            if (nodes.Any())
            {
                var batchTransclusionDeletions = new BatchDeleteNodesOperation(MapManager);

                foreach (var node in nodes)
                {
                    batchTransclusionDeletions.Nodes.Add(new KeyValuePair <Node, ModelOperationType>(node, ModelOperationType.Deleted));

                    if (node.IsTranscluded && node.NumTranclusions > 1)
                    {
                        var deleteTranscludedNodesOperation = new DeleteTranscludedNodeOperation(MapManager);
                        deleteTranscludedNodesOperation.Context = map.Proxy;
                        deleteTranscludedNodesOperation.Node    = node.Proxy;

                        batchTransclusionDeletions.AddDeleteNodeOperation(deleteTranscludedNodesOperation);
                    }
                    else
                    {
                        var deleteNodesOperation = new DeleteNodeOperation(node, MapManager);

                        batchTransclusionDeletions.AddDeleteNodeOperation(deleteNodesOperation);
                    }
                }

                batchTransclusionDeletions.ExecuteOperation();
                if (isSameMap)
                {
                    var modelChangedEventArgs = new ModelChangedEventArgs <Node, Relationship>();
                    var response = batchTransclusionDeletions.Response;
                    modelChangedEventArgs.Nodes = batchTransclusionDeletions.Nodes;
                    foreach (Proxy.IRelationship modelRelationship in response.Relationships)
                    {
                        var viewModelRelationship = new Relationship();
                        viewModelRelationship.LoadRelationship(modelRelationship);

                        modelChangedEventArgs.Relationships.Add(new KeyValuePair <Relationship, ModelOperationType>(viewModelRelationship, ModelOperationType.Deleted));
                    }
                    ModelChanged(this, modelChangedEventArgs);
                }
            }
        }
Пример #31
0
        public void ModelChanged(object sender, ModelChangedEventArgs<Node, Relationship> e)
        {
            NodeControl focusedNode = null;
            var controller = sender as SuperGraphController;

            if (controller != null)
            {
                Context = controller.Context;
            }
            /// TODO: Need to refactor the following to be self-contained.
            foreach (KeyValuePair<Node, ModelOperationType> viewModelNodeOperation in e.Nodes)
            {
                if (viewModelNodeOperation.Value == ModelOperationType.New ||
                    viewModelNodeOperation.Value == ModelOperationType.Clone)
                {
                    var viewModelNode = viewModelNodeOperation.Key;
                    var nodeControl = NodeFactory.CreateNode(viewModelNode, this);
                    if (nodeControl != null && !NodeContainer.Children.Contains(nodeControl))
                    {
                        nodeControl.RenderTransform = MoveGraphTransform;
                        nodeControl.CutClicked += OnCutClicked;
                        nodeControl.CopyClicked += OnCopyClicked;
                        nodeControl.CloneClicked += OnCloneClicked;
                        nodeControl.NodeClicked += OnNodeClicked;
                        nodeControl.ChangeNodeTypeClicked += OnChangeNodeTypeClicked;
                        nodeControl.NodeSelected += OnNodeSelected;
                        if (viewModelNode.IsFocused)
                        {
                            focusedNode = nodeControl;
                        }

                        //nodeControl.NodeCornerControl.DataContext = viewModelNode;
                        NodeContainer.Children.Add(nodeControl);
                    }
                }
                else if (viewModelNodeOperation.Value == ModelOperationType.Deleted)
                {
                    var viewModelNode = viewModelNodeOperation.Key;
                    if (viewModelNode == null)
                    {
                        continue;
                    }

                    var removedNodeSet = NodeFactory.RemoveNode(viewModelNode);
                    if (removedNodeSet != null)
                    {
                        NodeContainer.Children.Remove(removedNodeSet.Control);
                        if (removedNodeSet.Control != null)
                        {
                            removedNodeSet.Control.Dispose();
                        }
                    }

                    var irrelevantArrowSets = ArrowFactory.RemoveArrows(viewModelNode);

                    foreach (ArrowControlFactorySet irrelevantArrowSet in irrelevantArrowSets)
                    {
                        NodeContainer.Children.Remove(irrelevantArrowSet.Control);
                    }
                }
            }

            var arrows = ArrowFactory.ReassessPendingRelationships();
            foreach (ArrowControl arrow in arrows)
            {
                NodeContainer.Children.Add(arrow);
            }

            /// TODO: Need to refactor the following to be self-contained.

            foreach (KeyValuePair<Relationship, ModelOperationType> viewModelRelationshipOperation in e.Relationships)
            {
                if (viewModelRelationshipOperation.Value == ModelOperationType.New)
                {
                    var viewModelRelationship = viewModelRelationshipOperation.Key;

                    var arrow = ArrowFactory.CreateArrow(viewModelRelationship);

                    if (arrow != null)
                    {
                        arrow.RenderTransform = MoveGraphTransform;
                        arrow.Ref = this;
                        if (!NodeContainer.Children.Contains(arrow))
                        {
                            NodeContainer.Children.Add(arrow);
                        }
                    }
                }
                else if (viewModelRelationshipOperation.Value == ModelOperationType.Deleted)
                {
                    var viewModelRelationship = viewModelRelationshipOperation.Key;

                    var arrowSet = ArrowFactory.RemoveArrow(viewModelRelationship);

                    if (arrowSet != null)
                    {
                        NodeContainer.Children.Remove(arrowSet.Control);
                        arrowSet.Control.UnlinkRelatedNodeControls();
                    }
                }
            }

            GC.Collect();
            NodeContainer.InvalidateArrange();
            if (focusedNode != null && focusedNode.Name.Trim().Length == 0)
            {
                focusedNode.SetEditFocus();
                focusedNode.GiveEditorFocus();
            }
        }