Example #1
0
 public RegionParameter(RegionParameter rp)
 {
     SL_pos = rp.SL_pos;
     SL_size = rp.SL_size;
     pos = new float[rp.pos.Length];
     size = new float[rp.size.Length];
     rp.pos.CopyTo(pos, 0);
     rp.size.CopyTo(size, 0);
     cPos = rp.cPos;
     cSize = rp.cSize;
     sLabel = rp.sLabel;
 }
Example #2
0
        public Form2DTask(Task2D t)
        {
            InitializeComponent();
            comboBoxInputDevice.DataSource = Input2D.GetPossibleInputs();
            comboBoxInputHandling.DataSource = InputHandlingNames.InputHandlingStrings;
            comboBoxPerformanceMetric.DataSource = PerformanceMetrics.PerformanceMetricStrings;
            comboBoxEndButton.DataSource = ButtonEndCondition.ButtonText;
            comboBoxShape.DataSource = new ShapeType[] { ShapeType.Rectangle, ShapeType.Ellipse, ShapeType.Hoop };
            SpecifierLabel[] SpecifierLabels = new SpecifierLabel[]
            {
                SpecifierLabel.Static, SpecifierLabel.Dynamic,
                SpecifierLabel.Random
            };
            comboBoxPosX.BindingContext = new BindingContext();
            comboBoxPosX.DataSource = SpecifierLabels;
            comboBoxPosX.Tag = t.region.rParams[regPT.X];
            comboBoxPosY.BindingContext = new BindingContext();
            comboBoxPosY.DataSource = SpecifierLabels;
            comboBoxPosY.Tag = t.region.rParams[regPT.Y];
            comboBoxSizeX.BindingContext = new BindingContext();
            comboBoxSizeX.DataSource = SpecifierLabels;
            comboBoxSizeY.BindingContext = new BindingContext();
            comboBoxSizeY.DataSource = SpecifierLabels;

            // Load Form from task data
            task = t;
            textBoxName.Text = task.Name;

            // Input loading
            comboBoxInputDevice.SelectedIndex = Input2D.GetInputIndex(task.primaryInput);
            additionalInputs = new List<InputDevice>();
            additionalInputs.AddRange(task.additionalInput);
            listBoxAdditionalInputs.DataSource = additionalInputs;

            // Input handling load
            comboBoxInputHandling.SelectedIndex = (int)task.inputHandling;

            // Performance Metric load
            comboBoxPerformanceMetric.SelectedIndex = (int)task.performanceMetric;

            //Region Loading
            if (t.regionEnabled)
            {
                groupBox1.Enabled = true;
                checkBoxEnableRegion.Checked = true;
            }
            else
            {
                groupBox1.Enabled = false;
                checkBoxEnableRegion.Checked = false;
            }
            if (t.region.Shape != ShapeType.NONE)
            {
                comboBoxShape.SelectedItem = t.region.Shape;
                comboBoxPosX.SelectedItem  = ((RegionParameter)comboBoxPosX.Tag).SL_pos;
                comboBoxPosY.SelectedItem  = ((RegionParameter)comboBoxPosY.Tag).SL_pos;
                comboBoxSizeX.SelectedItem = ((RegionParameter)comboBoxPosX.Tag).SL_size;
                comboBoxSizeY.SelectedItem = ((RegionParameter)comboBoxPosY.Tag).SL_size;
                numericUpDownPosX1.Value   = (decimal)((RegionParameter)comboBoxPosX.Tag).pos[0];
                numericUpDownPosX2.Value   = (decimal)((RegionParameter)comboBoxPosX.Tag).pos[1];
                numericUpDownPosY1.Value   = (decimal)((RegionParameter)comboBoxPosY.Tag).pos[0];
                numericUpDownPosY2.Value   = (decimal)((RegionParameter)comboBoxPosY.Tag).pos[1];
                numericUpDownSizeX1.Value  = (decimal)((RegionParameter)comboBoxPosX.Tag).size[0];
                numericUpDownSizeX2.Value  = (decimal)((RegionParameter)comboBoxPosX.Tag).size[1];
                numericUpDownSizeY1.Value  = (decimal)((RegionParameter)comboBoxPosY.Tag).size[0];
                numericUpDownSizeY2.Value  = (decimal)((RegionParameter)comboBoxPosY.Tag).size[1];
            }

            // End Condition Loading
            if (task.endCondition.GetType() == typeof(ButtonEndCondition))
            {
                buttonEnd = (ButtonEndCondition)task.endCondition;
                timeEnd = new TimeLimitEndCondition();
                comboBoxEndCondition.SelectedIndex = 0;

            }
            else
            {
                buttonEnd = new ButtonEndCondition();
                timeEnd = (TimeLimitEndCondition)task.endCondition;
                if(((TimeLimitEndCondition)task.endCondition).Type == TimeLimitType.TotalTime)
                    comboBoxEndCondition.SelectedIndex = 1;
                else if(((TimeLimitEndCondition)task.endCondition).Type == TimeLimitType.TimeInRegion)
                    comboBoxEndCondition.SelectedIndex = 2;
                else if (((TimeLimitEndCondition)task.endCondition).Type == TimeLimitType.TimeOutRegion)
                    comboBoxEndCondition.SelectedIndex = 3;
            }
            numericUpDownEndSeconds.Value = (decimal)timeEnd.TimeLimit;
            comboBoxEndButton.SelectedIndex = (int)buttonEnd.Button;
        }