Page History: Code snippets
Compare Page Revisions
Page Revision: 2012/05/25 20:37
Complimentary to a visual designer, EventIDE also accommodates a programming platform that works under "code-behind" model.
enviroment for "code-behind" coding. The "code-behind" means that
Tight integration of the designed content and user code is secured by the event-driven (or callback) model: the user code is organized as blocks which are executed at predefined moments in the experiment progress. Tight integration of the designed content and user code is secured by the EventIDE logic- code snippets are always attached and synchronized with EventIDE objects: experiment, events and elements.
is called by on
EventIDE
for several .NET prgramming
it's core When an expeirmenal scenario coding is required, EventIDE provides an integrated code editor compiler Coding requirements are minimal due to the feature-based build of EventIDE, but some simple coding is required in order to manipulate parameters and to create conditional events.
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.