Home Forums Reply To:

#9298
Dmitry
Participant

Hi, Grant!
Thank you for the snippet.
But during the compilation an unhandled exception
“Tobii.Interaction.Client.InteractionApiException” occurs in Tobii.Interactions.Model.dll (Result=Cancelled). Line 17.

Target platform NET 4.5 (x86)
Tobii Core 2.13.4

How can I fix this?

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tobii.Interaction;

namespace serialWithSharp
{
    public class Program
    {
        public static void Main()            
        {
            Tobii.Interaction.Host host = new Host();
            host.EnableConnection();

            var serialNumber =
                host.Context.GetState(Tobii.Interaction.Framework.StatePaths.EyeTrackingInfoSerialNumber).GetStateValueOrDefault<string>();

            Console.WriteLine(serialNumber);
        }
    }
}

Best Wishes,
Dmitry