|
|
@@ -47,6 +47,7 @@ namespace Communicator
|
|
|
_hubConnection.StateChanged += OnStateChanged;
|
|
|
|
|
|
_hubProxy = _hubConnection.CreateHubProxy(_hubName);
|
|
|
+ _hubProxy.On<Dictionary<string, object>>(nameof(ReceiveAllDataItems), ReceiveAllDataItems);
|
|
|
_hubProxy.On<Dictionary<string, object>>(nameof(ReceiveChangedDataItems), ReceiveChangedDataItems);
|
|
|
_hubConnection.Start().Wait();
|
|
|
|
|
|
@@ -58,6 +59,17 @@ namespace Communicator
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ private void ReceiveAllDataItems(Dictionary<string, object> dataItems)
|
|
|
+ {
|
|
|
+ if (dataItems.Count <= 0)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ _provider?.NotifyAllDataReceived(dataItems);
|
|
|
+ }
|
|
|
+
|
|
|
private void ReceiveChangedDataItems(Dictionary<string, object> dataItems)
|
|
|
{
|
|
|
if (dataItems.Count <= 0)
|
|
|
@@ -76,7 +88,7 @@ namespace Communicator
|
|
|
while (await _changedDataItems.OutputAvailableAsync() && !_cancellationTokenSource.IsCancellationRequested)
|
|
|
{
|
|
|
var item = await _changedDataItems.ReceiveAsync();
|
|
|
- _provider?.DataChangedNotify(item.Key, item.Value);
|
|
|
+ _provider?.NotifyDataChanged(item.Key, item.Value);
|
|
|
}
|
|
|
}
|
|
|
|