Ejemplo n.º 1
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);
            }
        }
Ejemplo n.º 2
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);
            }
        }
Ejemplo n.º 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);
        }