Esempio n. 1
0
        FindResponse Find(FindCriteria criteria)
        {
            var req = new MessageContractsCD1.FindRequest()
            {
                Body = new FindCriteriaCD1(criteria)
            };

            Channel.BeginFind(req, delegate(IAsyncResult result) {
                Channel.EndFind(result);
            }, null);

            var timeout = InnerChannel.OperationTimeout < criteria.Duration ? InnerChannel.OperationTimeout : criteria.Duration;

            if (!reply_find_handle.WaitOne(timeout))
            {
                throw new EndpointNotFoundException("The discovery client could not receive Find operation response within the operation timeout.");
            }
            try {
                var ir  = find_completed();
                var ret = new FindResponse();
                foreach (var fr in ir.Body)
                {
                    ret.Endpoints.Add(fr.ToEndpointDiscoveryMetadata());
                }
                return(ret);
            } finally {
                find_completed = null;
            }
        }
        public IAsyncResult BeginFind(FindCriteria criteria, AsyncCallback callback, object state)
        {
            var req = new MessageContractsCD1.FindRequest()
            {
                Body = new FindCriteriaCD1(criteria)
            };

            return(Channel.BeginFind(req, callback, state));
        }