Inheritance: EventRegisterEventArgs
Esempio n. 1
0
        private void OnParentBreadcrumbQueryCompleted(object sender, TransactionalNodeService.Proxy.NodesEventArgs e)
        {
            var context = (INode)e.Context;

            if (context == null)
            {
                throw new ArgumentNullException("Context shouldn't be empty.");
            }

            if (e.Nodes != null && e.Nodes.Values != null)
            {
                foreach (INode node in e.Nodes.Values)
                {
                    if (node.Id == context.Id)
                    {
                        var maps = node.FindContainerMapsOfNode(MapManager);

                        if (maps.Count > 0)
                        {
                            LoadParentMaps(maps, Guid.Empty);
                        }
                        else
                        {
                            Breadcrumbs.BreadcrumbTrail.RootMapFound();
                        }
                        break;
                    }
                }
            }
        }
Esempio n. 2
0
        private void OnQueryMapPagedCompleted(object sender, Service.QueryMapPagedCompletedEventArgs e)
        {
            if (e != null && e.Result != null)
            {
                e.Result.DecompressResponse();
            }

            //ServiceProxy.QueryMapPagedCompleted -= OnQueryMapByIdPagedCompleted;
            Service.QueryResponse queryResponse = e.Result;

            QueryMapResponseStateInfo callerInfo = e.UserState as QueryMapResponseStateInfo;

            Service.QueryResponse aggregatedResponse = callerInfo.AggregatedResponse;//e.UserState as Service.QueryResponse;

            if (aggregatedResponse == null)
            {
                aggregatedResponse.Domain      = queryResponse.Domain;
                aggregatedResponse.NodeContext = queryResponse.NodeContext;

                aggregatedResponse.Nodes         = new Dictionary <Guid, Service.NO>();
                aggregatedResponse.Relationships = new Dictionary <Guid, Service.RE>();
            }

            foreach (KeyValuePair <Guid, Service.NO> nodePair in queryResponse.Nodes)
            {
                aggregatedResponse.Nodes[nodePair.Key] = nodePair.Value;
            }

            foreach (KeyValuePair <Guid, Service.RE> relationshipPair in queryResponse.Relationships)
            {
                aggregatedResponse.Relationships[relationshipPair.Key] = relationshipPair.Value;
            }

            if (queryResponse.LastObjectIndex >= queryResponse.FinalObjectIndex)
            {
                ServerObjects.QueryResponse soAggregatedResponse = ServerObjectConverter.ToQueryResponse(aggregatedResponse);

                Proxy.NodesEventArgs eventArgs = new Proxy.NodesEventArgs();

                Graph.NodesAndRelationshipBuildEventArgs(eventArgs, soAggregatedResponse.Nodes, soAggregatedResponse.Relationships);

                Proxy.INode context = eventArgs.Nodes[e.Result.NodeContext.N];

                if (callerInfo.ResponseType == QueryMapResponseStateType.ById)
                {
                    QueryMapByIdCompleted.FireEvent(context.Id, this, eventArgs);
                }
                else if (callerInfo.ResponseType == QueryMapResponseStateType.ByNode)
                {
                    QueryMapByNodeCompleted.FireEvent(context, this, eventArgs);
                }
            }
            else
            {
                QueryMapResponseStateInfo info = new QueryMapResponseStateInfo();
                info.AggregatedResponse = aggregatedResponse;
                info.ResponseType       = callerInfo.ResponseType;
                ServiceProxy.QueryMapPagedAsync(System.Windows.Browser.HtmlPage.Document.DocumentUri.ToString(), aggregatedResponse.Domain.DomainUid, aggregatedResponse.NodeContext.N, 1, null, null, queryResponse.LastObjectIndex + 1, info);
            }
        }
        private void OnAcquireDomainsCompleted(object sender, TransactionalNodeService.Proxy.NodesEventArgs e)
        {
            XTreeView.Items.Clear();
            _projects = new ObservableCollection <Project>();
            foreach (var node in e.Nodes.Values)
            {
                if (node != null)
                {
                    var project = new Project(node, SecurityGroups);
                    if (App.PermissionLevel == PermissionLevel.SecurityManager)
                    {
                        project.PermissionChanged += OnPermissionChanged;
                    }
                    project.MetadataChanged += OnMetadataChanged;
                    _projects.Add(project);
                }
            }
            ObservableCollection <Project> sortedCollection = new ObservableCollection <Project>();

            foreach (Project project in _projects.OrderBy(p => p.DisplayName))
            {
                sortedCollection.Add(project);
            }
            _projects             = sortedCollection;
            XTreeView.ItemsSource = _projects;
        }
