예제 #1
0
        public ViewModel()
        {
            ModelAccess = new ModelAccess();
            SelectedIndex = 0;

            if(!(ModelAccess.GetSensors().Count > 0)) ModelAccess.ReadData();

            ServiceThread.DataArrivedEvent += (sender, s) =>
            {
                SensorReadNumber = int.Parse(s);
                _readingSets = ModelAccess.GetSensorRead(_selectedIndex);
                NotifyPropertyChanged(nameof(ReadingSet));
            };

            var serviceThread = new ServiceThread();
            var thread = new Thread(serviceThread.Run) {IsBackground = true};
            thread.Start();
        }
 public ServiceThread()
 {
     _maxRead = 11803;
     Model = new ModelAccess();
 }