private void ValueChanged(DevComponents.DotNetBar.Controls.CheckBoxX useCheckBox, Control valueControl, SetOptionValue del) { if (_options == null) { return; } if (!useCheckBox.Checked) { del(null); } else { Type t = valueControl.GetType(); switch (t.Name) { case "CheckBoxX": del(((DevComponents.DotNetBar.Controls.CheckBoxX)valueControl).Checked); break; case "TextBox": del(((TextBox)valueControl).Text); break; case "IntegerInput": del(((DevComponents.Editors.IntegerInput)valueControl).Value); break; case "DoubleInput": del(((DevComponents.Editors.DoubleInput)valueControl).Value); break; default: throw new NotImplementedException("Type of control not handled yet: " + t.Name); } } }
private DevComponents.AdvTree.Node AddNode(DevComponents.AdvTree.Node parentNode, string tag, string name, string description, InputTypes inputType, object value, bool selected, SetOptionValue setOptionValue) { DevComponents.DotNetBar.SuperTooltipInfo tooltip = new DevComponents.DotNetBar.SuperTooltipInfo(name, null, description, null, null, DevComponents.DotNetBar.eTooltipColor.Gray); DevComponents.DotNetBar.Controls.CheckBoxX checkBoxSelect = new DevComponents.DotNetBar.Controls.CheckBoxX() { Checked = selected, Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled, BackColor = Color.Transparent, CheckBoxPosition = DevComponents.DotNetBar.eCheckBoxPosition.Right }; DevComponents.AdvTree.Node newNode = new DevComponents.AdvTree.Node() { HostedControl = checkBoxSelect, Name = tag }; DevComponents.AdvTree.Cell nameCell = new DevComponents.AdvTree.Cell() { Text = name }; DevComponents.AdvTree.Cell valueCell = new DevComponents.AdvTree.Cell() { EditorType = DevComponents.AdvTree.eCellEditorType.Custom, Editable = true }; switch (inputType) { case InputTypes.Double: double?doubleValue = (double?)value; DevComponents.Editors.DoubleInput doubleInput = new DevComponents.Editors.DoubleInput() { Value = doubleValue.HasValue ? doubleValue.Value : 0 }; valueCell.HostedControl = doubleInput; doubleInput.ValueChanged += delegate(object sender, EventArgs e) { ValueChanged(checkBoxSelect, doubleInput, setOptionValue); }; break; case InputTypes.Integer: int?intValue = (int?)value; DevComponents.Editors.IntegerInput integerInput = new DevComponents.Editors.IntegerInput() { Value = intValue.HasValue ? intValue.Value : 0 }; valueCell.HostedControl = integerInput; integerInput.ValueChanged += delegate(object sender, EventArgs e) { ValueChanged(checkBoxSelect, integerInput, setOptionValue); }; break; case InputTypes.String: TextBox textBox = new TextBox() { Text = (string)value }; valueCell.HostedControl = textBox; textBox.TextChanged += delegate(object sender, EventArgs e) { ValueChanged(checkBoxSelect, textBox, setOptionValue); }; break; case InputTypes.Boolean: bool?boolValue = (bool?)value; DevComponents.DotNetBar.Controls.CheckBoxX checkBox = new DevComponents.DotNetBar.Controls.CheckBoxX() { Checked = boolValue.HasValue ? boolValue.Value : false, Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled, BackColor = Color.Transparent, }; checkBox.CheckedChanged += delegate(object sender, EventArgs e) { ValueChanged(checkBoxSelect, checkBox, setOptionValue); }; valueCell.HostedControl = checkBox; break; default: throw new NotImplementedException("InputType not handled yet: " + inputType.ToString()); } newNode.Cells.Add(nameCell); newNode.Cells.Add(valueCell); nameCell.Enabled = checkBoxSelect.Checked; valueCell.Enabled = checkBoxSelect.Checked; valueCell.HostedControl.Enabled = checkBoxSelect.Checked; superTooltip1.SetSuperTooltip(newNode, tooltip); superTooltip1.SetSuperTooltip(checkBoxSelect, tooltip); superTooltip1.SetSuperTooltip(valueCell.HostedControl, tooltip); checkBoxSelect.CheckedChanged += delegate { nameCell.Enabled = checkBoxSelect.Checked; valueCell.Enabled = checkBoxSelect.Checked; valueCell.HostedControl.Enabled = checkBoxSelect.Checked; if (checkBoxSelect.Checked) { valueCell.HostedControl.Focus(); } }; if (parentNode == null) { advTree1.Nodes.Add(newNode); } else { parentNode.Nodes.Add(newNode); } return(newNode); }
private DevComponents.AdvTree.Node AddNode(string tag, string name, string description, InputTypes inputType, object value, bool selected, SetOptionValue setOptionValue) { return(AddNode(null, tag, name, description, inputType, value, selected, setOptionValue)); }
private void ValueChanged(DevComponents.DotNetBar.Controls.CheckBoxX useCheckBox, Control valueControl, SetOptionValue del) { if (_options == null) return; if (!useCheckBox.Checked) del(null); else { Type t = valueControl.GetType(); switch (t.Name) { case "CheckBoxX": del(((DevComponents.DotNetBar.Controls.CheckBoxX)valueControl).Checked); break; case "TextBox": del(((TextBox)valueControl).Text); break; case "IntegerInput": del(((DevComponents.Editors.IntegerInput)valueControl).Value); break; case "DoubleInput": del(((DevComponents.Editors.DoubleInput)valueControl).Value); break; default: throw new NotImplementedException("Type of control not handled yet: " + t.Name); } } }
private DevComponents.AdvTree.Node AddNode(DevComponents.AdvTree.Node parentNode, string tag, string name, string description, InputTypes inputType, object value, bool selected, SetOptionValue setOptionValue) { DevComponents.DotNetBar.SuperTooltipInfo tooltip = new DevComponents.DotNetBar.SuperTooltipInfo(name, null, description, null, null, DevComponents.DotNetBar.eTooltipColor.Gray); DevComponents.DotNetBar.Controls.CheckBoxX checkBoxSelect = new DevComponents.DotNetBar.Controls.CheckBoxX() { Checked = selected, Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled, BackColor = Color.Transparent, CheckBoxPosition = DevComponents.DotNetBar.eCheckBoxPosition.Right }; DevComponents.AdvTree.Node newNode = new DevComponents.AdvTree.Node() { HostedControl = checkBoxSelect, Name = tag }; DevComponents.AdvTree.Cell nameCell = new DevComponents.AdvTree.Cell() { Text = name }; DevComponents.AdvTree.Cell valueCell = new DevComponents.AdvTree.Cell() { EditorType = DevComponents.AdvTree.eCellEditorType.Custom, Editable = true }; switch (inputType) { case InputTypes.Double: double? doubleValue = (double?)value; DevComponents.Editors.DoubleInput doubleInput = new DevComponents.Editors.DoubleInput() { Value = doubleValue.HasValue ? doubleValue.Value : 0 }; valueCell.HostedControl = doubleInput; doubleInput.ValueChanged += delegate(object sender, EventArgs e) { ValueChanged(checkBoxSelect, doubleInput, setOptionValue); }; break; case InputTypes.Integer: int? intValue = (int?)value; DevComponents.Editors.IntegerInput integerInput = new DevComponents.Editors.IntegerInput() { Value = intValue.HasValue ? intValue.Value : 0 }; valueCell.HostedControl = integerInput; integerInput.ValueChanged += delegate(object sender, EventArgs e) { ValueChanged(checkBoxSelect, integerInput, setOptionValue); }; break; case InputTypes.String: TextBox textBox = new TextBox() { Text = (string)value }; valueCell.HostedControl = textBox; textBox.TextChanged += delegate(object sender, EventArgs e) { ValueChanged(checkBoxSelect, textBox, setOptionValue); }; break; case InputTypes.Boolean: bool? boolValue = (bool?)value; DevComponents.DotNetBar.Controls.CheckBoxX checkBox = new DevComponents.DotNetBar.Controls.CheckBoxX() { Checked = boolValue.HasValue ? boolValue.Value : false, Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled, BackColor = Color.Transparent, }; checkBox.CheckedChanged += delegate (object sender, EventArgs e) { ValueChanged(checkBoxSelect, checkBox, setOptionValue); }; valueCell.HostedControl = checkBox; break; default: throw new NotImplementedException("InputType not handled yet: " + inputType.ToString()); } newNode.Cells.Add(nameCell); newNode.Cells.Add(valueCell); nameCell.Enabled = checkBoxSelect.Checked; valueCell.Enabled = checkBoxSelect.Checked; valueCell.HostedControl.Enabled = checkBoxSelect.Checked; superTooltip1.SetSuperTooltip(newNode, tooltip); superTooltip1.SetSuperTooltip(checkBoxSelect, tooltip); superTooltip1.SetSuperTooltip(valueCell.HostedControl, tooltip); checkBoxSelect.CheckedChanged += delegate { nameCell.Enabled = checkBoxSelect.Checked; valueCell.Enabled = checkBoxSelect.Checked; valueCell.HostedControl.Enabled = checkBoxSelect.Checked; if (checkBoxSelect.Checked) valueCell.HostedControl.Focus(); }; if (parentNode == null) advTree1.Nodes.Add(newNode); else parentNode.Nodes.Add(newNode); return newNode; }
private DevComponents.AdvTree.Node AddNode(string tag, string name, string description, InputTypes inputType, object value, bool selected, SetOptionValue setOptionValue) { return AddNode(null, tag, name, description, inputType, value, selected, setOptionValue); }