private ArrowControlFactorySet CreateSet(ViewModel.Relationship viewModelRelationship, NodeControl fromControl, NodeControl toControl) { ArrowController arrowController = new ArrowController(viewModelRelationship, fromControl, toControl); arrowController.ViewModel.Id = viewModelRelationship.Id; if (toControl != null) { toControl.LinkFromNode(fromControl); } ArrowControl arrowControl = new ArrowControl(fromControl, toControl); Canvas.SetZIndex(arrowControl, 40); arrowControl.DataContext = arrowController.ViewModel; if (toControl != null && toControl.ViewModelNode.State == CollapseState.None) { toControl.ViewModelNode.State = CollapseState.Expanded; } ArrowControlFactorySet set = new ArrowControlFactorySet(); set.Relationship = viewModelRelationship; set.Control = arrowControl; set.Controller = arrowController; return(set); }
public IEnumerable <ArrowControl> ReassessPendingRelationships() { List <ViewModel.Relationship> completedViewModels = new List <ViewModel.Relationship>(); foreach (ViewModel.Relationship pendingRelationship in PendingRelationships.Values) { NodeControl fromControl = NodeFactory.FindNodeControl(pendingRelationship.From); NodeControl toControl = NodeFactory.FindNodeControl(pendingRelationship.To); if (fromControl != null && toControl != null) { ArrowControlFactorySet set = CreateSet(pendingRelationship, fromControl, toControl); Arrows[pendingRelationship.Id] = set; completedViewModels.Add(pendingRelationship); yield return(set.Control); } } foreach (ViewModel.Relationship completedViewModel in completedViewModels) { PendingRelationships.Remove(completedViewModel.Id); } }
public ArrowControlFactorySet RemoveArrow(Guid relationshipId) { ArrowControlFactorySet set = null; if (Arrows.ContainsKey(relationshipId)) { set = Arrows[relationshipId]; Arrows.Remove(relationshipId); set.Control.UnlinkRelatedNodeControls(); } return(set); }
private ArrowControlFactorySet CreateSet(ViewModel.Relationship viewModelRelationship, NodeControl fromControl, NodeControl toControl) { ArrowController arrowController = new ArrowController(viewModelRelationship, fromControl, toControl); arrowController.ViewModel.Id = viewModelRelationship.Id; if (toControl != null) { toControl.LinkFromNode(fromControl); } ArrowControl arrowControl = new ArrowControl(fromControl, toControl); Canvas.SetZIndex(arrowControl, 40); arrowControl.DataContext = arrowController.ViewModel; if (toControl != null && toControl.ViewModelNode.State == CollapseState.None) { toControl.ViewModelNode.State = CollapseState.Expanded; } ArrowControlFactorySet set = new ArrowControlFactorySet(); set.Relationship = viewModelRelationship; set.Control = arrowControl; set.Controller = arrowController; return set; }