3

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

DotNetDev
  • 205
  • 1
  • 10

3 Answers3

2

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.

Anna Dolbina
  • 1
  • 1
  • 8
  • 9
1

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;
                }
           }
DotNetDev
  • 205
  • 1
  • 10
-1

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

Vladyslav Tsvek
  • 244
  • 1
  • 10
  • Please don't post link only answers. links are susceptible to link rot when the link is moved or removed. Please add the full code and solution in your answer – Tschallacka Jan 16 '18 at 09:25