//Display the selected parameter's value, type and description.
        private void DisplayParameter(int index)
        {
            param = NewEvent[index];

            cboType.Enabled = true;
            try { cboType.SelectedIndex = (int)param.ParamType; }
            catch { cboType.SelectedIndex = -1; cboType.Text = "(" + param.ParamType + ")"; }
            DisplayInType(param);

            lblParamDescription.Text = param.Description;
        }
        //Display the parameter's value according to its type.
        public void DisplayInType(Parameter value)
        {
            if (value is EventOffset)
            {
                requirementPanel.Visible = false;
                valueGrid.Visible = false;
                offsetPanel.Visible = true;

                EventOffset offset = value as EventOffset;

                _updating = true;
                comboBox1.SelectedIndex = (int)offset._offsetInfo.list;
                if (offset._offsetInfo.type != TypeValue.None)
                    comboBox3.SelectedIndex = (int)offset._offsetInfo.type;
                if (offset._offsetInfo.index != -1)
                    comboBox2.SelectedIndex = offset._offsetInfo.index;
                _updating = false;
            }
            else
            {
                requirementPanel.Visible = false;
                valueGrid.Visible = true;
                offsetPanel.Visible = false;

                valueGrid.SelectedObject = value;
            }
        }
        private void cboType_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cboType.SelectedIndex == -1) return;
            if (lstParameters.SelectedIndex == -1) return;
            int index = lstParameters.SelectedIndex;

            //Change the type to the type selected and update the view window.

            param = NewEvent[index];

            if (param.ParamType != (ParamType)cboType.SelectedIndex)
            {
                int ind = param.Index;
                EventInformation info = NewEvent.Info;
                string name = ((ParamType)cboType.SelectedIndex).ToString();

                int value = 0;

                Parameter p = NewEvent[ind];
                if (p is EventValue || p is EventScalar || p is EventBool)
                    value = p.Data;

                NewEvent.RemoveAt(ind);

                ParamType t = ((ParamType)cboType.SelectedIndex);

                NewEvent.NewParam(ind, value, (int)t);
            }

            DisplayParameter(index);
        }
 /// <summary>
 /// Use this to compare this parameter's real value to another's.
 /// </summary>
 public bool Compare(Parameter param, int compare)
 {
     switch (compare)
     {
         case 0: return RealValue < param.RealValue;
         case 1: return RealValue <= param.RealValue;
         case 2: return RealValue == param.RealValue;
         case 3: return RealValue != param.RealValue;
         case 4: return RealValue >= param.RealValue;
         case 5: return RealValue > param.RealValue;
         default: return false;
     }
 }