Integration of Calibration in WPF Desktop App doesn't work

Forum for C#/Windows development

Integration of Calibration in WPF Desktop App doesn't work

Postby laulau » 10 Aug 2015, 12:04

Hey,

i'm trying to implement a Calibration at the beginning of my WPF App.
The App has a Main Window (MyApp.xaml) and this window contains a frame which leads to a page (Calibration.xaml). I started the server before i started the App.
I also referenced TETControls.dll, TETCSharpClient.dll and Newtonsoft.Json
My project works with the .NET Framework 4.5.1

MyApp.xaml.cs looks like this:
Code: Select all
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using TETControls.Calibration;
using TETControls.Cursor;
using TETControls.TrackBox;
using TETCSharpClient;
using TETCSharpClient.Data;

namespace EyeTribe
{

    public partial class MyApp : Window, IGazeListener
    {
        public MyApp()
        {
            InitializeComponent();

            // Connect client
            GazeManager.Instance.Activate(GazeManager.ApiVersion.VERSION_1_0, GazeManager.ClientMode.Push);

            frmMainContent.Source = new Uri("Calibration.xaml", UriKind.Relative);
        }

        public void OnGazeUpdate(GazeData gazeData)
        {
            throw new NotImplementedException();
        }
    }
}


And my Calibration.xaml.cs (which should contain the Calibration) looks like this:
Code: Select all
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using TETControls;
using TETControls.Calibration;
using TETControls.Cursor;
using TETControls.TrackBox;
using TETCSharpClient.Data;
using TETCSharpClient;
using MessageBox = System.Windows.MessageBox;

namespace EyeTribe
{

    public partial class Calibration : Page
    {
        public Calibration()
        {
            InitializeComponent();
        }

        private void btnCalibrate_Click(object sender, RoutedEventArgs e)
        {
            CalibrationRunner calRunner = new CalibrationRunner();
            calRunner.OnResult += calRunner_OnResult;
            calRunner.Start();

        }

        private void calRunner_OnResult(object sender, CalibrationRunnerEventArgs e)
        {
            switch (e.Result)
            {
                case CalibrationRunnerResult.Success:
                    //MessageBox.Show(this, "Calibration success " + e.CalibrationResult.AverageErrorDegree);
                    break;

                case CalibrationRunnerResult.Abort:
                    //MessageBox.Show(this, "The calibration was aborted. Reason: " + e.Message);
                    break;

                case CalibrationRunnerResult.Error:
                    //MessageBox.Show(this, "An error occured during calibration. Reason: " + e.Message);
                    break;

                case CalibrationRunnerResult.Failure:
                    //MessageBox.Show(this, "Calibration failed. Reason: " + e.Message);
                    break;

                case CalibrationRunnerResult.Unknown:
                    //MessageBox.Show(this, "Calibration exited with unknown state. Reason: " + e.Message);
                    break;
            }
        }
       
    }
}



So I get errors while the app starts:
Exception while connecting to EyeTribe Server: TETCSharpClient.GazeApiManager.RequestTracker(ClientMode mode, ApiVersion version)
TETCSharpClient.GazeManager.HandleServerConnect(Object stateInfo)


and

Error initializing GazeManager, is EyeTribe Server running?


But I did start the server!


And as soon as I click on the Calibrate Button the Calibration starts, but the dot only moves once. It simply stops there and nothing happens (the dot remains at this point).

I get these errors:
Calling CalibrationStart(), but TET C# Client not activated!Calling CalibrationPointStart(), but TET C# Client not activated!"


Calling CalibrationPointEnd(), but TET C# Client not activated!Calling CalibrationAbort(), but TET C# Client not activated!


So what did I miss? I tried to follow the c# tutorial and looked at the samples, but I can't figure out a solution.
laulau
 
Posts: 5
Joined: 04 Aug 2015, 23:07

Re: Integration of Calibration in WPF Desktop App doesn't wo

Postby Martin » 10 Aug 2015, 12:56

It's a bit hard to see exactly why it fails to connect with the server. I would need the full exception message and/or stacktrace to diagnose.

It's often helpful to enable automatic breaking on error. In Visual Studio this is done under "Debug", "Exceptions..", check thrown on "Common Language Runtime Exceptions".

We have a minimal calibration sample available.

Also, note that you will have to add listeners for the interfaces (see sample).
Martin
 
Posts: 567
Joined: 29 Oct 2013, 15:20

Re: Integration of Calibration in WPF Desktop App doesn't wo

Postby laulau » 10 Aug 2015, 13:55

Thanks for your fast replay!

I know about the sample but I wanted to use the simple example in the c# tutorial. I think perhaps I missed some code or placed it wrong?

I think I used the wrong word. It is not an error where the complete application stops. It is just an output.
So this is what I get as output when I start the app and start the calibration in the app (the calibration stops after the point moved once, like I described above, but the app is still running).

