Exemplo n.º 1
0
 public DayPhases(Morning morning, Day day, Evening evening, Night night)
 {
     this.MorningPhase = morning;
     this.DayPhase     = day;
     this.EveningPhase = evening;
     this.NightPhase   = night;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Low != null)
         {
             hashCode = hashCode * 59 + Low.GetHashCode();
         }
         if (High != null)
         {
             hashCode = hashCode * 59 + High.GetHashCode();
         }
         if (Morning != null)
         {
             hashCode = hashCode * 59 + Morning.GetHashCode();
         }
         if (Day != null)
         {
             hashCode = hashCode * 59 + Day.GetHashCode();
         }
         if (Evening != null)
         {
             hashCode = hashCode * 59 + Evening.GetHashCode();
         }
         if (Night != null)
         {
             hashCode = hashCode * 59 + Night.GetHashCode();
         }
         return(hashCode);
     }
 }
Exemplo n.º 3
0
        public ActionResult DeleteConfirmed(int id)
        {
            Evening evening = db.Evenings.Find(id);

            db.Evenings.Remove(evening);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 4
0
 public ActionResult Edit([Bind(Include = "ID,EveningLessonID,Date,Concept")] Evening evening)
 {
     if (ModelState.IsValid)
     {
         db.Entry(evening).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(evening));
 }
Exemplo n.º 5
0
        public ActionResult Create([Bind(Include = "ID,EveningLessonID,Date,Concept")] Evening evening)
        {
            if (ModelState.IsValid)
            {
                db.Evenings.Add(evening);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(evening));
        }
Exemplo n.º 6
0
 public int GetSize(bool includingHeader)
 {
     return(1 + // TimeOfDay
            3 + // null
            Morning.GetSize() +
            Afternoon.GetSize() +
            Evening.GetSize() +
            Night.GetSize() +
            4 +
            (includingHeader ? 10 : 0));
 }
Exemplo n.º 7
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Evening evening = db.Evenings.Find(id);

            if (evening == null)
            {
                return(HttpNotFound());
            }
            return(View(evening));
        }
Exemplo n.º 8
0
        IEnumerator TimeRoutine()
        {
            while (Hour < MaxHour)
            {
                if (timeScale == 0f)
                {
                    yield return(new WaitForTimeUnpaused());
                }

                var timeStep = 1f / (TimeSpeed * timeScale);
                yield return(new WaitForTimeElapsed(timeStep));

                Minute += 1;
                MinuteTicked?.Invoke(this, new TimeEventArgs(Minute, Hour, Year));

                var hourChanged = Minute >= 60;
                Hour += hourChanged ? 1 : 0;

                Minute %= 60;

                if (hourChanged)
                {
                    if (Hour >= MorningHour && Hour <= EveningHour)
                    {
                        WorkingHourTicked?.Invoke(this,
                                                  new TimeEventArgs(Minute, Hour, Year));
                    }
                }

                TimeChanged?.Invoke(this, new TimeEventArgs(Minute, Hour, Year));

                if (Hour == MorningHour && Minute == 0)
                {
                    Morning?.Invoke(this, EventArgs.Empty);
                }
                if (Hour == EveningHour && Minute == 0)
                {
                    Evening?.Invoke(this, EventArgs.Empty);
                }
            }

            Year  += 1;
            Hour   = MinHour;
            Minute = 0;

            TimeChanged?.Invoke(this, new TimeEventArgs(Minute, Hour, Year));
            YearTicked?.Invoke(this, new TimeEventArgs(Minute, Hour, Year));

            StopTime();
        }
Exemplo n.º 9
0
        /// <summary>
        /// Returns true if ForecastTemperature instances are equal
        /// </summary>
        /// <param name="other">Instance of ForecastTemperature to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ForecastTemperature other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Low == other.Low ||
                     Low != null &&
                     Low.Equals(other.Low)
                     ) &&
                 (
                     High == other.High ||
                     High != null &&
                     High.Equals(other.High)
                 ) &&
                 (
                     Morning == other.Morning ||
                     Morning != null &&
                     Morning.Equals(other.Morning)
                 ) &&
                 (
                     Day == other.Day ||
                     Day != null &&
                     Day.Equals(other.Day)
                 ) &&
                 (
                     Evening == other.Evening ||
                     Evening != null &&
                     Evening.Equals(other.Evening)
                 ) &&
                 (
                     Night == other.Night ||
                     Night != null &&
                     Night.Equals(other.Night)
                 ));
        }