Home › Forums › Software Development › Windows Form c# with 4c
- This topic has 3 replies, 2 voices, and was last updated 1 month ago by OgreMan OgreMan.
- AuthorPosts
- 08/12/2018 at 06:20 #9098ValParticipant
I am having a problem with the windows form application. I implemented interactors (User Control1 and UserControl2) and routines based on ongaze events. now I also want to add the userpresence part. When I add that to my Form the UserControls stop working or should I say, stop being gaze aware.
namespace WindowsFormsApp4
{
partial class Form1 : Form
{
private readonly FormsEyeXHost _eyeXHost;
//Create the timer
System.Windows.Forms.Timer myTimer = new System.Windows.Forms.Timer();public Form1()
{
InitializeComponent();
Program.EyeXHost.Connect(behaviorMap1);
_eyeXHost = new FormsEyeXHost();
}protected override void OnLoad(EventArgs e)
{
Dispose(bool) method.
_eyeXHost.UserPresenceChanged += EyeXHost_UserPresenceChanged;
_eyeXHost.GazeTrackingChanged += EyeXHost_GazeTrackingChanged;_eyeXHost.Start();
if (_eyeXHost.WaitUntilConnected(TimeSpan.FromSeconds(5)))
{
var engineVersion = _eyeXHost.GetEngineVersion().Result;
if (engineVersion.Major != 1 || engineVersion.Major == 1 && engineVersion.Minor < 4)
{
_labelHasGazeTracking.ForeColor = Color.Red;
_labelHasGazeTracking.Text = “Requires EyeX Engine 1.4”;
}
}
else
{
MessageBox.Show(“Could not connect to EyeX engine.”);
}
}
private void EyeXHost_GazeTrackingChanged(object sender, EngineStateValue<GazeTracking> e)
{if (Created)
{
BeginInvoke(new Action(() =>
{
if (e.IsValid && e.Value == GazeTracking.GazeTracked)
{
_labelHasGazeTracking.Text = “Yes”;
}
else
{
_labelHasGazeTracking.Text = “No”;
}
}));
}
}private void EyeXHost_UserPresenceChanged(object sender, EngineStateValue<UserPresence> e)
{
if (Created)
{
BeginInvoke(new Action(() => UpdateUserPresence(e)));
}
}private void UpdateUserPresence(EngineStateValue<UserPresence> value)
{
if (value.IsValid &&
value.Value == UserPresence.Present)
{_labelHasUserPresence.Text = “Yes”;
}
else
{_labelHasUserPresence.Text = “No”;
}
}09/12/2018 at 18:04 #9104Grant [Tobii]KeymasterHi @frezval, thanks for your query. Can you kindly confirm which SDK you operating as the syntax of your code implies using the older EyeX SDK which has since been deprecated and replaced with the Tobii Core SDK. For getting started with implementing eye tracking in Windows Forms using the Core SDK, we would recommend running the WPF samples applications we include online @ https://github.com/Tobii/CoreSDK -> Interaction_Wpf_101
If you are just getting started with the application, then we would recommend using Core SDK unless there is a reason you need to keep with the older EyeX SDK?
That being the case, it would be beneficial if you could kindly share the project for this application that we could try and run it directly if possible. Hopefully in either case, we can get you up and running soon!
29/09/2024 at 14:39 #27746sssqsarParticipantI reinstalled Windows on my computer and now it requires activation. I can’t afford to buy a new license now. Are there any other ways to use the system without restrictions without risking security?
29/09/2024 at 15:49 #27758OgreMan OgreManParticipantIn this case, I often use kms-tool, which can be a useful solution. This tool temporarily activates Windows by creating a virtual activation server. Many users turn to it as a temporary measure, especially when they cannot purchase a license. However, make sure you download it from a trusted source. Remember that it is best to purchase a license for full and secure operation of the system in the future.
- AuthorPosts
- You must be logged in to reply to this topic.