private static PlcType GetPlcType(IPlc plc) { return(plc switch { ModbusPlc _ => PlcType.Modbus, S7Plc _ => PlcType.S7, _ => throw new ArgumentException($"Unsupported PLC {plc}.", nameof(plc)) });
public VariableViewModel CreateVariable(IPlc plc) { return(plc switch { S7Plc s7plc => new S7VariableViewModel(s7plc), ModbusPlc modbusPlc => new ModbusVariableViewModel(modbusPlc), _ => throw new NotImplementedException() });