- 20/08/2019 at 11:48 #11895
I have quite a complex XAML layout I have working with Tobii in a WPF project. I now want to embed this into a legacy winforms app, which uses the EyeFrameX library to handle eye-gaze on some buttons.
I’m hitting some issues with this.
I feel I have 3 options
1 – Integrate a tobii-example WPF and then embed this into my winform using elementhost (but then i’ll have multiple Tobii DLLs?)
2 – Create a ‘dumb’ xaml layout, then via elementhost, grab the Paths from the usercontrol in my windows form load method then add these elements (potential xaml Path type casting issue?)
3 – Embed the form into the WPF, but again this could result in multiple DLL loading.
I’d love some insight on this as i’m doing a really cool accessibility project!
Thanks in advance
Robin21/08/2019 at 21:27 #11918
Hi @flyingrobin and thanks for your query. Unfortunately, this is a rather unique scenario for which we have no official advice to provide I am afraid.
Multiple DLL’s would seem the simplest route but we could not guarantee normal operability with such an untested environment.
Therefore, we would recommend at this stage method (1) which would likely be the quickest to implement and you can test how the program runs.
Apologies we cannot provide more advice in this regard, but if you would care to do some testing on the various scenarious we would be happy to try and help out should you come across specific errors. Thanks for your understanding.22/08/2019 at 00:31 #11919
I’m exploring using a new WPF project then loading in the class functionality I need from the forms app.
Anything I learn I shall post on here!
In the mean time, I’ve just started another thread about Path gaze….
Robin23/08/2019 at 10:43 #11929
Great! Thanks for letting us know and looking forward to any tips you might choose to share here.28/08/2019 at 19:16 #11946
I’ve actually gone back to exploring how to possibly combine gaze-aware WPF within gaze-aware WinForm.
If i can get both working, we can methodically replace the form controls over time with WPF ones. The app is quite large and a complete view layer re-write is something of a task.
I can embed a WPF control (which references the Tobii eyex in the xaml header) into a Gaze-Aware WinForms project, however it is not picking up any of the events. I’ve tried instantiating a new WpfEyeXHost in my Program.cs along with my FormsEyeXhost but no luck.
Usually in a WPF project i’d instantiate a new WpfEyeXHost from app.cs as usual, however (as far as i’m aware) its only possible to add a WPF UserControl in an elementhost.
Any clues on how i could instantiate both EyeX hosts simultaneously from WinForms to see what happens?
or is WpfEyeXHost only going to run if it’s in a WPF App class?
Robin30/08/2019 at 00:44 #11955Sai PrasadParticipant
I’m working with @flyingrobin on this one. We took MainWindow.xaml and MainWindow.xaml.cs from the Tobii WpfSample project “GazeAwareElements” and converted it into a Wpf UserControl. We then did the following:
1. Embedded the Wpf UserControl into into a WinForm. None of the Gaze events triggered.
2. Embedded the Wpf UserControl (without making any code changes) into a Wpf Form. All the Gaze events triggered.
Case #2 proves that the Wpf UserControl is working correctly. Then, why aren’t the Gaze events triggering when it is embedded into a WinForm? In both cases, we are initializing and starting WpfEyeXHost inside the constructor of the Wpf UserControl.
We also tried explicitly adding a Gaze handler for the UserControl as below:
EyeXFramework.Wpf.Behavior.AddHasGazeChangedHandler(this, new RoutedEventHandler(handler));
So when the gaze falls on the control, the event should trigger. It does, when the control is hosted in a Wpf form. But doesn’t trigger when it is hosted in a WinForm.30/08/2019 at 15:45 #11960
Hi @sprasad1 thanks for your additional feedback. I am afraid The Tobii Core SDK only has supported bindings for WPF, whilst only the older EyeX SDK supported Winforms. Accordingly, I am afraid that you will need to keep the setup using only WPF which we hope is a workaround you can maintain.
Apologies for any inconvenience.30/08/2019 at 17:55 #11961Sai PrasadParticipant
Thanks for your response. Just to clarify, we are only using the Tobii Core SDK in both cases. In fact, the WinForm app doesn’t even link to the older EyeX SDK. It’s just a window hosting the Wpf UserControl. In both cases, the Wpf UserControl only links with the Tobii Core SDK. The only difference is: In case #1, the Wpf UserControl is embedded in a WinForm and in case #2, it is embedded in a Wpf form. The gaze events don’t trigger in Case #1 and they do in case #2.30/08/2019 at 18:01 #11962
Thanks for the clarification, but even if using only the Core SDK, still I am afraid that using the WinForms technology is not a supported platform, even if it’s nesting a WPF form, so I am afraid we cannot guarantee functionality under that paradigm. Hopefully this is not overly inconvenient for you.
- You must be logged in to reply to this topic.