| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- namespace SHJX.Service.Control.PortProduction.Interface
- {
- public abstract class IPortProducer
- {
- private string _name;
- private ArgType _type;
- private object _value;
- private OptCommand _command;
- public IPortProducer(OptCommand command)
- {
- _command = command;
- }
- public IPortProducer SetName(string name)
- {
- _name = name;
- return this;
- }
- public IPortProducer SetType(ArgType type)
- {
- _type = type;
- return this;
- }
- public IPortProducer SetValue(object value)
- {
- _value = value;
- return this;
- }
- public object Execute()
- {
- IPortArg port = GetPortArg(_type);
- PortEventArgs arg = port.SetValue(_value).Init(_name);
- return _command.Factory(_type).Execute(arg);
- }
- protected abstract IPortArg GetPortArg(ArgType type);
- }
- }
|