public void AddSensor(string name, float value, int type)
        {
            bool found = false;

            foreach (var s in _sensors)
            {
                if (s.name == name)
                {
                    found = true;
                }
            }
            if (found == false)
            {
                var sensor = new StatSensorItem(name, type);
                _sensors.Add(sensor);
                sessionID = DateTime.Now.Ticks;
            }
            foreach (var s in _sensors)
            {
                if (s.name == name)
                {
                    var ss = new SensorStatQueue
                    {
                        SampleID = historyIndex,
                        Value    = value
                    };
                    s.history.Enqueue(ss);
                }
            }
        }
        public void AddHistoryItem(FixedSizeQueue <SensorStatQueue> from, int count, FixedSizeQueue <SensorStatQueue> to, long index)
        {
            if (from.Count() < count)
            {
                return;
            }

            float value = 0;

            for (int i = 1; i <= count; i++)
            {
                SensorStatQueue sample = from.ElementAt(history.Count() - i);
                value += sample.Value;
            }
            value /= count;

            var hourSample = new SensorStatQueue
            {
                SampleID = index,
                Value    = value
            };

            to.Enqueue(hourSample);
        }
        public void AddHistoryItem(FixedSizeQueue<SensorStatQueue> from, int count, FixedSizeQueue<SensorStatQueue> to, long index)
        {
            if (from.Count() < count)
                return;

            float value = 0;
            for (int i = 1; i <= count; i++)
              		{
              			SensorStatQueue sample = from.ElementAt(history.Count() - i);
                value += sample.Value;
              		}
            value /= count;

            var hourSample = new SensorStatQueue
            {
                SampleID = index,
                Value = value
            };
            to.Enqueue(hourSample);
        }
 public void AddSensor(string name, float value, int type)
 {
     bool found = false;
         foreach (var s in _sensors){
             if(s.name == name){
                 found = true;
             }
         }
         if(found == false){
             var sensor = new StatSensorItem(name, type);
             _sensors.Add(sensor);
             sessionID = DateTime.Now.Ticks;
         }
         foreach (var s in _sensors){
             if(s.name == name){
                  var ss = new SensorStatQueue
                  {
                      SampleID = historyIndex,
                      Value = value
                  };
                 s.history.Enqueue(ss);
             }
         }
 }