Пример #1
0
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public bool Execute()
        {
            var httpClient = new HttpClient();
            var result = httpClient.GetAsync(BlockServiceUrl);
            result.Wait();

            if (!result.Result.IsSuccessStatusCode)
            {
                _log.Warning(result.Result?.Content?.ReadAsStringAsync().Result ?? "Empty content");
                _log.Error("Block service faulted");

                httpClient.Dispose();
                return false;
            }

            _log.Success(result.Result?.Content?.ReadAsStringAsync().Result ?? "Empty content");
            _log.Information("Waiting 3 seconds");
            httpClient.Dispose();

            Thread.Sleep(3000);
            _log.Information("Waiting 3 seconds finished");
            _log.Information("Block service finished");

            return true;
        }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public bool Execute()
        {
            var httpClient = new HttpClient();
            var result     = httpClient.GetAsync(UnlockServiceUrl);

            result.Wait();

            if (!result.Result.IsSuccessStatusCode)
            {
                _log.Warning(result.Result?.Content?.ReadAsStringAsync().Result ?? "Empty content");
                _log.Error("Unlock service faulted");

                httpClient.Dispose();
                return(false);
            }

            _log.Success(result.Result?.Content?.ReadAsStringAsync().Result ?? "Empty content");
            _log.Information("Unlock service finished");

            httpClient.Dispose();
            return(true);
        }