示例#1
0
        public async Task <WatchResponse> WatchAsync(WatcherParameter parameter)
        {
            var response = new WatchResponse();

            using (var connection = new SqlConnection(parameter.Values["ConnectionString"]))
            {
                try
                {
                    await connection.OpenAsync();

                    response.Success = true;
                }
                catch (Exception ex)
                {
                    response.Message    = ex.Message;
                    response.StackTrace = ex.ToString();
                }
            }

            return(response);
        }
示例#2
0
        public async Task <WatchResponse> WatchAsync(WatcherParameter parameter)
        {
            var response = new WatchResponse();

            try
            {
                using (var httpClient = new HttpClient())
                {
                    await httpClient.GetAsync(parameter.Values["Url"]);

                    response.Success = true;
                }
            }
            catch (Exception ex)
            {
                response.Message    = ex.Message;
                response.StackTrace = ex.ToString();
            }

            return(response);
        }