Пример #1
0
        /// <summary>
        /// When a relationship is drawn by right clicking on one node and dragging the line to the another node a FromToRelationship
        /// will be constructed, that is the event that triggers this method.
        /// </summary>
        /// <param name="sender">The NodeRelationshipHelper that has detected the connection has been drawn</param>
        /// <param name="e"></param>
        private void OnNodesConnected(object sender, EventArgs e)
        {
            NodeRelationshipHelper nrh = sender as NodeRelationshipHelper;

            if (nrh != null)
            {
                IDescriptorTypeProxy toDescriptorTypeProxy       = _typeManager.GetDescriptorType("To");
                IDescriptorTypeProxy fromDescriptorTypeProxy     = _typeManager.GetDescriptorType("From");
                IDescriptorTypeProxy transMapDescriptorTypeProxy = _typeManager.GetDescriptorType("TransclusionMap");

                INodeProxy fromNode = nrh.FromNode.DataContext as INodeProxy;
                INodeProxy toNode   = nrh.ToNode.DataContext as INodeProxy;

                Dictionary <IDescriptorTypeProxy, Guid> nodes = new Dictionary <IDescriptorTypeProxy, Guid>();
                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, string.Empty);
                _navigator.GetCurrentNodesAsync();
            }
        }
Пример #2
0
        private void ShowNodeContextMenu(object nodeProxy)
        {
            Thread.Sleep(300);

            // put it on the UI thread to execute.
            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                if (!_mouseMovedWhileRMBDown)
                {
                    NodeRelationshipHelper nrh = IoC.IoCContainer.GetInjectionInstance().GetInstance <NodeRelationshipHelper>();
                    if (nrh.FromNode != null)
                    {
                        nrh.FromNode = null;
                    }
                    if (this.uxMapSurface.Children.Contains(_tempRelationshipLine))
                    {
                        this.uxMapSurface.Children.Remove(_tempRelationshipLine);
                    }
                    NodeContextMenu contextMenu = new NodeContextMenu(nodeProxy as INodeProxy, this, _nodeService, _currentMousePosition);
                    ContextMenuService.SetContextMenu(this, contextMenu);

                    contextMenu.IsOpen           = true;
                    contextMenu.HorizontalOffset = _currentMousePosition.X;
                    contextMenu.VerticalOffset   = _currentMousePosition.Y + 30;
                }
            });
        }
Пример #3
0
        private void OnMouseRightButtonDown(object sender, MouseButtonEventArgs e)
        {
            //Pass this node to the surface as the start point
            NodeRelationshipHelper nrh = IoC.IoCContainer.GetInjectionInstance().GetInstance <NodeRelationshipHelper>();

            nrh.FromNode = this;
        }
Пример #4
0
        public CompendiumMapDepthMap()
        {
            InitializeComponent();

            NodeRelationshipHelper nrh = new NodeRelationshipHelper();

            IoC.IoCContainer.GetInjectionInstance().RegisterComponent <NodeRelationshipHelper>(nrh);
            nrh.NodesConnected += new EventHandler(OnNodesConnected);

            this.MouseMove            += new MouseEventHandler(CompendiumMapDepthMap_MouseMove);
            this.KeyDown              += new KeyEventHandler(CompendiumMapDepthMap_KeyDown);
            this.MouseRightButtonDown += new MouseButtonEventHandler(CompendiumMapDepthMap_MouseRightButtonDown);
            this.MouseRightButtonUp   += new MouseButtonEventHandler(CompendiumMapDepthMap_MouseRightButtonUp);
            this.MouseLeftButtonDown  += new MouseButtonEventHandler(CompendiumMapDepthMap_MouseLeftButtonDown);
            this.MouseLeftButtonUp    += new MouseButtonEventHandler(CompendiumMapDepthMap_MouseLeftButtonUp);

            if (!IsInDesignMode)
            {
                // TODO: The following code has been superceded;
                #region Obsolete
                if (string.IsNullOrEmpty(MappingToolSvcUrl))
                {
                    _nodeService = new DatabaseMappingService();
                }
                else
                {
                    _nodeService = new DatabaseMappingService(MappingToolSvcUrl);
                }
                IoC.IoCContainer.GetInjectionInstance().RegisterComponent <INodeService>(_nodeService);

                _typeManager = new TypeManager(_nodeService);
                IoC.IoCContainer.GetInjectionInstance().RegisterComponent <TypeManager>(_typeManager);

                _typeManager.InitialiseNodeTypeManagerCompleted += new EventHandler(InitialiseNodeTypeManagerCompleted);
                _typeManager.InitialiseNodeTypeManager();
                #endregion

                // TODO: Need to change this to pull from the params in the HTML declaration itself.
                TransactionalMappingToolSvcUrl = "http://glyma-dev/_vti_bin/SevenSigma/TransactionalMappingToolService.svc";

                System.ServiceModel.BasicHttpBinding binding = new System.ServiceModel.BasicHttpBinding();
                binding.Security.Mode          = System.ServiceModel.BasicHttpSecurityMode.TransportCredentialOnly;
                binding.MaxReceivedMessageSize = 2147483647;

                System.ServiceModel.EndpointAddress address = new System.ServiceModel.EndpointAddress(new Uri(TransactionalMappingToolSvcUrl));

                Service.TransactionalMappingToolServiceClient client = new Service.TransactionalMappingToolServiceClient(binding, address);

                _mapManager = new SoapMapManager(client);

                IoC.IoCContainer.GetInjectionInstance().RegisterComponent <IMapManager>(_mapManager);

                _mapManager.InitialiseMapManagerCompleted += new EventHandler <InitialiseMapManagerEventArgs>(OnInitialiseMapManagerCompleted);
                _mapManager.InitialiseMapManagerAsync();
            }
        }
Пример #5
0
        private void CompendiumMapDepthMap_MouseRightButtonUp(object sender, MouseButtonEventArgs e)
        {
            _isRightMouseButtonDown = false;
            _mouseMovedWhileRMBDown = false;
            NodeRelationshipHelper nrh = IoC.IoCContainer.GetInjectionInstance().GetInstance <NodeRelationshipHelper>();

            if (nrh.ToNode == null)
            {
                nrh.FromNode = null;
            }
            if (this.uxMapSurface.Children.Contains(_tempRelationshipLine))
            {
                this.uxMapSurface.Children.Remove(_tempRelationshipLine);
            }
        }
Пример #6
0
        private void CompendiumMapDepthMap_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
        {
            _currentMousePosition   = e.GetPosition(this);
            _isRightMouseButtonDown = true;
            _mouseMovedWhileRMBDown = false;
            NodeRelationshipHelper nrh = IoC.IoCContainer.GetInjectionInstance().GetInstance <NodeRelationshipHelper>();

            if (nrh.FromNode != null)
            {
                _startLinePosition    = nrh.GetCenterOfFromNode();
                _tempRelationshipLine = new Line();
                _tempRelationshipLine.StrokeThickness = 1.25;
                _tempRelationshipLine.Stroke          = new SolidColorBrush(Colors.Black);
                _tempRelationshipLine.Opacity         = 0.40;
                _tempRelationshipLine.X1 = _startLinePosition.X;
                _tempRelationshipLine.Y1 = _startLinePosition.Y;
                _tempRelationshipLine.X2 = _startLinePosition.X;
                _tempRelationshipLine.Y2 = _startLinePosition.Y;
                _tempRelationshipLine.SetValue(Canvas.ZIndexProperty, -1);
                this.uxMapSurface.Children.Add(_tempRelationshipLine);

                Thread rightClickDelayThread = new Thread(this.ShowNodeContextMenu);
                rightClickDelayThread.Start(nrh.FromNode.DataContext as INodeProxy);
            }
            else if (nrh.Relationship != null)
            {
                Thread rightCLickDelayThread = new Thread(this.ShowRelationshipContextMenu);
                rightCLickDelayThread.Start(nrh.Relationship.DataContext as IRelationshipProxy);
            }
            else
            {
                _originalPanPosition = _currentMousePosition;
                Thread rightClickDelayThread = new Thread(this.ShowCanvasContextMenu);
                rightClickDelayThread.Start();
            }
            e.Handled = true;
        }
Пример #7
0
        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();
                }
            }
        }
Пример #8
0
        private void OnMouseRightButtonUp(object sender, MouseButtonEventArgs e)
        {
            NodeRelationshipHelper nrh = IoC.IoCContainer.GetInjectionInstance().GetInstance <NodeRelationshipHelper>();

            nrh.ToNode = this;
        }