private void ChangeValue(DataValue value, bool readOnly) { Control newControl = null; _value = value; if (_value != null) { if (_value.Value is bool) { checkBoxBoolean.Enabled = !(readOnly || _value.Readonly); checkBoxBoolean.CheckedChanged -= checkBoxBoolean_CheckedChanged; checkBoxBoolean.Checked = _value.Value; checkBoxBoolean.CheckedChanged += checkBoxBoolean_CheckedChanged; newControl = checkBoxBoolean; } else if (_value.Value is DateTime) { dateTimePicker.Enabled = !(readOnly || _value.Readonly); dateTimePicker.Value = _value.Value; newControl = dateTimePicker; } else { textBox.ReadOnly = readOnly || _value.Readonly; textBox.TextChanged -= textBox_TextChanged; textBox.Text = _value.Value.ToString(); textBox.TextChanged += textBox_TextChanged; newControl = textBox; } } if (newControl != _currControl) { if (_currControl != null) { _currControl.Visible = false; } _currControl = newControl; _currControl.Visible = true; } }
private static DataFrameFilterFactory GetFilterForValue(DataValue value) { SetDataFrameFilterFactory ret; if (value.Value is byte[]) { ret = new BinaryDataFrameFilterFactory() { Match = value.Value as byte[] }; } else { ret = new StringDataFrameFilterFactory() { Match = value.Value.ToString() }; } ret.Path = value.Path; ret.SearchMode = DataFrameFilterSearchMode.Equals; return ret; }
/// <summary> /// Add an existing DataValue object /// </summary> /// <param name="dataValue">The datavalue object to add</param> public void AddValue(DataValue dataValue) { AddSubNode(dataValue); }