Esempio n. 4
0
        void OnCreateRootMapCompleted(object sender, Service.CreateRootMapCompletedEventArgs e)
        {
            if (CreateRootMapCompleted != null)
            {
                Proxy.NodesEventArgs        eventArgs       = new Proxy.NodesEventArgs();
                ServerObjects.QueryResponse soQueryResponse = ServerObjectConverter.ToQueryResponse(e.Result);

                Graph.NodesAndRelationshipBuildEventArgs(eventArgs, soQueryResponse.Nodes, soQueryResponse.Relationships);

                CreateRootMapCompleted.FireEvent(this, eventArgs);
            }
        }
Esempio n. 5
0
 private void OnAcquireNodesByDomainCompleted(object sender, Proxy.NodesEventArgs e)
 {
     foreach (Proxy.Node node in e.Nodes.Values)
     {
         if (node.NodeType == _mapManager.NodeTypes["DomainNode"])
         {
             // TODO: The following line doesn't actually need to be here.
             NodeUid = node.Id.ToString();
             SetNodeId(node.Id);
             InitializeNavigator(GetDomainId().Value, GetNodeId().Value);
         }
     }
 }
Esempio n. 6
0
        private void OnQueryDomainsCompleted(object sender, Service.QueryDomainsCompletedEventArgs e)
        {
            Proxy.NodesEventArgs eventArgs = new Proxy.NodesEventArgs();

            foreach (Service.QueryResponse soapServiceQueryResponse in e.Result.Values)
            {
                ServerObjects.QueryResponse soQueryResponse = ServerObjectConverter.ToQueryResponse(soapServiceQueryResponse);

                Graph.NodesAndRelationshipBuildEventArgs(eventArgs, soQueryResponse.Nodes, soQueryResponse.Relationships);
            }

            QueryDomainsCompleted.FireEvent(this, eventArgs);
        }
 private void OnAcquireNewDomainsCompleted(object sender, TransactionalNodeService.Proxy.NodesEventArgs e)
 {
     foreach (var node in e.Nodes.Values)
     {
         if (node != null && _projects.All(q => q.Id != node.DomainId))
         {
             _securityManager.SetProjectManagerGroupAssociationsAsync(node, OnNewDomainSecurityAssociationCreated,
                                                                      new GlymaSecurableObject
             {
                 SecurableParentUid = Guid.Empty,
                 SecurableObjectUid = node.DomainId
             });
         }
     }
 }
 private void OnCopyRootMapCompleted(object sender, TransactionalNodeService.Proxy.NodesEventArgs e)
 {
     if (e.Nodes != null && e.Nodes.Count > 0)
     {
         var map = e.Nodes.Values.FirstOrDefault();
         if (map != null && Equals(map.NodeType, MapManager.NodeTypes["CompendiumMapNode"]))
         {
             var project = _projects.FirstOrDefault(q => q.Id == map.DomainId);
             if (project != null)
             {
                 project.RootMaps.Add(new RootMap(map, SecurityGroups, project.Name, false));
             }
         }
     }
 }
Esempio n. 9
0
        private void NodeLoadCompleted(object sender, Proxy.NodesEventArgs eventArgs)
        {
            Node node = eventArgs.State as Node;
            IEnumerable <Proxy.IRelationship> mapContainerRelationships = node.Proxy.Relationships.FindRelationships(MapManager.ConnectionTypes["From"], MapManager.RelationshipTypes["MapContainerRelationship"]);
            Dictionary <Guid, string>         mapContainerNodes         = GetMapContainerNodes(node.Proxy.Id, mapContainerRelationships);
            TransclusionLoadEventArgs         transclusionEventArgs     = new TransclusionLoadEventArgs()
            {
                MapContainerNodes = mapContainerNodes, Node = node
            };

            if (TransclusionsLoadCompleted != null)
            {
                TransclusionsLoadCompleted(this, transclusionEventArgs);
            }
        }
