Пример #1
0
        public async Task Register(string url)
        {
            try
            {
                var sc            = new SwaggerClient();
                var apiDefinition = await sc.GetApiDefinition(url);

                _syncContext.Post(delegate(object state)
                {
                    Api = apiDefinition;
                    Url = url;
                    AfterLoaded(url, apiDefinition);
                }, null);
            }
            catch (Exception e)
            {
                if (e.InnerException != null)
                {
                    var httpException = e.InnerException as WebException;
                    if (httpException != null && httpException.Status == WebExceptionStatus.ConnectFailure)
                    {
                        ApiLoadStatusStatic.Status = ApiLoadStatus.ConnectionFailure;
                        _syncContext.Post(delegate(object state)
                        {
                            AfterLoadedError(url);
                        }, null);
                        return;
                    }
                }
                RibbonController.InvalidateRibbon();
            }
        }
Пример #2
0
 public SwaggerRegistry(SwaggerClient client)
 {
     _client  = client;
     Instance = this;
 }