コード例 #1
0
        public static void Main()
        {
            void AddToLog(string severity, string message)
            {
                Debug.WriteLine($"{severity}:{message}");
            }

            var networkProvider = new NetworkProvider();

            new Thread(() => { networkProvider.MonitorWifiNetworksContinuously(); }).Start();

            Bitmap fullScreenBitmap = DisplayControl.FullScreen;

            fullScreenBitmap.Clear();

            Font tempHumFont = Resource.GetFont(Resource.FontResources.temperatureFont);
            //Font ipFont = Resource.GetFont(Resource.FontResources.IpFont);

            var tempHumDisplay = new TempHumDisplay(fullScreenBitmap, tempHumFont);

            tempHumDisplay.Initialize();
            tempHumDisplay.PrintStuff(21.21, 52.36, NetworkProvider.GetIpAddress());

            var tempHumProvider = new TempHumProvider();
            var tempHumProducer = new TempHumProducer();

            DeviceFactory.Initialize();
            tempHumProvider.Initialize();

            tempHumProducer.TempHumProvider = tempHumProvider;
            tempHumProducer.TempHumDisplay  = tempHumDisplay;
            tempHumProducer.Initialize(BrokerIp, (severity, message) => AddToLog(severity, "TempHumProducer:" + message));

            Thread.Sleep(-1);

            Debug.WriteLine("Exiting...");
        }
コード例 #2
0
 private void GetTemperatureAndHumidityValues()
 {
     while (true)
     {
         _temperature.Value = (float)TempHumProvider.GetTemperature();
         _humidity.Value    = (float)TempHumProvider.GetHumidity();
         TempHumDisplay.PrintStuff(TempHumProvider.GetTemperature(), TempHumProvider.GetHumidity(), NetworkProvider.GetIpAddress());
         Thread.Sleep(1500);
     }
 }