Esempio n. 10
0
        private void OnAcquireDomainsCompleted(object sender, Proxy.NodesEventArgs e)
        {
            DomainSelector.Items.Clear();

            List <INode> nodes = new List <INode>(e.Nodes.Values);

            nodes.Sort(new Comparison <INode>(NodeComparison));

            foreach (INode node in nodes)
            {
                var item = new RadComboBoxItem {
                    DataContext = node, Content = node.Metadata.FindMetadata("Name").Value
                };

                DomainSelector.Items.Add(item);
            }
        }
Esempio n. 11
0
        private void OnQueryMapByDomainCompleted(object sender, Service.QueryMapByDomainCompletedEventArgs e)
        {
            if (e != null && e.Result != null)
            {
                e.Result.DecompressResponse();
            }

            if (QueryMapByDomainCompleted != null)
            {
                Proxy.NodesEventArgs        eventArgs       = new Proxy.NodesEventArgs();
                ServerObjects.QueryResponse soQueryResponse = ServerObjectConverter.ToQueryResponse(e.Result);

                Graph.NodesAndRelationshipBuildEventArgs(eventArgs, soQueryResponse.Nodes, soQueryResponse.Relationships);

                Proxy.INode nodeContext = Graph.FindNode(soQueryResponse.NodeContext);

                QueryMapByDomainCompleted.FireEvent(nodeContext.DomainId, this, eventArgs);
            }
        }
Esempio n. 12
0
        private void OnAcquireNodeByDomainCompleted(object sender, Proxy.NodesEventArgs e)
        {
            List <INode> nodes = new List <INode>(e.Nodes.Values);

            nodes.Sort(new Comparison <INode>(NodeComparison));

            foreach (var node in nodes)
            {
                if (Equals(node.NodeType, MapNodeType))
                {
                    var item = new RadComboBoxItem {
                        DataContext = node, Content = node.Metadata.FindMetadata("Name").Value
                    };

                    MapSelector.Items.Add(item);

                    MapSelector.IsEnabled = true;
                }
            }
        }
Esempio n. 13
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;
                }
            }
        }
Esempio n. 14
0
        private void LoadRootMapPropertiesCompleted(object sender, Proxy.NodesEventArgs eventArgs)
        {
            var contextGuid = (Guid)eventArgs.Context;
            IDictionary <string, string> rootNodeMetadata = new Dictionary <string, string>();

            if (eventArgs.Nodes != null && contextGuid != null)
            {
                foreach (var node in eventArgs.Nodes.Values)
                {
                    if (node.Id == contextGuid)
                    {
                        var metadataSet = node.Metadata;
                        foreach (var metadata in metadataSet)
                        {
                            rootNodeMetadata[metadata.Name] = metadata.Value;
                        }
                    }
                }
            }
            RootMapProperties.Instance.Metadata = rootNodeMetadata;

            RelatedContentPanelUtil.Instance.MapLoadedCallback(false);
        }
        private void OnAcquireNodeByDomainCompleted(object sender, TransactionalNodeService.Proxy.NodesEventArgs e)
        {
            if (e.Context is Guid && _selectedProjectItemToExpand != null)
            {
                var project = _projects.FirstOrDefault(q => q.Node.DomainId == (Guid)e.Context);
                if (project != null)
                {
                    foreach (var node in e.Nodes.Values)
                    {
                        if (Equals(node.NodeType, MapManager.NodeTypes["CompendiumMapNode"]))
                        {
                            var map = new RootMap(node, SecurityGroups, project.Name);
                            if (App.PermissionLevel == PermissionLevel.SecurityManager)
                            {
                                map.PermissionChanged += OnPermissionChanged;
                            }
                            map.MetadataChanged += OnMetadataChanged;
                            project.RootMaps.Add(map);
                        }
                    }

                    if (project.RootMaps.Count > 0)
                    {
                        ObservableCollection <RootMap> sortedCollection = new ObservableCollection <RootMap>();
                        foreach (RootMap rootmap in project.RootMaps.OrderBy(rm => rm.DisplayName))
                        {
                            sortedCollection.Add(rootmap);
                        }
                        project.RootMaps = sortedCollection;
                        _selectedProjectItemToExpand.ItemsSource = project.RootMaps;
                    }
                }
                _selectedProjectItemToExpand.IsLoadOnDemandEnabled = false;
                _selectedProjectItemToExpand.IsLoadingOnDemand     = false;
                _selectedProjectItemToExpand = null;
            }
        }
 private void OnMapNodeCreated(object sender, TransactionalNodeService.Proxy.NodesEventArgs e)
 {
     if (e.Nodes != null && e.Nodes.Count > 0)
     {
         var map = e.Nodes.Values.FirstOrDefault();
         if (map != null && Equals(map.NodeType, MapManager.NodeTypes["CompendiumMapNode"]))
         {
             var project = _projects.FirstOrDefault(q => q.Id == map.DomainId);
             if (project != null)
             {
                 var newRootMap = new RootMap(map, SecurityGroups, project.Name);
                 newRootMap.IsNewMap           = true;
                 newRootMap.MetadataChanged   += OnMetadataChanged;
                 newRootMap.PermissionChanged += OnPermissionChanged;
                 project.RootMaps              = InsertSortedRootMap(newRootMap, project.RootMaps);
                 if (XTreeView.SelectedContainer != null && XTreeView.SelectedContainer.Item == project)
                 {
                     XTreeView.SelectedContainer.ItemsSource = null;
                     XTreeView.SelectedContainer.ItemsSource = project.RootMaps;
                 }
             }
         }
     }
 }
