Complimentary to visual design of experiments, EventIDE accommodates a powerful "code-behind" programming platform. The "code-behind" model allows execution of user code in the context of EventIDE objects: experiment, events and elements. Each of these objects provides a fix list of callback slots, where blocks of user code can be attached. Such blocks are called code snippets. At runtime, the EventIDE objects execute the code snippets on particular moments, e.g. on onset of the event or in response to a button press.
EventIDE provides a family of .NET languages for coddign in snippets. Among then, C# is the most powerful modern language widely acepted in the professional developer community.
Description
The code language used in EventIDE is C# (C sharp). See Wikipedia for basic information and syntax. In the bottom middle panel of the EventIDE window sits the
Code Snippet boxes. Double clicking on these boxes will bring up the code in the main central panel.
The snippet boxes at the level of
Experiment are always visible. Clicking on different events will display the snippet boxes relating to that particular event (and any
Button or
Serial port elements that may be attached to this event).
Practical Use
Experimental Level
Header: In the Experiment Header, all global variables are defined. Any variables that are defined here by keywords (boolean, integer, string etc - see Wikipedia for all C# keywords) can then be used in other snippets. Adding the key word 'public' before any variable means that it will then be displayed in the parameter list.
Special (XAML): XAML code can be used to bind statistics and display this information on an operator screen.
Initializing: At this level, the values of any counters that are used in the experiment should be set to an appropriate value (i.e 0).
Running:
Finalizing:
Event Level
Condition: Any event that is set to be triggered by a condition becoming true, should have this condition made explicit in this code snippet box.
For example, if 8 pictures are to be shown one after the other, and all these pictures are listed as elements within the same event, the event should be initialised only whilst the counter is less than 8. In this condition box then would be something of the form 'Counter1<8' and Counter1 would have been defined in the
Experiment Header, and set to 0 in the
Experiment Initializing code snippet box.
Initializing (Preparing):
Activating: Code in this snippet box outlines what any counters etc should do after being activated. Counter++ for example will mean that the counter goes up by one. Any
Parameters manipulation should also be defined in this code snippet box.
Activated: Any conditions that determine which element within a particular event should be activated should be coded here. If this event were a feedback event, where correct or incorrect feedback would be given depending on the trial result, then this would be coded in this box in the form of, for example:
if (TrialResult==1)
Feedback=1
if(TrialResult==2)
Feedback=2
Running: The outcome of any button presses etc should be defined in these code snippets, for example if a participant has to choose between responding left or right, then the reaction time for either button may be recorded and defined as RT, and the response button will determine which feedback a participant may receive. Thus it is necessary to define what each button press means.
Deactivated: In this code snippet box, the outcome of the experiment is defined and the trial result recorded.