private Control CreateControl(string name, SerializableMap settings) { var context = new ControlContext { ioRunner = ior, uiRunner = uir }; switch (name) { case "WritePointControl": return(new WritePointControl(context, settings)); case "ReadPointControl": return(new ReadPointControl(context, settings)); case "ReadRegisterControl": return(new ReadRegisterControl(context, settings)); case "WriteRegisterControl": return(new WriteRegisterControl(context, settings)); case "ReadFloatControl": return(new ReadFloatControl(context, settings)); case "WriteFloatControl": return(new WriteFloatControl(context, settings)); } Thrower.Throw("Unknown control name {0}", name); return(null); }
public WritePointControl(ControlContext context, SerializableMap settings) { this.context = context; InitializeComponent(); numericUpDownSlaveAddress.Value = settings.GetNumber("slaveAddress", 0); numericUpDownStartAddress.Value = settings.GetNumber("startAddress", 0); if (comboBoxFunctionCode.SelectedIndex < 0) comboBoxFunctionCode.SelectedIndex = 0; }
public ReadFloatControl(ControlContext context, SerializableMap settings) { this.context = context; InitializeComponent(); numericUpDownSlaveAddress.Value = settings.GetNumber("slaveAddress", 0); numericUpDownRegisterAddress.Value = settings.GetNumber("startAddress", 0); comboBoxFunctionCode.Text = settings.GetString("functionCode", "3 Holding 1234"); if (comboBoxFunctionCode.SelectedIndex < 0) { comboBoxFunctionCode.SelectedIndex = 0; } }