Beispiel #1
0
        public void SendNewTemperatureMeasurement(MyTemperatureMeasurement measurement)
        {
            //var my = (MyMeasurement)measurement;
            IPublisherCallback callback = m_MeasurementPublishers[measurement.MyLocationName];

            if (callback != null)
            {
                AddNewTemperatureMeasuremenToDb(measurement);
                callback.OnTemperatureMeasurementSent(measurement);
            }

            foreach (var item in m_TemperatureCallbacks[measurement.MyLocationName].Values)
            {
                WorkerClass work = new WorkerClass();
                work.MyTemperature = measurement;
                work.MyCallback    = item;
                ThreadPool.QueueUserWorkItem(new WaitCallback(ThreadPoolSendTemperatureCallback), work);
            }
        }
Beispiel #2
0
        public void SendNewHumidityMeasurement(MyHumidityMeasurement measurement)
        {
            //string str = "Received";

            IPublisherCallback callback = m_MeasurementPublishers[measurement.MyLocationName];

            if (callback != null)
            {
                callback.OnHumidityMeasurementSent(measurement);
                AddNewHumidityMeasuremenToDb(measurement);
            }

            foreach (var item in m_HumidityCallbacks[measurement.MyLocationName].Values)
            {
                WorkerClass work = new WorkerClass();
                work.MyHumidity = measurement;
                work.MyCallback = item;
                ThreadPool.QueueUserWorkItem(new WaitCallback(ThreadPoolSendHumidityCallback), work);
            }
        }