简体   繁体   中英

dotnetbrowser touch events in heavyweight mode not passed to wpf

I'm currently developing and Wpf-Application with DotNetBrowser library.

So the target is a kiosk software.

I do have to use the BrowserType.HEAVYWEIGHT type cause our webapp which is loaded with the control only works correctly with this type. On lightweight mode I capture the touch events but then also events are triggered while swyping our webapp. But back to the problem:

<code>
    Browser browser = BrowserFactory.Create(BrowserContext.DefaultContext,     BrowserType.HEAVYWEIGHT);    
     m_BrowserView = new WPFBrowserView(browser);
</code>

I do have two touch event handlers

<code>
    private void OnTouchUp(object sender, TouchEventArgs e)
    {
        Console.WriteLine("Touch up");
        base.OnTouchUp(e);
    }</code>

and

<code>
    private void OnTouchDown(object sender, TouchEventArgs e)
    {
        Console.WriteLine("Touch down");
        base.OnTouchDown(e);
    }
</code>

I registered those two methods on the constructor of the MainWindow neither

<code>
    TouchUp += OnTouchUp;  
    TouchDown += OnTouchDown;  
</code>  

nor

<code>    
    m_BrowserView.TouchUp += OnTouchUp;
    m_BrowserView.TouchDown += OnTouchDown;
</code>

forced the application to enter my touch methods

DotNetBrowser: 1.8.4 WPF: 4.5.2 OS: Windows 10

The heavyweight rendering mode implies embedding a native window into your application. As a result, all user input is captured by this window first and the events are not triggered in the .NET application automatically.

To implement these events for the controls working in the heavyweight rendering mode, DotNetBrowser intercepts these events for Chromium and notifies the .NET side. This is already done for mouse and key events in DotNetBrowser, but not for the touch events.

If the presence of these events is critical for you — please contact DotNetBrowser support via email and request this feature. It won't take much time to implement it.

I solved via this approach as the pipeline for longtap is LONG_PRESS, TAP_CANCEL, LONG_TAP

browser.GestureEvent += (sender, args) =>
            {
                m_Gesture.Add(args.GestureType);
                if (args.GestureType == GestureType.LONG_PRESS)
                {
                    //// prepare the main action
                }

                if (args.GestureType == GestureType.LONG_TAP)
                {
                    ////do the main action;
                }
           }

此功能已实施并存在于DotNetBrowser 1.9中: https ://dotnetbrowser.support.teamdev.com/support/solutions/articles/9000112125-listening-to-touch-gesture-events

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM