コード例 #1
0
 public ServiceInformation(Sun sun, Weather weather)
 {
     sun.Resolve();
       Sunrise = sun.Sunrise;
       Sunset = sun.Sunset;
       weather.Resolve();
       Temperature = weather.Temperature;
 }
コード例 #2
0
ファイル: Sun.cs プロジェクト: calimeradriver/Domotica
        public override void Resolve()
        {
            base.Resolve();

              Sun sun = new Sun();
              JToken root = JObject.Parse(LastResponse);
              JToken results = root["results"];
              Sun deserializedSun = JsonConvert.DeserializeObject<Sun>(results.ToString());
              Sunrise = deserializedSun.Sunrise;
              Sunset = deserializedSun.Sunset;
        }
コード例 #3
0
        public void SunriseSunSetAPITest()
        {
            Sun sun = new Sun();
              sun.Resolve();

              Assert.IsFalse(sun.ErrorDetected, string.Format(errorDownloadResponse, sun.Name));
              Assert.IsTrue(sun.LastUpdatedSuccessful.HasValue);
              Assert.AreNotEqual<DateTime>(DateTime.MinValue, sun.LastUpdatedSuccessful.Value);
              Assert.IsNotNull(sun.LastResponse, string.Format(errorResponseNull, sun.Name));
              Assert.IsNotNull(sun.Sunrise);
              Assert.IsNotNull(sun.Sunset);
              Assert.AreNotEqual<DateTime>(DateTime.MinValue, sun.Sunrise);
              Assert.AreNotEqual<DateTime>(DateTime.MinValue, sun.Sunset);
        }
コード例 #4
0
ファイル: Scheduler.cs プロジェクト: calimeradriver/Domotica
        /// <summary>
        /// 
        /// </summary>
        private void sunMode(DateTime dateTime, Program program)
        {
            if (_sun == null)
            _sun = new Sun();

              _sun.Resolve();

              // Power device on
              if (dateTime.Hour == _sun.Sunset.Hour && dateTime.Minute == _sun.Sunset.Minute)
            program.PowerDevicesOn();

              // Power device off
              if (dateTime.Hour == program.EndTime.Value.Hour && dateTime.Minute == program.EndTime.Value.Minute)
            program.PowerDevicesOff();
        }