Creating a new Gaze Reactive Form - accessibilitysoftwarehub/OpenSourceWindowsGazeControl GitHub Wiki
To start off we need to make 2 new forms.
for the second form name is the same as the first one but add ".BehavMap" at the end
example: form1.cs and form1.BehavMap.cs
Note: If you get a designer.cs in your BehavMap. Delete it as it will cause errors
In the original form
reference "EyeXFramework.Forms"
add the private static variable "FormsEyeXHost eyeXHost"
add a parameter for it in the constructor and initialize the variable with the passed in argument
and call the method connectBehaveMap(); this will create an error as we have not made it yet
Open the designer .cs and scroll all the way down to the bottom
add this line "private EyeXFramework.Forms.BehaviorMap bhavFORMMap;" rename it however you like.
open the initializecomponent method and you should add these lines near the top
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ErrorWindow));
this.bhavErrorWindowMap = new EyeXFramework.Forms.BehaviorMap(this.components);
Rename "ErrorWindow" on the 2nd line and "bhavErrorWindowMap" on the 3rd line according to your variable names
resulting in the to something looking like
In the BehavMap
reference "EyeXFramework.Forms"
delete the constructor
and add these line of code
int buttonClickDelay = 500;
private void connectBehaveMap()
{
eyeXHost.Connect(bhavFORMMap);
setupMap();
setupErrorWindowMap();
}
private void setupMap()
{
}
private void setupFORMMap()
{
}
//toggle border on and off on gaze to gaze to give feed back.
private void OnGazeChangeBTColour(object s, GazeAwareEventArgs e)
{
var sentButton = s as Panel;
if (sentButton != null)
{
sentButton.BackColor = (e.HasGaze) ? Color.Red : Color.Black;
}
}
replace "bhavFORMMap" and "setupFORMMap()" with what you named your variable after.
the setupMap() is typically used for controls that are persistent throughout the form.
The setupFORMMAP() is used for different panels in order to make the code cleaner, having a different setup method for different panels.
The OnGazeChangeBTColour changes the backcolor of the button currently being looked at.