Esempio n. 1
0
        private async Task LiveReadItems(Dictionary <int, ReadingStabilizer> liveReadItems)
        {
            await CommunicationClient.Connect();

            do
            {
                foreach (var item in liveReadItems)
                {
                    var liveValue = await CommunicationClient.LiveReadItemValue(item.Key);

                    item.Value.ValueQueue.Enqueue(liveValue.NumericValue);
                    Container.Resolve <IEventAggregator>()
                    .PublishOnBackgroundThread(new LiveReadEvent(item.Key, liveValue.NumericValue));
                }
            } while (liveReadItems.Any(x => !x.Value.IsStable()));

            await CommunicationClient.Disconnect();
        }