コード例 #1
0
ファイル: Input.cs プロジェクト: xush1611/CefSharp
        /// <summary>
        /// Emulates touch event from the mouse event parameters.
        /// </summary>
        /// <param name = "type">Type of the mouse event.</param>
        /// <param name = "x">X coordinate of the mouse pointer in DIP.</param>
        /// <param name = "y">Y coordinate of the mouse pointer in DIP.</param>
        /// <param name = "button">Mouse button. Only "none", "left", "right" are supported.</param>
        /// <param name = "timestamp">Time at which the event occurred (default: current time).</param>
        /// <param name = "deltaX">X delta in DIP for mouse wheel event (default: 0).</param>
        /// <param name = "deltaY">Y delta in DIP for mouse wheel event (default: 0).</param>
        /// <param name = "modifiers">Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8(default: 0).</param>
        /// <param name = "clickCount">Number of times the mouse button was clicked (default: 0).</param>
        /// <returns>returns System.Threading.Tasks.Task&lt;DevToolsMethodResponse&gt;</returns>
        public async System.Threading.Tasks.Task <DevToolsMethodResponse> EmulateTouchFromMouseEventAsync(string type, int x, int y, CefSharp.DevTools.Input.MouseButton button, long?timestamp = null, long?deltaX = null, long?deltaY = null, int?modifiers = null, int?clickCount = null)
        {
            ValidateEmulateTouchFromMouseEvent(type, x, y, button, timestamp, deltaX, deltaY, modifiers, clickCount);
            var dict = new System.Collections.Generic.Dictionary <string, object>();

            dict.Add("type", type);
            dict.Add("x", x);
            dict.Add("y", y);
            dict.Add("button", this.EnumToString(button));
            if (timestamp.HasValue)
            {
                dict.Add("timestamp", timestamp.Value);
            }

            if (deltaX.HasValue)
            {
                dict.Add("deltaX", deltaX.Value);
            }

            if (deltaY.HasValue)
            {
                dict.Add("deltaY", deltaY.Value);
            }

            if (modifiers.HasValue)
            {
                dict.Add("modifiers", modifiers.Value);
            }

            if (clickCount.HasValue)
            {
                dict.Add("clickCount", clickCount.Value);
            }

            var methodResult = await _client.ExecuteDevToolsMethodAsync("Input.emulateTouchFromMouseEvent", dict);

            return(methodResult);
        }
コード例 #2
0
ファイル: Input.cs プロジェクト: xush1611/CefSharp
 partial void ValidateEmulateTouchFromMouseEvent(string type, int x, int y, CefSharp.DevTools.Input.MouseButton button, long?timestamp = null, long?deltaX = null, long?deltaY = null, int?modifiers = null, int?clickCount = null);