Home Forums Software Development Creating call back functions for interactors

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #7775
    Anonymous
    Inactive

    Hi. I am currently working on designing a security system using grid of interactors (WPF application). It is stated in Tobii Guide that each interactor has a unique ID. I want to determine at which interactor the user is looking at and sent it to Mainwindow.xmal.cs by calling the function. I am searching for any example explaining how it can be done but was not able to find any. Please guide me how should I proceed from here.

    ` <UniformGrid Columns=”3″ Rows=”4″ Margin=”0,90,0,0″>

    <Rectangle Style=”{StaticResource RectangleWithGazeAwareAnimation}” Tag=”1″ />
    <Rectangle Style=”{StaticResource RectangleWithGazeAwareAnimation}” Tag=”2″ />
    <Rectangle Style=”{StaticResource RectangleWithGazeAwareAnimation}” />
    <Rectangle Style=”{StaticResource RectangleWithGazeAwareAnimation}” />
    <Rectangle Style=”{StaticResource RectangleWithGazeAwareAnimation}” />
    <Rectangle Style=”{StaticResource RectangleWithGazeAwareAnimation}” />
    <Rectangle Style=”{StaticResource RectangleWithGazeAwareAnimation}” />
    <Rectangle Style=”{StaticResource RectangleWithGazeAwareAnimation}” />
    <Rectangle Style=”{StaticResource RectangleWithGazeAwareAnimation}” />
    <Rectangle Style=”{StaticResource RectangleWithGazeAwareAnimation}” />
    <Rectangle Style=”{StaticResource RectangleWithGazeAwareAnimation}” />

    </UniformGrid>

    #7779
    Grant [Tobii]
    Keymaster

    Hi @dawood154, I understand that you wish to launch a function depending on which Interactor is being gazed upon?

    Indeed we provide WPF samples related to this topic on this on the following page : https://github.com/Tobii/interaction-samples

    Perhaps you have not yet looked at these samples? If still they do not help you getting started, please let us know.

    #7827
    Anonymous
    Inactive

    I am working on GazeAwareElements sample code. When I run the program it crashes as I move my gaze on text box and show me error that there is Handler issue.
    `private void Instruction_OnHasGazeChanged(object sender, RoutedEventArgs e)
    {
    var textBlock = e.Source as TextBlock;
    if (null == textBlock) { return; }

    var model = (MainWindowModel) DataContext;
    var hasGaze = textBlock.GetHasGaze();
    model.NotifyInstructionHasGazeChanged(hasGaze);
    }
    The handler issue is indicated on model.NotifyInstructionHasGazeChanged(hasGaze). You can see the example at following link:

    https://github.com/Tobii/interaction-samples/tree/master/WpfSamples/GazeAwareElements (Mainwindow.Xmal.cs)

    #7833
    Grant [Tobii]
    Keymaster

    Hi @dawood154, I was able to run the code without issue but will try to reproduce the problem if you could kindly provide some greater detail with respect to your IDE, OS, Hardware, etc.. thanks..

    With respect to your initial question, did you find the means to get the Unique ID’s ?

    #7861
    Anonymous
    Inactive

    I couldn’t quite get the idea of unique ID. As i have to create a keypad (0-9) and want to know at which key user is looking at. Using the panel shown in example code I tried to create 4 panels and put them in a grid. Each panel is assigned with a different handler as shown below : –

    `<Style x:Key=”EyeXGazeAwarePanel1″ BasedOn=”{StaticResource EyeXGazeAwareElement}” TargetType=”Panel”>
    <Setter Property=”Background” Value=”Red” />
    <EventSetter Event=”eyeX:Behavior.HasGazeChanged” Handler=”Instruction_OnHasGazeEnter1″ />
    <Style.Triggers>
    <Trigger Property=”eyeX:Behavior.HasGaze” Value=”True”>
    <Setter Property=”Background” Value=”DarkMagenta” />
    </Trigger>
    </Style.Triggers>
    </Style>
    <Style x:Key=”EyeXGazeAwarePanel2″ BasedOn=”{StaticResource EyeXGazeAwareElement}” TargetType=”Panel”>
    <Setter Property=”Background” Value=”DarkBlue” />
    <EventSetter Event=”eyeX:Behavior.HasGazeChanged” Handler=”Instruction_OnHasGazeEnter2″ />
    <Style.Triggers>
    <Trigger Property=”eyeX:Behavior.HasGaze” Value=”True”>
    <Setter Property=”Background” Value=”DarkMagenta” />
    </Trigger>
    </Style.Triggers>
    </Style>
    <Style x:Key=”EyeXGazeAwarePanel3″ BasedOn=”{StaticResource EyeXGazeAwareElement}” TargetType=”Panel”>
    <Setter Property=”Background” Value=”Red” />
    <EventSetter Event=”eyeX:Behavior.HasGazeChanged” Handler=”Instruction_OnHasGazeEnter3″ />
    <Style.Triggers>
    <Trigger Property=”eyeX:Behavior.HasGaze” Value=”True”>
    <Setter Property=”Background” Value=”DarkMagenta” />
    </Trigger>
    </Style.Triggers>
    </Style>
    <Style x:Key=”EyeXGazeAwarePanel4″ BasedOn=”{StaticResource EyeXGazeAwareElement}” TargetType=”Panel”>
    <Setter Property=”Background” Value=”DarkBlue” />
    <EventSetter Event=”eyeX:Behavior.HasGazeChanged” Handler=”Instruction_OnHasGazeEnter4″ />
    <Style.Triggers>
    <Trigger Property=”eyeX:Behavior.HasGaze” Value=”True”>
    <Setter Property=”Background” Value=”DarkMagenta” />
    </Trigger>
    </Style.Triggers>
    </Style>

    </ResourceDictionary>
    </Window.Resources>

    <UniformGrid Rows=”4″ Columns=”3″>
    <DockPanel Style=”{StaticResource EyeXGazeAwarePanel1}” Margin=”25″/>
    <DockPanel Style=”{StaticResource EyeXGazeAwarePanel2}” Margin=”25″/>
    <DockPanel Style=”{StaticResource EyeXGazeAwarePanel3}” Margin=”25″/>
    <DockPanel Style=”{StaticResource EyeXGazeAwarePanel4}” Margin=”25″/>
    </UniformGrid>

    Is it possible to create a single panel and when I am putting it in form of grid I can attach a unique ID to it.Which mean it calls back only on function but depending on which panel the user looks it send back the function(Instruction_OnHasGazeEnter) a different number. Once the user look at one panel for one sec I want t call the handler and save the key number of panel which the user selected Because from the example code this is the only way i think of it.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.