コード例 #1
0
        protected async Task <ReqResult> BaseLogic(Task <HttpResponseMessage> request)
        {
            try
            {
                var result = await request;

                if (!result.IsSuccessStatusCode)
                {
                    return(ReqResult.Failed(await result.Content.ReadAsStringAsync()));
                }

                var netres = JsonConvert.DeserializeObject <ReqResult>(await result.Content.ReadAsStringAsync());

                if (netres == null)
                {
                    return(ReqResult.Failed());
                }
                else
                {
                    return(netres);
                }
            }
            catch (Exception)
            {
                return(ReqResult.Failed());
            }
        }
コード例 #2
0
        public async Task <ReqResult> OpenBrowser()
        {
            try
            {
                if (_driver == null)
                {
                    Setup();
                }

                _driver.Manage().Window.Maximize();

                _driver.Url = bing;

                return(ReqResult.Success());
            }
            catch (Exception)
            {
                return(ReqResult.Failed());
            }
        }