WingMan
/trunk/WingMan/Lobby/LobbyMessageSynchronizer.cs |
@@ -11,17 +11,17 @@ |
{ |
public delegate void LobbyMessageReceived(object sender, LobbyMessageReceivedEventArgs e); |
|
public LobbyMessageSynchronizer(MQTTCommunication MQTTCommunication, TaskScheduler taskScheduler, |
public LobbyMessageSynchronizer(MqttCommunication mqttCommunication, TaskScheduler taskScheduler, |
CancellationToken cancellationToken) |
{ |
this.MQTTCommunication = MQTTCommunication; |
MqttCommunication = mqttCommunication; |
CancellationToken = cancellationToken; |
TaskScheduler = taskScheduler; |
|
MQTTCommunication.OnMessageReceived += MqttCommunicationOnOnMessageReceived; |
mqttCommunication.OnMessageReceived += MqttCommunicationOnOnMessageReceived; |
} |
|
private MQTTCommunication MQTTCommunication { get; } |
private MqttCommunication MqttCommunication { get; } |
|
private CancellationToken CancellationToken { get; } |
private TaskScheduler TaskScheduler { get; } |
@@ -28,7 +28,7 @@ |
|
public void Dispose() |
{ |
MQTTCommunication.OnMessageReceived -= MqttCommunicationOnOnMessageReceived; |
MqttCommunication.OnMessageReceived -= MqttCommunicationOnOnMessageReceived; |
} |
|
public event LobbyMessageReceived OnLobbyMessageReceived; |
@@ -57,13 +57,13 @@ |
{ |
LobbyMessage.XmlSerializer.Serialize(memoryStream, new LobbyMessage |
{ |
Nick = MQTTCommunication.Nick, |
Nick = MqttCommunication.Nick, |
Message = message |
}); |
|
memoryStream.Position = 0L; |
|
await MQTTCommunication.Broadcast("lobby", memoryStream.ToArray()).ConfigureAwait(false); |
await MqttCommunication.Broadcast("lobby", memoryStream.ToArray()).ConfigureAwait(false); |
} |
} |
} |