DotNetDev
DotNetDev

Reputation: 215

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

Upvotes: 3

Views: 461

Answers (3)

DotNetDev
DotNetDev

Reputation: 215

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;
                }
           }

Upvotes: 1

Vladyslav Tsvek
Vladyslav Tsvek

Reputation: 259

This feature was implemented and is present in DotNetBrowser 1.9: https://dotnetbrowser.support.teamdev.com/support/solutions/articles/9000112125-listening-to-touch-gesture-events

Upvotes: -1

Anna Dolbina
Anna Dolbina

Reputation: 1110

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.

Upvotes: 2

Related Questions