Inheritance: BreadcrumbItemBase
示例#1
0
 public MultiBreadcrumbItem(List <Node> nodes)
 {
     if (nodes.Count == 0)
     {
         return;
     }
     foreach (var node in nodes)
     {
         var breadcrumb = new BreadcrumbItem(node);
         Items.Add(breadcrumb);
     }
     SelectedBreadcrumb = Items[0];
 }
示例#2
0
        public override void QueryCompleted(TransactionalNodeService.Proxy.NodesEventArgs e)
        {
            var context = (Guid)e.Context;

            var isMapLoaded = false;

            if (context != Guid.Empty)
            {
                if (e.Nodes != null && e.Nodes.Values != null)
                {
                    foreach (var node in e.Nodes.Values)
                    {
                        if (node.Id == context)
                        {
                            if (node.NodeType == MapManager.NodeTypes["CompendiumMapNode"])
                            {
                                ControllerContainer.SuperGraphController.ChangeContextAsync(node);

                                var viewModelNode = new Node(MapManager);
                                viewModelNode.LoadNode(null, node);
                                var breadcrumb = new BreadcrumbItem(viewModelNode);
                                Breadcrumbs.BreadcrumbTrail.Add(breadcrumb);

                                Preloader.LoadParentBreadcrumb(node);
                                isMapLoaded = true;
                                break;
                            }
                        }
                    }
                }
            }

            if (isMapLoaded)
            {
                LoadCompleted();
            }
            else
            {
                LoadFailed();
            }

            base.QueryCompleted(e);
        }
示例#3
0
        public override void QueryCompleted(TransactionalNodeService.Proxy.NodesEventArgs e)
        {
            var context = (Guid)e.Context;

            var isMapLoaded = false;

            if (context != Guid.Empty)
            {
                if (e.Nodes != null && e.Nodes.Values != null)
                {
                    foreach (var node in e.Nodes.Values)
                    {
                        if (node.Id == context)
                        {
                            if (node.RootMapId == context)
                            {
                                ControllerContainer.SuperGraphController.ChangeContextAsync(node);
                                var viewModelNode = new SuperGraph.ViewModel.Node(MapManager);
                                viewModelNode.LoadNode(null, node);
                                var breadcrumb = new BreadcrumbItem(viewModelNode);
                                Breadcrumbs.BreadcrumbTrail.Add(breadcrumb);
                                isMapLoaded = true;
                            }
                            else
                            {
                                var maps = node.FindContainerMapsOfNode(MapManager);

                                if (maps.Count > 0)
                                {
                                    INode firstMapLoaded;
                                    if (MapUid == Guid.Empty)
                                    {
                                        firstMapLoaded = maps.FirstOrDefault();
                                    }
                                    else
                                    {
                                        firstMapLoaded = maps.FirstOrDefault(q => q.Id == MapUid);
                                    }

                                    if (firstMapLoaded != null)
                                    {
                                        ControllerContainer.SuperGraphController.ChangeContextAsync(firstMapLoaded);

                                        var index = maps.IndexOf(firstMapLoaded);

                                        if (index > 0)
                                        {
                                            maps.RemoveAt(index);
                                            maps.Insert(0, firstMapLoaded);
                                        }

                                        Preloader.LoadParentMaps(maps, MapUid);

                                        Preloader.LoadParentBreadcrumb(firstMapLoaded);

                                        isMapLoaded = true;
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
            }

            if (isMapLoaded)
            {
                LoadCompleted();
            }
            else
            {
                LoadFailed();
            }

            base.QueryCompleted(e);
        }
示例#4
0
        public void LoadParentMaps(List<INode> maps, Guid mapId)
        {
            var viewModelMaps = new List<SuperGraph.ViewModel.Node>();

            foreach (var map in maps)
            {
                if (viewModelMaps.All(q => q.Proxy.Id != map.Id))
                {
                    var viewModelNode = new SuperGraph.ViewModel.Node(MapManager);
                    viewModelNode.LoadNode(null, map);

                    viewModelMaps.Add(viewModelNode);
                }
            }

            if (viewModelMaps.Count > 1)
            {
                var breadcrumb = new MultiBreadcrumbItem(viewModelMaps);
                if (mapId != Guid.Empty)
                {
                    var currentMap = breadcrumb.Items.FirstOrDefault(q => q.Node.Proxy.Id == mapId);
                    if (currentMap != null)
                    {
                        breadcrumb.SelectedBreadcrumb = currentMap;
                    }
                }
                Breadcrumbs.BreadcrumbTrail.Insert(breadcrumb, _parentIndex);
            }
            else if (viewModelMaps.Count == 1)
            {
                var breadcrumb = new BreadcrumbItem(viewModelMaps[0]);
                Breadcrumbs.BreadcrumbTrail.Insert(breadcrumb, _parentIndex);
            }
        }
示例#5
0
 public MultiBreadcrumbItem(List<Node> nodes)
 {
     if(nodes.Count == 0) return;
     foreach (var node in nodes)
     {
         var breadcrumb = new BreadcrumbItem(node);
         Items.Add(breadcrumb);
     }
     SelectedBreadcrumb = Items[0];
 }
示例#6
0
        private void QueryMapByDomain(object sender, Proxy.NodesEventArgs eventArgs)
        {
            var context = (Guid)eventArgs.Context;

            foreach (var node in eventArgs.Nodes.Values)
            {
                // The following line appears to be inherently incorrect. It relies on the fact that the first node will be the context.
                //if (node.NodeType == _mapManager.NodeTypes["CompendiumMapNode"])
                // The following line replaces the above line.
                if (node.Id == context)
                {
                    var viewModelNode = new Node(_mapManager);
                    viewModelNode.LoadNode(null, node);
                    viewModelNode.IsRootMap = true;
                    var breadcrumb = new BreadcrumbItem(viewModelNode);
                    Breadcrumbs.BreadcrumbTrail.Add(breadcrumb);

                    _superGraphController.ChangeContextAsync(node);
                    break;
                }
            }


        }
示例#7
0
        private void NodeClicked(object sender, NodeClickedEventArgs e)
        {
            var nodeControl = sender as NodeControl;

            if (_superGraphController != null && nodeControl != null)
            {
                var node = nodeControl.DataContext as Node;
                if (node != null)
                {
                    if (node.MapObjectType == _mapManager.NodeTypes["CompendiumMapNode"].Id)
                    {
                        var facadeNode = node.Proxy as FacadeNode;
                        if (facadeNode != null)
                        {
                            if (!facadeNode.IsConcrete)
                            {
                                return; //if the node isn't concrete we won't be able to navigate down into the submap (ie it was just added and the transactions are outstanding)
                            }
                        }
                        IoC.GetInstance<ISuperGraphRelationshipFactory>().IsSameDomain = true;
                        SuperGraph.ClearMapObjects();
                        ShowLoading();

                        var breadcrumb = new BreadcrumbItem(node);
                        Breadcrumbs.BreadcrumbTrail.Add(breadcrumb);

                        _superGraphController.ChangeContextAsync(node);

                        //The line below forces the related content panels to reset and hide with each map navigation
                        //it's commented out to experiment what it's like to leave the content in place
                        //RelatedContentPanelUtil.Instance.ResetAndHidePanels();
                    }
                }
            }
        }