private async void UpdateTimeAndDate(ThreadPoolTimer timer) { var now = DateTime.Now; string time = now.ToString("hh:mm tt"); if (time.StartsWith("0")) { time = time.Substring(1); } CurrentTime = time; // Standard long date format using the current system language CurrentDate = now.Date.ToString("D"); // Check to see if enough time has passed since the last reading in order to send a new message TimeSpan diff = now.Subtract(_latestMessageTimestamp); if (diff.TotalMinutes >= MessageTimeLimit) { // Upload Temperature and Humidity readings to the Azure IoT Hub, if configured _latestMessageTimestamp = now; await _sensorServer.SendSensorDataToAzureAsync(); if (Settings.MapFlipEnabled) { FlipDisplay(); } } // Rough estimates for sunrise and sunset var sunset = DateTime.Parse("8:00 PM"); var sunrise = DateTime.Parse("5:00 AM"); ColorScheme = (now > sunrise && now < sunset) ? MapColorScheme.Light : MapColorScheme.Dark; }