/// <summary> /// Draw the control. /// </summary> /// <param name="pe">Draing event arguments.</param> protected override void OnPaint(PaintEventArgs pe) { this.Font = this.Enabled ? fontBold : fontNormal; if (!this.Enabled) { this.DrawDisabled(pe); } else { if (!this.ManualDrawOptions) { Woman w = Program.CurrentWoman; this.Egesta = w.Menstruations.GetEgestaAmount(this.Date); this.IsFocusDay = this.OwnerOneMonthControl != null && this == this.OwnerOneMonthControl.FocusDay; this.IsTodayDay = this.Date == DateTime.Today; this.IsPregnancyDay = w.IsPregnancyDay(this.Date); this.PregnancyWeek = w.Conceptions.GetPregnancyWeekNumberWhenFirstWeekDay(this.Date); this.IsMenstruationDay = !this.IsPregnancyDay && w.Menstruations.IsMenstruationDay(this.Date); this.IsPredictedAsOvulationDay = !this.IsPregnancyDay && w.IsPredictedAsOvulationDay(this.Date); this.IsPredictedAsSafeSexDay = !this.IsPregnancyDay && w.IsPredictedAsSafeSexDay(this.Date); this.IsHaveNote = w.Notes.ContainsKey(this.Date); this.IsPredictedAsBoyDay = !this.IsPregnancyDay && w.IsPredictedAsBoyDay(this.Date); this.IsPredictedAsGirlDay = !this.IsPregnancyDay && w.IsPredictedAsGirlDay(this.Date); this.IsPredictedAsMenstruationDay = !this.IsPregnancyDay && w.IsPredictedAsMenstruationDay(this.Date); this.IsConceptionDay = w.IsConceptionDay(this.Date); this.IsHadSex = w.HadSexList.ContainsKey(this.Date); this.IsAScheduleFired = w.Schedules.HasAFiredSchedule(this.Date); } this.DrawEnabled(pe); } }
/// <summary> /// Generate the object from the given woman and the date. /// </summary> /// <param name="w">Woman to use.</param> /// <param name="day">The date of the future data.</param> /// <returns>Day info data.</returns> public static OneDayInfo GetByDate(Woman w, DateTime day) { return(new OneDayInfo() { Date = day, IsMentruation = w.Menstruations.IsMenstruationDay(day), Egesta = w.Menstruations.GetEgestaAmount(day), IsOvulation = w.IsPredictedAsOvulationDay(day), HadSex = w.HadSexList[day], BBT = w.BBT.GetBBT(day), Health = w.Health[day], CF = w.CFs[day], Note = w.Notes[day], }); }