The thread 0x1b30 has exited with code 259 (0x103).
'EyeTribe_WPF.vshost.exe' (CLR v4.0.30319: EyeTribe_WPF.vshost.exe): Loaded 'C:\Users\Laura\documents\visual studio 2013\Projects\EyeTribe_WPF\EyeTribe_WPF\bin\Debug\EyeTribe_WPF.exe'. Symbols loaded.
Step into: Stepping over non-user code 'EyeTribe_WPF.App..ctor'
'EyeTribe_WPF.vshost.exe' (CLR v4.0.30319: EyeTribe_WPF.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Step into: Stepping over non-user code 'EyeTribe_WPF.App.Main'
Step into: Stepping over non-user code 'EyeTribe_WPF.App.InitializeComponent'
'EyeTribe_WPF.vshost.exe' (CLR v4.0.30319: EyeTribe_WPF.vshost.exe): Loaded 'C:\Users\Laura\documents\visual studio 2013\Projects\EyeTribe_WPF\EyeTribe_WPF\bin\Debug\TETCSharpClient.dll'. Cannot find or open the PDB file.
'EyeTribe_WPF.vshost.exe' (CLR v4.0.30319: EyeTribe_WPF.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework.Aero2\v4.0_4.0.0.0__31bf3856ad364e35\PresentationFramework.Aero2.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Exception while connecting to EyeTribe Server: bei TETCSharpClient.GazeApiManager.RequestTracker(ClientMode mode, ApiVersion version)
bei TETCSharpClient.GazeManager.HandleServerConnect(Object stateInfo)The thread 0x143c has exited with code 259 (0x103).
'EyeTribe_WPF.vshost.exe' (CLR v4.0.30319: EyeTribe_WPF.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.resources\v4.0_4.0.0.0_de_b77a5c561934e089\System.resources.dll'. Module was built without symbols.
Error initializing GazeManager, is EyeTribe Server running?The thread 0x12d8 has exited with code 259 (0x103).
'EyeTribe_WPF.vshost.exe' (CLR v4.0.30319: EyeTribe_WPF.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework-SystemXmlLinq\v4.0_4.0.0.0__b77a5c561934e089\PresentationFramework-SystemXmlLinq.dll'. Cannot find or open the PDB file.
'EyeTribe_WPF.vshost.exe' (CLR v4.0.30319: EyeTribe_WPF.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework-SystemXml\v4.0_4.0.0.0__b77a5c561934e089\PresentationFramework-SystemXml.dll'. Cannot find or open the PDB file.
'EyeTribe_WPF.vshost.exe' (CLR v4.0.30319: EyeTribe_WPF.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\PresentationCore.resources\v4.0_4.0.0.0_de_31bf3856ad364e35\PresentationCore.resources.dll'. Module was built without symbols.
'EyeTribe_WPF.vshost.exe' (CLR v4.0.30319: EyeTribe_WPF.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\UIAutomationTypes\v4.0_4.0.0.0__31bf3856ad364e35\UIAutomationTypes.dll'. Cannot find or open the PDB file.
'EyeTribe_WPF.vshost.exe' (CLR v4.0.30319: EyeTribe_WPF.vshost.exe): Loaded 'C:\Users\Laura\documents\visual studio 2013\Projects\EyeTribe_WPF\EyeTribe_WPF\bin\Debug\TETControls.dll'. Symbols loaded.
Calling CalibrationStart(), but TET C# Client not activated!'EyeTribe_WPF.vshost.exe' (CLR v4.0.30319: EyeTribe_WPF.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework-SystemData\v4.0_4.0.0.0__b77a5c561934e089\PresentationFramework-SystemData.dll'. Cannot find or open the PDB file.
Calling CalibrationPointStart(), but TET C# Client not activated!Calling CalibrationPointEnd(), but TET C# Client not activated!Calling CalibrationAbort(), but TET C# Client not activated!The thread 0x11e0 has exited with code 259 (0x103).
The thread 0xb50 has exited with code 259 (0x103).


Do You have any ideas where my I mistake is located?
laulau
 
Posts: 5
Joined: 04 Aug 2015, 23:07

Re: Integration of Calibration in WPF Desktop App doesn't wo

Postby Anders » 11 Aug 2015, 10:37

Do You have any ideas where my I mistake is located?


Based on your output, the TETCSharpClient.dll does not seem to load. This may be related to the .Net version of the C# SDK. The SDK is build for .net 3.5 to ensure support for Unity.

I would suggest that you clone the C# repo from github, change the target framework to 4.5.1, rebuild and use the resulting DLL.

Please try this and let me know how it works out.
Anders
 
Posts: 124
Joined: 29 Oct 2013, 16:23

Re: Integration of Calibration in WPF Desktop App doesn't wo

Postby laulau » 11 Aug 2015, 22:33

I already worked with the dlls which were built with .Net framework 4.5.1. So this wasn't the problem. But because of your recommendation I changed my App Net version to 3.5 (which was possible without much work) and used the 'normal' dlls. And this works perfect!
Thanks a lot for your help! No I can continue =)
laulau
 
Posts: 5
Joined: 04 Aug 2015, 23:07


Return to C#



cron