public void StartProducingData()
        {
            Task.Run(async() =>
            {
                for (int i = 0; i < 100_000; i++)
                {
                    var random = new Random();
                    var buffer = new byte[random.Next(8, 100)];

                    random.NextBytes(buffer);
                    string hexData = BitConverter.ToString(buffer);

                    var dataGridViewModel = new DataGridViewModel
                    {
                        TimeStamp = DateTime.Now.ToString("HH:mm:ss.ffffff"),
                        Id        = random.Next(1, 10).ToString(),
                        HexData   = hexData
                    };

                    var dataReceived = new DataReceived {
                        DataGridViewModel = dataGridViewModel
                    };

                    OnDataReceived(dataReceived);

                    await Task.Delay(10);
                }
            });
        }
Пример #2
0
        private static void AddSomeRandomData(SourceList <DataGridViewModel> _dataList)
        {
            var random = new Random();

            for (int i = 0; i < 300_000; i++)
            {
                var buffer = new byte[random.Next(8, 100)];

                random.NextBytes(buffer);
                string hexData = BitConverter.ToString(buffer);

                var dataGridViewModel = new DataGridViewModel
                {
                    TimeStamp = DateTime.Now.ToString("HH:mm:ss.ffffff"),
                    Id        = random.Next(1, 10).ToString(),
                    HexData   = hexData
                };

                _dataList.Add(dataGridViewModel);
            }
        }
Пример #3
0
 private void DataSource_IncomingData(DataGridViewModel dataGridViewModel)
 {
     _dataList.Add(dataGridViewModel);
 }