private void CompendiumMapDepthMap_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
_isLeftMouseButtonDown = false;
INodeRenderer nr = ViewManager.GetNodeRenderer(_currentMousePosition);
NodeRelationshipHelper nrh = IoC.IoCContainer.GetInjectionInstance().GetInstance <NodeRelationshipHelper>();
if (nrh != null)
{
if (nrh.IsEditting)
{
if (nr != null)
{
IRelationshipProxy originalRelationship = nrh.Relationship.DataContext as IRelationshipProxy;
_nodeService.DeleteRelationship(Navigator.DomainId, originalRelationship.Id);
IDescriptorTypeProxy toDescriptorTypeProxy = _typeManager.GetDescriptorType("To");
IDescriptorTypeProxy fromDescriptorTypeProxy = _typeManager.GetDescriptorType("From");
IDescriptorTypeProxy transMapDescriptorTypeProxy = _typeManager.GetDescriptorType("TransclusionMap");
Dictionary <IDescriptorTypeProxy, Guid> nodes = new Dictionary <IDescriptorTypeProxy, Guid>();
INodeProxy fromNode = null, toNode = null;
switch (nrh.EdittingSide)
{
case RelationshipSide.From:
fromNode = nr.Node;
toNode = originalRelationship.Descriptors.GetByDescriptorTypeName("To").First().Node;
break;
case RelationshipSide.To:
fromNode = originalRelationship.Descriptors.GetByDescriptorTypeName("From").First().Node;
toNode = nr.Node;
break;
default:
break;
}
nodes.Add(toDescriptorTypeProxy, toNode.Id);
nodes.Add(fromDescriptorTypeProxy, fromNode.Id);
IRelationshipTypeProxy relationshipTypeProxy = null;
if (fromNode.ParentMapNodeUid != this.Navigator.FocalNodeId || toNode.ParentMapNodeUid != this.Navigator.FocalNodeId)
{
nodes.Add(transMapDescriptorTypeProxy, this.Navigator.FocalNodeId);
relationshipTypeProxy = _typeManager.GetRelationshipType("TransclusionRelationship");
}
else
{
relationshipTypeProxy = _typeManager.GetRelationshipType("FromToRelationship");
}
_navigator.ConnectNodesAsync(nodes, relationshipTypeProxy, originalRelationship.Id.ToString());
_navigator.GetCurrentNodesAsync();
}
else
{
nrh.Relationship.UpdateArrow();
}
}
nrh.IsEditting = false;
}
if (_selectionRectangle != null)
{
this.uxMapSurface.Children.Remove(_selectionRectangle);
double topLeftX = (double)_selectionRectangle.GetValue(Canvas.LeftProperty);
double topLeftY = (double)_selectionRectangle.GetValue(Canvas.TopProperty);
double bottomRightX = _selectionRectangle.Width + topLeftX;
double bottomRightY = _selectionRectangle.Height + topLeftY;
_selectionRectangle = null;
if (!(Double.IsNaN(bottomRightX) && Double.IsNaN(bottomRightY)))
{
ViewManager.SelectAllWithinBounds(new Point(topLeftX, topLeftY), new Point(bottomRightX, bottomRightY));
}
else
{
ViewManager.UnselectAllNodes();
ViewManager.UnselectAllRelationships();
}
}
}