public Proportioner SetProportionor(int id, ControlType controlType, ProportionerSetting setting) { switch (id) { case 1: setting.ControlType1 = controlType; break; case 2: setting.ControlType2 = controlType; break; } switch (controlType) { case ControlType.Direct: this.Proportional = new ProportionorAnda(setting.EasySerialPort); break; case ControlType.PLC: this.Proportional = new ProportionorPLC(setting.EasySerialPort); break; case ControlType.Disable: this.Proportional = new ProportionorDisable(setting.EasySerialPort); break; } return(this); }
public Proportioner LoadSetting(EasySerialPort easySerialPort, ControlType controlType, int channel) { switch (controlType) { case ControlType.Direct: this.Proportional = new ProportionorAnda(easySerialPort); break; case ControlType.PLC: this.Proportional = new ProportionorPLC(easySerialPort); break; case ControlType.Disable: this.Proportional = new ProportionorDisable(easySerialPort); break; } this.Proportional.Channel = channel; return(this); }