Esempio n. 17
0
        private void LoadNodesCompleted(object sender, Proxy.NodesEventArgs eventArgs)
        {
            if (eventArgs.State != Context.Proxy)
            {
                throw new UnexpectedMapException("The state of the event doesn't match with this controller.");
            }

            Proxy.RelationshipSet contextRelationships = Context.Proxy.Relationships;

            if (Context.Proxy.Status != Proxy.LoadState.Full)
            {
                throw new UnexpectedMapException("The relationships were not loaded for the context of this map.");
            }

            var mapChildrenRelationships = contextRelationships.FindRelationships(MapManager.ConnectionTypes["To"], MapManager.RelationshipTypes["MapContainerRelationship"]);

            var modelChangedNodesEventArgs         = new ModelChangedEventArgs <Node, Relationship>();
            var modelChangedRelationshipsEventArgs = new ModelChangedEventArgs <Node, Relationship>();

            foreach (Proxy.IRelationship relationship in mapChildrenRelationships)
            {
                Proxy.NodeSet allRelationshipNodes = relationship.Nodes;

                IEnumerable <Proxy.INode> connectedNodes = allRelationshipNodes.FindNodes(MapManager.ConnectionTypes["From"], true);

                if (connectedNodes == null)
                {
                    continue;
                }

                foreach (Proxy.INode modelNode in connectedNodes)
                {
                    var viewModelNode = new Node(MapManager);
                    viewModelNode.LoadNode(relationship, modelNode);
                    ThemeManager.DressNode(viewModelNode);

                    viewModelNode.PropertyChanged += ViewModelNode_PropertyChanged;
                    viewModelNode.LocationChanged += ViewModelNode_LocationChanged;

                    viewModelNode.VideoInfo = VideoController.CreateVideoInfoViewModel(viewModelNode);


                    var fromToRelationships =
                        modelNode.Relationships.FindRelationships(MapManager.RelationshipTypes["FromToRelationship"]);
                    var transclusionRelationships =
                        modelNode.Relationships.FindRelationships(
                            MapManager.RelationshipTypes["TransclusionFromToRelationship"]);

                    foreach (
                        KeyValuePair <Proxy.ConnectionType, Proxy.IRelationship> modelRelationshipPair in
                        fromToRelationships)
                    {
                        var viewModelRelationship = new Relationship();
                        viewModelRelationship.LoadRelationship(modelRelationshipPair.Value);

                        modelChangedRelationshipsEventArgs.Relationships.Add(
                            new KeyValuePair <Relationship, ModelOperationType>(viewModelRelationship,
                                                                                ModelOperationType.New));
                    }

                    foreach (
                        KeyValuePair <Proxy.ConnectionType, Proxy.IRelationship> transclusionRelationshipPair in
                        transclusionRelationships)
                    {
                        var nodes =
                            transclusionRelationshipPair.Value.Nodes.FindNodes(
                                MapManager.ConnectionTypes["TransclusionMap"]);

                        if (nodes != null)
                        {
                            foreach (Proxy.INode node in nodes)
                            {
                                if (node.Id == Context.Proxy.Id)
                                {
                                    var viewModelRelationship = new Relationship();
                                    viewModelRelationship.LoadRelationship(transclusionRelationshipPair.Value);

                                    modelChangedRelationshipsEventArgs.Relationships.Add(
                                        new KeyValuePair <Relationship, ModelOperationType>(viewModelRelationship,
                                                                                            ModelOperationType.New));
                                    break;
                                }
                            }
                        }
                    }

                    modelChangedNodesEventArgs.Nodes.Add(new KeyValuePair <Node, ModelOperationType>(viewModelNode,
                                                                                                     ModelOperationType.New));


                    ActiveModel.Nodes[viewModelNode.Id] = viewModelNode;
                }
            }

            ModelChanged(this, modelChangedNodesEventArgs);
            ModelChanged(this, modelChangedRelationshipsEventArgs);
            if (MapLoadCompleted != null)
            {
                MapLoadCompleted(this, new EventArgs());
            }
        }
