コード例 #1
0
ファイル: SoapMapManager.cs プロジェクト: chris-tomich/Glyma
        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);
            }
        }
コード例 #2
0
ファイル: SoapMapManager.cs プロジェクト: chris-tomich/Glyma
        public void QueryMapByNodeAsync(Proxy.INode node, int depth)
        {
            QueryMapResponseStateInfo responseStateInfo = new QueryMapResponseStateInfo();

            responseStateInfo.ResponseType = QueryMapResponseStateType.ByNode;

            ServiceProxy.QueryMapAsync(System.Windows.Browser.HtmlPage.Document.DocumentUri.ToString(), node.DomainId, node.Id, depth, null, null, responseStateInfo);
        }
コード例 #3
0
ファイル: SoapMapManager.cs プロジェクト: chris-tomich/Glyma
        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);
            }
        }
コード例 #4
0
ファイル: SoapMapManager.cs プロジェクト: chris-tomich/Glyma
        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);
            }
        }
コード例 #5
0
ファイル: SoapMapManager.cs プロジェクト: chris-tomich/Glyma
        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);
            }
        }
コード例 #6
0
ファイル: SoapMapManager.cs プロジェクト: chris-tomich/Glyma
        public void QueryMapByNodeAsync(Proxy.INode node, int depth)
        {
            QueryMapResponseStateInfo responseStateInfo = new QueryMapResponseStateInfo();
            responseStateInfo.ResponseType = QueryMapResponseStateType.ByNode;

            ServiceProxy.QueryMapAsync(System.Windows.Browser.HtmlPage.Document.DocumentUri.ToString(), node.DomainId, node.Id, depth, null, null, responseStateInfo);
        }