private void dataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                SensorReadingsModel s = (SensorReadingsModel)dataGrid.SelectedItem;
                //DataGridRow row = (DataGridRow)dataGrid.ItemContainerGenerator.ContainerFromItem(e.AddedItems[0]);
                if (s == null)
                {
                    return;
                }
                _lastSensorReadingsModel = s;

                double zeroOffset = 0.0;
                if (zeroOffsetTextBox.Text.Length != 0)
                {
                    zeroOffset = Convert.ToDouble(zeroOffsetTextBox.Text);
                }
                ShowPlotAsync((bool)dftCheckBox.IsChecked, zeroOffset);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
                Debug.WriteLine(ex.StackTrace);
            }
        }
Exemplo n.º 2
0
        public ObservableCollection <SensorReadingsModel> GetSensorReadingModelCollection(int address, string readingType, string minDateTime, string maxDateTime)
        {
            ObservableCollection <SensorReadingsModel> list = new ObservableCollection <SensorReadingsModel>();


            DataTable dt = GetSensorReadingDataTableFiltered(address, readingType, minDateTime, maxDateTime);

            foreach (DataRow r in dt.Rows)
            {
                double sampleRate = 0;
                double.TryParse(r[C_VIB_SAMPLE_RATE].ToString(), out sampleRate);
                var item = new SensorReadingsModel()
                {
                    TempId          = r[C_TEMP_ID].ToString(),
                    Address         = int.Parse(r[C_ADDRESS].ToString()),
                    Reading_Type    = r[C_READING_TYPE].ToString(),
                    Reading         = r[C_READING].ToString(),
                    Vib_Sample_Rate = sampleRate,
                    Date_Time       = r[C_DATE_TIME].ToString()
                };

                list.Add(item);
            }
            return(list);
        }