Esempio n. 18
0
        private void OnQueryMapCompleted(object sender, Service.QueryMapCompletedEventArgs e)
        {
            if (e != null && e.Result != null)
            {
                e.Result.DecompressResponse();
            }

            Proxy.NodesEventArgs eventArgs = new Proxy.NodesEventArgs();

            Service.QueryResponse soapServiceQueryResponse = e.Result;
            QueryMapResponseStateInfo callerInfo = e.UserState as QueryMapResponseStateInfo;

            if (soapServiceQueryResponse.FinalObjectIndex <= 0)
            {
                ServerObjects.QueryResponse soQueryResponse = ServerObjectConverter.ToQueryResponse(soapServiceQueryResponse);

                Graph.NodesAndRelationshipBuildEventArgs(eventArgs, soQueryResponse.Nodes, soQueryResponse.Relationships);

                if (e.Result.NodeContext != null)
                {
                    Proxy.INode context = eventArgs.Nodes[e.Result.NodeContext.N];

                    if (callerInfo.ResponseType == QueryMapResponseStateType.ById)
                    {
                        QueryMapByIdCompleted.FireEvent(context.Id, this, eventArgs);
                    }
                    else if (callerInfo.ResponseType == QueryMapResponseStateType.ByNode)
                    {
                        QueryMapByNodeCompleted.FireEvent(context, this, eventArgs);
                    }
                }
                else
                {
                    /// TODO: Need to find a nicer way of handling this exception rather than just ignoring it altogether.
                    //throw new NodeNotFoundException("The given node wasn't found");
                }
            }
            else
            {
                Service.QueryResponse aggregatedResponse = new Service.QueryResponse();

                aggregatedResponse.Domain = soapServiceQueryResponse.Domain;
                aggregatedResponse.NodeContext = soapServiceQueryResponse.NodeContext;

                aggregatedResponse.Nodes = new Dictionary<Guid, Service.NO>();
                aggregatedResponse.Relationships = new Dictionary<Guid, Service.RE>();

                foreach (KeyValuePair<Guid, Service.NO> nodePair in soapServiceQueryResponse.Nodes)
                {
                    aggregatedResponse.Nodes[nodePair.Key] = nodePair.Value;
                }

                foreach (KeyValuePair<Guid, Service.RE> relationshipPair in soapServiceQueryResponse.Relationships)
                {
                    aggregatedResponse.Relationships[relationshipPair.Key] = relationshipPair.Value;
                }

                //ServiceProxy.QueryMapPagedCompleted += OnQueryMapByIdPagedCompleted;
                QueryMapResponseStateInfo info = new QueryMapResponseStateInfo();
                info.AggregatedResponse = aggregatedResponse;
                info.ResponseType = callerInfo.ResponseType;
                ServiceProxy.QueryMapPagedAsync(System.Windows.Browser.HtmlPage.Document.DocumentUri.ToString(), aggregatedResponse.Domain.DomainUid, aggregatedResponse.NodeContext.N, 1, null, null, soapServiceQueryResponse.LastObjectIndex + 1, info);
            }
        }
