コード例 #1
0
        private Page(Session client, Target target, FrameTree frameTree, bool ignoreHTTPSErrors, TaskQueue screenshotTaskQueue)
        {
            _client           = client;
            _target           = target;
            Keyboard          = new Keyboard(client);
            _mouse            = new Mouse(client, Keyboard);
            Touchscreen       = new Touchscreen(client, Keyboard);
            _frameManager     = new FrameManager(client, frameTree, this);
            _networkManager   = new NetworkManager(client, _frameManager);
            _emulationManager = new EmulationManager(client);
            Tracing           = new Tracing(client);
            _pageBindings     = new Dictionary <string, Func <object> >();

            _ignoreHTTPSErrors = ignoreHTTPSErrors;

            _screenshotTaskQueue = screenshotTaskQueue;

            //TODO: Do we need this bubble?
            _frameManager.FrameAttached  += (sender, e) => FrameAttached?.Invoke(this, e);
            _frameManager.FrameDetached  += (sender, e) => FrameDetached?.Invoke(this, e);
            _frameManager.FrameNavigated += (sender, e) => FrameNavigated?.Invoke(this, e);

            _networkManager.RequestCreated  += (sender, e) => RequestCreated?.Invoke(this, e);
            _networkManager.RequestFailed   += (sender, e) => RequestFailed?.Invoke(this, e);
            _networkManager.ResponseCreated += (sender, e) => ResponseCreated?.Invoke(this, e);
            _networkManager.RequestFinished += (sender, e) => RequestFinished?.Invoke(this, e);

            _client.MessageReceived += client_MessageReceived;
        }
コード例 #2
0
        public IActionResult InsertComment(CommentDTO commentDto)
        {
            ResponseCreated <CommentDTO> responseSingleObject = new ResponseCreated <CommentDTO>()
            {
                Status      = StatusCodes.Status500InternalServerError,
                Errors      = null,
                Message     = null,
                Succeded    = false,
                Value       = null,
                LocationUri = null
            };

            try
            {
                int idCreated = _bllManager.InsertComment(commentDto);
                responseSingleObject.Status   = StatusCodes.Status201Created;
                responseSingleObject.Succeded = true;
                string baseUrl     = $"{HttpContext.Request.Scheme}://{HttpContext.Request.Host.ToUriComponent()}";
                string locationUri = baseUrl + "/" + ApiRoute.Comments.GetCommentFromId.Replace("{id}", idCreated.ToString());
            }
            catch (Exception e)
            {
                responseSingleObject.Errors =
                    "InsertComment() EXCEPTION : " + e.ToString();
            }

            return(StatusCode(responseSingleObject.Status, responseSingleObject));
        }
コード例 #3
0
        private void OnResponseReceived(MessageEventArgs e)
        {
            // FileUpload sends a response without a matching request.
            if (_requestIdToRequest.ContainsKey(e.MessageData.requestId.ToString()))
            {
                var request  = _requestIdToRequest[e.MessageData.requestId.ToString()];
                var response = new Response(
                    _client,
                    request,
                    (HttpStatusCode)e.MessageData.response.status,
                    ((JObject)e.MessageData.response.headers).ToObject <Dictionary <string, object> >(),
                    e.MessageData.response.securityDetails?.ToObject <SecurityDetails>());

                request.Response = response;

                ResponseCreated?.Invoke(this, new ResponseCreatedEventArgs
                {
                    Response = response
                });
            }
        }