Task OnDeviceStateChanged(RemoteConnection_DeviceStateChangedMessage msg) { if (IsMessageFromCurrentDevice(msg)) { DeviceStateChanged?.Invoke(this, msg.State.ToDeviceState()); } return(Task.CompletedTask); }
bool IsMessageFromCurrentDevice(RemoteConnection_DeviceStateChangedMessage msg) { if (string.IsNullOrWhiteSpace(msg.DeviceId)) { return(false); } if (RemoteDevice == null) { return(false); } return(msg.DeviceId == RemoteDevice.Id); }
public Task RemoteConnection_DeviceStateChanged(RemoteConnection_DeviceStateChangedMessage message) { //_log.WriteLine($"({deviceId}) Remote system state received"); SendMessage(new Remote_DeviceStateChangedMessage(message.DeviceId, message.State.ToDeviceState())); return(Task.CompletedTask); }