Esempio n. 19
0
 private void OnQueryMapCompleted(object sender, TransactionalNodeService.Proxy.NodesEventArgs e)
 {
     Preloader.InitialiseControllers();
     QueryCompleted(e);
 }
Esempio n. 20
0
        private void OnQueryMapCompleted(object sender, Service.QueryMapCompletedEventArgs e)
        {
            if (e != null && e.Result != null)
            {
                e.Result.DecompressResponse();
            }

            Proxy.NodesEventArgs eventArgs = new Proxy.NodesEventArgs();

            Service.QueryResponse     soapServiceQueryResponse = e.Result;
            QueryMapResponseStateInfo callerInfo = e.UserState as QueryMapResponseStateInfo;

            if (soapServiceQueryResponse.FinalObjectIndex <= 0)
            {
                ServerObjects.QueryResponse soQueryResponse = ServerObjectConverter.ToQueryResponse(soapServiceQueryResponse);

                Graph.NodesAndRelationshipBuildEventArgs(eventArgs, soQueryResponse.Nodes, soQueryResponse.Relationships);

                if (e.Result.NodeContext != null)
                {
                    Proxy.INode context = eventArgs.Nodes[e.Result.NodeContext.N];

                    if (callerInfo.ResponseType == QueryMapResponseStateType.ById)
                    {
                        QueryMapByIdCompleted.FireEvent(context.Id, this, eventArgs);
                    }
                    else if (callerInfo.ResponseType == QueryMapResponseStateType.ByNode)
                    {
                        QueryMapByNodeCompleted.FireEvent(context, this, eventArgs);
                    }
                }
                else
                {
                    /// TODO: Need to find a nicer way of handling this exception rather than just ignoring it altogether.
                    //throw new NodeNotFoundException("The given node wasn't found");
                }
            }
            else
            {
                Service.QueryResponse aggregatedResponse = new Service.QueryResponse();

                aggregatedResponse.Domain      = soapServiceQueryResponse.Domain;
                aggregatedResponse.NodeContext = soapServiceQueryResponse.NodeContext;

                aggregatedResponse.Nodes         = new Dictionary <Guid, Service.NO>();
                aggregatedResponse.Relationships = new Dictionary <Guid, Service.RE>();

                foreach (KeyValuePair <Guid, Service.NO> nodePair in soapServiceQueryResponse.Nodes)
                {
                    aggregatedResponse.Nodes[nodePair.Key] = nodePair.Value;
                }

                foreach (KeyValuePair <Guid, Service.RE> relationshipPair in soapServiceQueryResponse.Relationships)
                {
                    aggregatedResponse.Relationships[relationshipPair.Key] = relationshipPair.Value;
                }

                //ServiceProxy.QueryMapPagedCompleted += OnQueryMapByIdPagedCompleted;
                QueryMapResponseStateInfo info = new QueryMapResponseStateInfo();
                info.AggregatedResponse = aggregatedResponse;
                info.ResponseType       = callerInfo.ResponseType;
                ServiceProxy.QueryMapPagedAsync(System.Windows.Browser.HtmlPage.Document.DocumentUri.ToString(), aggregatedResponse.Domain.DomainUid, aggregatedResponse.NodeContext.N, 1, null, null, soapServiceQueryResponse.LastObjectIndex + 1, info);
            }
        }
Esempio n. 21
0
 public virtual void QueryCompleted(TransactionalNodeService.Proxy.NodesEventArgs e)
 {
 }
Esempio n. 22
0
        void OnCreateRootMapCompleted(object sender, Service.CreateRootMapCompletedEventArgs e)
        {
            if (CreateRootMapCompleted != null)
            {
                Proxy.NodesEventArgs eventArgs = new Proxy.NodesEventArgs();
                ServerObjects.QueryResponse soQueryResponse = ServerObjectConverter.ToQueryResponse(e.Result);

                Graph.NodesAndRelationshipBuildEventArgs(eventArgs, soQueryResponse.Nodes, soQueryResponse.Relationships);

                CreateRootMapCompleted.FireEvent(this, eventArgs);
            }
        }
