示例#1
0
        private void tryGetResourceForAgsCandidateUrl(Queue <string> candidateUrls, string proxyUrl, Filter filter, object userState)
        {
            if (candidateUrls == null || candidateUrls.Count < 1)
            {
                OnGetCatalogFailed(new ExceptionEventArgs(new Exception(Strings.ExceptionDoneTryingallCandidateURLs), userState));
                return;
            }
            string agsRestUrl = candidateUrls.Dequeue();

            server = new Server(agsRestUrl, proxyUrl)
            {
                Filter = filter
            };
            server.GetCatalogCompleted += (o, e) =>
            {
                OnGetCatalogCompleted(new GetCatalogCompletedEventArgs()
                {
                    ChildResources = e.ChildResources, UserState = e.UserState
                });
            };
            server.GetCatalogFailed += (o, e) =>
            {
                tryGetResourceForAgsCandidateUrl(candidateUrls, proxyUrl, filter, userState);
            };
            server.GetCatalog(userState);
        }
示例#2
0
        /// <summary>
        /// Retrieve the list of resources provided by the server
        /// </summary>
        public override void GetCatalog(string connectionString, string proxyUrl, Filter filter, object userState)
        {
            // Based on the input URL, get the list of URLs that might be the server endpoint
            Queue <string> candidateUrls = getCandidateUrls(connectionString);

            if (server == null || !candidateUrls.Contains(server.Uri))
            {
                // Try the URLs
                tryGetResourceForAgsCandidateUrl(candidateUrls, proxyUrl, filter, userState);
            }
            else
            {
                // The server URL is already one of the candidates, so assume this is the correct one
                server.Filter = filter;
                server.GetCatalogCompleted += (o, e) =>
                {
                    OnGetCatalogCompleted(new GetCatalogCompletedEventArgs()
                    {
                        ChildResources = e.ChildResources, UserState = e.UserState
                    });
                };
                server.GetCatalogFailed += (o, e) =>
                {
                    OnGetCatalogFailed(new ExceptionEventArgs(new Exception(Strings.ExceptionDoneTryingallCandidateURLs), userState));
                };
                server.GetCatalog(userState);
            }
        }
示例#3
0
 private void getChildResourcesForServer(Resource parentResource, Filter filter, object userState)
 {
     server = new Server(parentResource.Url, parentResource.ProxyUrl)
     {
         Filter = filter
     };
     server.GetCatalogCompleted += (o, e) =>
     {
         OnGetChildResourcesCompleted(new GetChildResourcesCompletedEventArgs()
         {
             ChildResources = e.ChildResources, UserState = e.UserState
         });
     };
     server.GetCatalogFailed += (o, e) =>
     {
         OnGetChildResourcesFailed(e);
     };
     server.GetCatalog(userState);
 }
 private void tryGetResourceForAgsCandidateUrl(Queue<string> candidateUrls, string proxyUrl, Filter filter, object userState)
 {
     if (candidateUrls == null || candidateUrls.Count < 1)
     {
         OnGetCatalogFailed(new ExceptionEventArgs(new Exception(Strings.ExceptionDoneTryingallCandidateURLs), userState));
         return;
     }
     string agsRestUrl = candidateUrls.Dequeue();
     server = new Server(agsRestUrl, proxyUrl) { Filter = filter };
     server.GetCatalogCompleted += (o, e) =>
     {
         OnGetCatalogCompleted(new GetCatalogCompletedEventArgs() { ChildResources = e.ChildResources, UserState = e.UserState });
     };
     server.GetCatalogFailed += (o, e) =>
     {
         tryGetResourceForAgsCandidateUrl(candidateUrls, proxyUrl, filter, userState);
     };
     server.GetCatalog(userState);
 }
 private void getChildResourcesForServer(Resource parentResource, Filter filter, object userState)
 {
     server = new Server(parentResource.Url, parentResource.ProxyUrl) { Filter = filter };
     server.GetCatalogCompleted += (o, e) =>
     {
         OnGetChildResourcesCompleted(new GetChildResourcesCompletedEventArgs() { ChildResources = e.ChildResources, UserState = e.UserState });
     };
     server.GetCatalogFailed += (o, e) =>
     {
         OnGetChildResourcesFailed(e);
     };
     server.GetCatalog(userState);
 }