示例#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);
        }
示例#3
0
 /// <summary>
 ///
 /// </summary>
 private void ShowError()
 {
     _log.Information(string.Empty);
     _log.Error("Publish failed");
 }
示例#4
0
文件: CmdTask.cs 项目: Bunyod545/Jobs
 /// <summary>
 ///
 /// </summary>
 private void ShowError()
 {
     _log.Information(string.Empty);
     _log.Error("Cmd execute failed");
 }