private void NavigateToMonth(JewishDate jd) { int day = 0; if (this._selectedDay != null) { day = this._selectedDay.Day; } this.DisplayedJewishMonth = jd; if (day > 0) { if (day == 30 && JewishDateCalculations.DaysInJewishMonth( this._displayedJewishMonth.Year, this._displayedJewishMonth.Month) == 29) { day = 29; } this.SelectSingleDay(new JewishDate(this._displayedJewishMonth.Year, this._displayedJewishMonth.Month, day)); } this.EnableArrows(); }
private void SetValueFromCombos() { int year = ((KeyValuePair <int, string>) this.cmbJYear.SelectedItem).Key, month = ((KeyValuePair <int, string>) this.cmbJMonth.SelectedItem).Key, day = ((KeyValuePair <int, string>) this.cmbJDay.SelectedItem).Key; if (day == 30 && JewishDateCalculations.DaysInJewishMonth(year, month) == 29) { day = 29; } this.Value = new JewishDate(year, month, day); }
private void DisplayHolidays(StringBuilder html) { var shkia = this._dailyZmanim.ShkiaAtElevation; if (this._holidays.Count() > 0) { foreach (var h in this._holidays) { html.AppendFormat("<div class=\"padWidth\">{0}", h.NameEnglish); if (h.NameEnglish == "Shabbos Mevarchim") { var nextMonth = this._displayingJewishDate + 12; html.AppendFormat(" - Chodesh {0}", nextMonth.MonthName); var molad = Molad.GetMolad(nextMonth.Month, nextMonth.Year); var dim = JewishDateCalculations.DaysInJewishMonth(this._displayingJewishDate.Year, this._displayingJewishDate.Month); var dow = dim - this._displayingJewishDate.Day; if (dim == 30) { dow--; } html.AppendFormat("<div>Molad: {0}</div>", molad.ToString(this._dailyZmanim.ShkiaAtElevation)); html.AppendFormat("<div>Rosh Chodesh: {0}{1}</div>", Utils.DaysOfWeek[dow], (dim == 30 ? ", " + Utils.DaysOfWeek[(dow + 1) % 7] : "")); } html.Append("</div>"); if (h.NameEnglish.Contains("Sefiras Ha'omer")) { var dayOfOmer = this._displayingJewishDate.GetDayOfOmer(); html.AppendFormat("<div><a onclick=\"javacript:window.external.showSefirah({0}, false);return false;\" class=\"tahoma nine steelBlue pointer\">{1}</a></div>", dayOfOmer, Utils.GetOmerNusach(dayOfOmer, Properties.Settings.Default.Nusach)); } if (h.DayType.IsSpecialDayType(SpecialDayTypes.EruvTavshilin)) { html.Append("<div class=\"padWidth eight bold crimson\">Eiruv Tavshilin</div>"); } } } html.Append("<table>"); if (shkia != TimeOfDay.NoValue && this._holidays.Any(h => h.DayType.IsSpecialDayType(SpecialDayTypes.HasCandleLighting))) { this.AddLine(html, "Candle Lighting", (shkia - this._dailyZmanim.Location.CandleLighting).ToString(), wideDescription: false); html.Append("<tr><td class=\"nobg\" colspan=\"3\"> </td></tr>"); } }
private void FillJewishDaysCombo() { if (this._value == null) { return; } this.cmbJDay.Items.Clear(); int d = JewishDateCalculations.DaysInJewishMonth(this._value.Year, this._value.Month); for (int i = 1; i <= d; i++) { this.cmbJDay.Items.Add(new KeyValuePair <int, string>(i, this._language == Languages.Hebrew ? i.ToNumberHeb() : i.ToString())); } }
internal void ShowDateData() { this.Cursor = Cursors.WaitCursor; var showSeconds = Properties.Settings.Default.ShowSeconds; var dy = DafYomi.GetDafYomi(this._displayingJewishDate); var netzshkia = this._dailyZmanim.NetzShkiaAtElevation; var netzshkiaMishor = this._dailyZmanim.NetzShkiaMishor; var netz = this._dailyZmanim.NetzAtElevation; var shkia = this._dailyZmanim.ShkiaAtElevation; var netzMishor = this._dailyZmanim.NetzMishor; var shkiaMishor = this._dailyZmanim.ShkiaMishor; var chatzos = this._dailyZmanim.Chatzos; var shaaZmanis = this._dailyZmanim.ShaaZmanis; var shaaZmanis90 = this._dailyZmanim.ShaaZmanisMga; var html = new StringBuilder(); html.AppendFormat("<div class=\"padWidth royalBlue bold\">{0}</div>", this._displayingJewishDate.ToLongDateStringHeb()); html.AppendFormat("<div class=\"padWidth lightSteelBlue\">{0}</div>", this._displayingSecularDate.ToString("D", Program.HebrewCultureInfo)); //If the secular day is a day behind as day being displayed is todays date and it is after sunset, //the user may get confused as the secular date for today and tomorrow will be the same. //So we esplain'in it to them... if (this._secularDateAtMidnight.Date != this._displayingSecularDate.Date) { html.Append("<div class=\"padWidth rosyBrown seven italic\">שים לב: תאריך הלועזי מתחיל בשעה 0:00</div>"); } this.DisplayDateDiff(html); html.Append("<br />"); if (this._holidays.Count() > 0) { foreach (var h in this._holidays) { html.AppendFormat("<div class=\"padWidth\">{0}", h.NameHebrew); if (h.NameEnglish == "Shabbos Mevarchim") { var nextMonth = this._displayingJewishDate + 12; html.AppendFormat(" - חודש {0}", Utils.GetProperMonthNameHeb(nextMonth.Year, nextMonth.Month)); var molad = Molad.GetMolad(nextMonth.Month, nextMonth.Year); var dim = JewishDateCalculations.DaysInJewishMonth(this._displayingJewishDate.Year, this._displayingJewishDate.Month); var dow = dim - this._displayingJewishDate.Day; if (dim == 30) { dow--; } html.AppendFormat("<div>המולד: {0}</div>", molad.ToStringHeb(this._dailyZmanim.ShkiaAtElevation)); html.AppendFormat("<div>ראש חודש: {0}{1}</div>", Utils.JewishDOWNames[dow], (dim == 30 ? ", " + Utils.JewishDOWNames[(dow + 1) % 7] : "")); } html.Append("</div>"); if (h.NameEnglish.Contains("Sefiras Ha'omer")) { var dayOfOmer = this._displayingJewishDate.GetDayOfOmer(); html.AppendFormat("<div><a onclick=\"javacript:window.external.showSefirah({0}, true);return false;\" class=\"nine bluoid pointer\">{1}</a></div>", dayOfOmer, Utils.GetOmerNusach(dayOfOmer, Properties.Settings.Default.Nusach)); } if (h.DayType.IsSpecialDayType(SpecialDayTypes.EruvTavshilin)) { html.Append("<div class=\"padWidth crimson bold\">עירוב תבשילין</div>"); } } } html.Append("<table>"); if (shkia != TimeOfDay.NoValue && this._holidays.Any(h => h.DayType.IsSpecialDayType(SpecialDayTypes.HasCandleLighting))) { this.AddLine(html, "הדלקת נרות", (shkia - this._dailyZmanim.Location.CandleLighting).ToString24H(showSeconds), wideDescription: false); html.Append("<tr><td class=\"nobg\" colspan=\"3\"> </td></tr>"); } this.AddLine(html, "פרשת השבוע", string.Join(" ", Sedra.GetSedra(this._displayingJewishDate, this._dailyZmanim.Location.IsInIsrael).Select(i => i.nameHebrew)), wideDescription: false); if (dy != null) { this.AddLine(html, "דף יומי", dy.ToStringHeb(), wideDescription: false); } html.Append("</table><br />"); html.AppendFormat("<div class=\"padBoth lightSteelBlueBG ghostWhite nine bold clear\">זמני היום ב{0}</div>", this._dailyZmanim.Location.NameHebrew); html.Append("<table>"); if (netz == TimeOfDay.NoValue) { this.AddLine(html, "הנץ החמה", "השמש אינו עולה", bold: true, emphasizeValue: true); } else { if (this._displayingJewishDate.Month == 1 && this._displayingJewishDate.Day == 14) { this.AddLine(html, "סו\"ז אכילת חמץ", ((netz - 90) + (int)Math.Floor(shaaZmanis90 * 4D)).ToString24H(showSeconds), bold: true); this.AddLine(html, "סו\"ז שריפת חמץ", ((netz - 90) + (int)Math.Floor(shaaZmanis90 * 5D)).ToString24H(showSeconds), bold: true); html.Append("<br />"); } this.AddLine(html, "עלות השחר - 90", (netzMishor - 90).ToString24H(showSeconds)); this.AddLine(html, "עלות השחר - 72", (netzMishor - 72).ToString24H(showSeconds)); if (netz == netzMishor) { this.AddLine(html, "הנץ החמה", netz.ToString24H(showSeconds), bold: true, emphasizeValue: true); } else { this.AddLine(html, "הנה\"ח <span class=\"reg lightSteelBlue\">...מ " + this._dailyZmanim.Location.Elevation.ToString() + " מטר</span>", netz.ToString24H(showSeconds)); this.AddLine(html, "הנה\"ח <span class=\"reg lightSteelBlue\">...גובה פני הים</span>", netzMishor.ToString24H(showSeconds), bold: true, emphasizeValue: true); } this.AddLine(html, "סוזק\"ש - מג\"א", this._dailyZmanim.GetZman(ZmanType.KShmMga).ToString24H(showSeconds)); this.AddLine(html, "סוזק\"ש - הגר\"א", this._dailyZmanim.GetZman(ZmanType.KshmGra).ToString24H(showSeconds)); this.AddLine(html, "סוז\"ת - מג\"א", this._dailyZmanim.GetZman(ZmanType.TflMga).ToString24H(showSeconds)); this.AddLine(html, "סוז\"ת - הגר\"א", this._dailyZmanim.GetZman(ZmanType.TflGra).ToString24H(showSeconds)); } if (netz != TimeOfDay.NoValue && shkia != TimeOfDay.NoValue) { this.AddLine(html, "חצות היום והלילה", chatzos.ToString24H(showSeconds)); this.AddLine(html, "מנחה גדולה", this._dailyZmanim.GetZman(ZmanType.MinchaG).ToString24H(showSeconds)); this.AddLine(html, "מנחה קטנה", this._dailyZmanim.GetZman(ZmanType.MinchaK).ToString24H(showSeconds)); this.AddLine(html, "פלג המנחה", this._dailyZmanim.GetZman(ZmanType.MinchaPlg).ToString24H(showSeconds)); } if (shkia == TimeOfDay.NoValue) { this.AddLine(html, "שקיעת החמה", "השמש אינו שוקע", bold: true, emphasizeValue: true); } else { if (shkia == shkiaMishor) { this.AddLine(html, "שקיעת החמה", shkia.ToString24H(showSeconds), bold: true, emphasizeValue: true); } else { this.AddLine(html, "שקה\"ח <span class=\"reg lightSteelBlue\">...גובה פני הים</span>", shkiaMishor.ToString24H(showSeconds)); this.AddLine(html, "שקה\"ח <span class=\"reg lightSteelBlue\">...מ " + this._dailyZmanim.Location.Elevation.ToString() + " מטר</span>", shkia.ToString24H(showSeconds), bold: true, emphasizeValue: true); } this.AddLine(html, "צאת הכוכבים 45", (shkia + 45).ToString24H(showSeconds)); this.AddLine(html, "רבינו תם", (shkia + 72).ToString24H(showSeconds)); this.AddLine(html, "72 דקות זמניות", (shkia + (int)(shaaZmanis * 1.2)).ToString24H(showSeconds)); this.AddLine(html, "72 דקות זמניות לחומרה", (shkia + (int)(shaaZmanis90 * 1.2)).ToString24H(showSeconds)); } html.Append("</table>"); this.webBrowser1.DocumentText = Properties.Resources.InfoHTMLHeb .Replace("{{BODY}}", html.ToString()); this.tableLayoutPanel1.Controls.Clear(); foreach (UserOccasion occ in this._occasions) { this.AddOccasion(occ); } var bg = (from o in this._occasions where o.BackColor != Color.Empty select o.BackColor).FirstOrDefault(); this.tableLayoutPanel1.BackColor = (bg != Color.Empty ? bg.Color : Color.GhostWhite); this.Cursor = Cursors.Default; }