Esempio n. 23
0
        private void OnQueryMapByDomainCompleted(object sender, Service.QueryMapByDomainCompletedEventArgs e)
        {
            if (e != null && e.Result != null)
            {
                e.Result.DecompressResponse();
            }

            if (QueryMapByDomainCompleted != null)
            {
                Proxy.NodesEventArgs eventArgs = new Proxy.NodesEventArgs();
                ServerObjects.QueryResponse soQueryResponse = ServerObjectConverter.ToQueryResponse(e.Result);

                Graph.NodesAndRelationshipBuildEventArgs(eventArgs, soQueryResponse.Nodes, soQueryResponse.Relationships);

                Proxy.INode nodeContext = Graph.FindNode(soQueryResponse.NodeContext);

                QueryMapByDomainCompleted.FireEvent(nodeContext.DomainId, this, eventArgs);
            }
        }
Esempio n. 24
0
        private void OnQueryMapPagedCompleted(object sender, Service.QueryMapPagedCompletedEventArgs e)
        {
            if (e != null && e.Result != null)
            {
                e.Result.DecompressResponse();
            }

            //ServiceProxy.QueryMapPagedCompleted -= OnQueryMapByIdPagedCompleted;
            Service.QueryResponse queryResponse = e.Result;

            QueryMapResponseStateInfo callerInfo = e.UserState as QueryMapResponseStateInfo;

            Service.QueryResponse aggregatedResponse = callerInfo.AggregatedResponse;//e.UserState as Service.QueryResponse;

            if (aggregatedResponse == null)
            {
                aggregatedResponse.Domain = queryResponse.Domain;
                aggregatedResponse.NodeContext = queryResponse.NodeContext;

                aggregatedResponse.Nodes = new Dictionary<Guid, Service.NO>();
                aggregatedResponse.Relationships = new Dictionary<Guid, Service.RE>();
            }

            foreach (KeyValuePair<Guid, Service.NO> nodePair in queryResponse.Nodes)
            {
                aggregatedResponse.Nodes[nodePair.Key] = nodePair.Value;
            }

            foreach (KeyValuePair<Guid, Service.RE> relationshipPair in queryResponse.Relationships)
            {
                aggregatedResponse.Relationships[relationshipPair.Key] = relationshipPair.Value;
            }

            if (queryResponse.LastObjectIndex >= queryResponse.FinalObjectIndex)
            {
                ServerObjects.QueryResponse soAggregatedResponse = ServerObjectConverter.ToQueryResponse(aggregatedResponse);

                Proxy.NodesEventArgs eventArgs = new Proxy.NodesEventArgs();

                Graph.NodesAndRelationshipBuildEventArgs(eventArgs, soAggregatedResponse.Nodes, soAggregatedResponse.Relationships);

                Proxy.INode context = eventArgs.Nodes[e.Result.NodeContext.N];

                if (callerInfo.ResponseType == QueryMapResponseStateType.ById)
                {
                    QueryMapByIdCompleted.FireEvent(context.Id, this, eventArgs);
                }
                else if (callerInfo.ResponseType == QueryMapResponseStateType.ByNode)
                {
                    QueryMapByNodeCompleted.FireEvent(context, this, eventArgs);
                }
            }
            else
            {
                QueryMapResponseStateInfo info = new QueryMapResponseStateInfo();
                info.AggregatedResponse = aggregatedResponse;
                info.ResponseType = callerInfo.ResponseType;
                ServiceProxy.QueryMapPagedAsync(System.Windows.Browser.HtmlPage.Document.DocumentUri.ToString(), aggregatedResponse.Domain.DomainUid, aggregatedResponse.NodeContext.N, 1, null, null, queryResponse.LastObjectIndex + 1, info);
            }
        }
Esempio n. 25
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);
        }
Esempio n. 26
0
        private void OnQueryDomainsCompleted(object sender, Service.QueryDomainsCompletedEventArgs e)
        {
            Proxy.NodesEventArgs eventArgs = new Proxy.NodesEventArgs();

            foreach (Service.QueryResponse soapServiceQueryResponse in e.Result.Values)
            {
                ServerObjects.QueryResponse soQueryResponse = ServerObjectConverter.ToQueryResponse(soapServiceQueryResponse);

                Graph.NodesAndRelationshipBuildEventArgs(eventArgs, soQueryResponse.Nodes, soQueryResponse.Relationships);
            }

            QueryDomainsCompleted.FireEvent(this, eventArgs);
        }