예제 #1
0
        private void UpdateGridParam()
        {
            _gridParam.Rows.Clear();

            for (int i = 0; i < _indicator.Parameters.Count; i++)
            {
                DataGridViewRow row = new DataGridViewRow();

                row.Cells.Add(new DataGridViewTextBoxCell());
                row.Cells[0].Value = _indicator.Parameters[i].Name;

                if (_indicator.Parameters[i].Type == IndicatorParameterType.Bool)
                {
                    DataGridViewComboBoxCell cell = new DataGridViewComboBoxCell();

                    cell.Items.Add("False");
                    cell.Items.Add("True");
                    cell.Value = ((IndicatorParameterBool)_indicator.Parameters[i]).ValueBool.ToString();
                    row.Cells.Add(cell);
                }
                else if (_indicator.Parameters[i].Type == IndicatorParameterType.String)
                {
                    DataGridViewComboBoxCell cell = new DataGridViewComboBoxCell();

                    IndicatorParameterString param = (IndicatorParameterString)_indicator.Parameters[i];

                    for (int i2 = 0; i2 < param.ValuesString.Count; i2++)
                    {
                        cell.Items.Add(param.ValuesString[i2]);
                    }

                    cell.Value = param.ValueString;
                    row.Cells.Add(cell);
                }
                else if (_indicator.Parameters[i].Type == IndicatorParameterType.Int)
                {
                    DataGridViewTextBoxCell cell = new DataGridViewTextBoxCell();

                    IndicatorParameterInt param = (IndicatorParameterInt)_indicator.Parameters[i];

                    cell.Value = param.ValueInt.ToString();
                    row.Cells.Add(cell);
                }
                else if (_indicator.Parameters[i].Type == IndicatorParameterType.Decimal)
                {
                    DataGridViewTextBoxCell cell = new DataGridViewTextBoxCell();

                    IndicatorParameterDecimal param = (IndicatorParameterDecimal)_indicator.Parameters[i];

                    cell.Value = param.ValueDecimal.ToString();
                    row.Cells.Add(cell);
                }

                _gridParam.Rows.Add(row);
            }
        }
예제 #2
0
        /// <summary>
        /// create string parameter /
        /// создать параметр типа String
        /// </summary>
        /// <param name="name">param name / Имя параметра</param>
        /// <param name="value">default value / Значение по умолчанию</param>
        /// <param name="collection">values / Возможные значения для параметра</param>
        public IndicatorParameterString CreateParameterStringCollection(string name, string value, List <string> collection)
        {
            IndicatorParameter newParameter = _parameters.Find(p => p.Name == name);

            if (newParameter != null)
            {
                return((IndicatorParameterString)newParameter);
            }

            newParameter = new IndicatorParameterString(name, value, collection);

            return((IndicatorParameterString)LoadParameterValues(newParameter));
        }