public IoMonitor(MonitoredChannel <TPacket> monitoredChannel) { MonitoredChannel = monitoredChannel; LastPacketTime = DateTime.Now; monitoredChannel.DataReceived += (sender, arg) => { if (FirstPacketTime == DateTime.MinValue) { FirstPacketTime = DateTime.Now; } DataReceivedCount++; LastPacketTime = DateTime.Now; }; }
public async Task UpdateChannelMonitoring(MonitoredChannel channel) { var foundItem = await _connection.Table <MonitoredChannel>() .Where(d => d.ChannelId == channel.ChannelId).FirstOrDefaultAsync(); if (foundItem != null) { foundItem.IsMonitored = channel.IsMonitored; await _connection.UpdateAsync(foundItem); } else { await _connection.InsertAsync(channel); } }