Exemplo n.º 1
0
        public TimeOfDay GetZman(DailyZmanim dz)
        {
            var hm = TimeOfDay.NoValue;

            switch (this.ZmanIndex)
            {
            case 0: hm = (dz.NetzMishor - 90); break;                                 //Alos Hashachar - 90

            case 1: hm = (dz.NetzMishor - 72); break;                                 //Alos Hashachar - 72

            case 2: hm = dz.NetzAtElevation; break;                                   //Sunrise

            case 3: hm = dz.NetzMishor; break;                                        //Sunrise - sea level

            case 4: hm = dz.GetZman(ZmanType.KShmMga); break;                         //Shma - MG\A

            case 5: hm = dz.GetZman(ZmanType.KshmGra); break;                         //Shma - GR\A

            case 6: hm = dz.GetZman(ZmanType.TflMga); break;                          //Tefilla - MG\A

            case 7: hm = dz.GetZman(ZmanType.TflGra); break;                          //Tefilla - GR\A

            case 8: hm = dz.Chatzos; break;                                           //Midday and Midnight

            case 9: hm = dz.GetZman(ZmanType.MinchaG); break;                         //Mincha Gedolah

            case 10: hm = dz.GetZman(ZmanType.MinchaK); break;                        //Mincha Ketana

            case 11: hm = dz.GetZman(ZmanType.MinchaPlg); break;                      //Plag HaMincha

            case 12: hm = dz.ShkiaAtElevation; break;                                 //Sunset

            case 13: hm = dz.ShkiaMishor; break;                                      //Sunset - sea level

            case 14: hm = dz.ShkiaAtElevation + 45; break;                            //Night - 45

            case 15: hm = dz.ShkiaAtElevation + 72; break;                            //Night - Rabbeinu Tam

            case 16: hm = dz.ShkiaAtElevation + (int)(dz.ShaaZmanisMga * 1.2); break; //Night - 72 Zmaniyos
            }
            var isYomTov        = SpecialDay.IsShabbosOrYomTov(dz.JewishDate, dz.Location);
            var hasYomTovOffset = !this.DaysOfWeek.Contains(7);
            var showYomTov      = isYomTov && hasYomTovOffset;

            if (this.Offset != 0 &&
                (this.DaysOfWeek == null ||
                 this.DaysOfWeek.Contains((int)dz.SecularDate.DayOfWeek)) && (!showYomTov))
            {
                hm += this.Offset;
            }
            else if (this.AlternateOffset != 0 &&
                     this.DaysOfWeek != null &&
                     ((!this.DaysOfWeek.Contains((int)dz.SecularDate.DayOfWeek)) ||
                      showYomTov))
            {
                hm += this.AlternateOffset;
            }
            return(hm);
        }
Exemplo n.º 2
0
 private void GoToDate(DateTime date)
 {
     this._displayingSecularDate = date;
     this._displayingJewishDate  = new JewishDate(date);
     this.SetSecularDate();
     this._dailyZmanim = new DailyZmanim(this._secularDateAtMidnight, Program.CurrentLocation);
     this.ShowCurrentDateZmanimData();
 }
        public frmDailyInfoEng(JewishDate jd, Location location)
        {
            this._displayingJewishDate = jd;
            this._dailyZmanim          = new DailyZmanim(jd.GregorianDate, location);
            this._holidays             = Zmanim.GetHolidays(jd, location.IsInIsrael).Cast <SpecialDay>();
            this._occasions            = UserOccasionColection.FromSettings(jd);

            InitializeComponent();

            this._lblOccasionFont = new Font(this.Font, FontStyle.Bold);
            this.webBrowser1.ObjectForScripting = new ScriptingObject();
        }
        public frmDailyInfoHeb(JewishDate jd, Location location)
        {
            this._displayingJewishDate = jd;
            this.SetSecularDate();
            this._dailyZmanim = new DailyZmanim(this._secularDateAtMidnight, location);
            this._holidays    = Zmanim.GetHolidays(jd, location.IsInIsrael).Cast <SpecialDay>();
            this._occasions   = UserOccasionColection.FromSettings(jd);

            InitializeComponent();

            this._lblOccasionFont = new Font(this.tableLayoutPanel1.Font, FontStyle.Bold);
            this.webBrowser1.ObjectForScripting = new ScriptingObject();
        }
Exemplo n.º 5
0
            public TimeOfDay GetZman(DailyZmanim dz)
            {
                var hm = TimeOfDay.NoValue;

                switch (this.ZmanIndex)
                {
                case 0: hm = (dz.NetzMishor - 90); break;                                 //Alos Hashachar - 90

                case 1: hm = (dz.NetzMishor - 72); break;                                 //Alos Hashachar - 72

                case 2: hm = dz.NetzAtElevation; break;                                   //Sunrise

                case 3: hm = dz.NetzMishor; break;                                        //Sunrise - sea level

                case 4: hm = dz.GetZman(ZmanType.KShmMga); break;                         //Shma - MG\A

                case 5: hm = dz.GetZman(ZmanType.KshmGra); break;                         //Shma - GR\A

                case 6: hm = dz.GetZman(ZmanType.TflMga); break;                          //Tefilla - MG\A

                case 7: hm = dz.GetZman(ZmanType.TflGra); break;                          //Tefilla - GR\A

                case 8: hm = dz.Chatzos; break;                                           //Midday and Midnight

                case 9: hm = dz.GetZman(ZmanType.MinchaG); break;                         //Mincha Gedolah

                case 10: hm = dz.GetZman(ZmanType.MinchaK); break;                        //Mincha Ketana

                case 11: hm = dz.GetZman(ZmanType.MinchaPlg); break;                      //Plag HaMincha

                case 12: hm = dz.ShkiaAtElevation; break;                                 //Sunset

                case 13: hm = dz.ShkiaMishor; break;                                      //Sunset - sea level

                case 14: hm = dz.ShkiaAtElevation + 45; break;                            //Night - 45

                case 15: hm = dz.ShkiaAtElevation + 72; break;                            //Night - Rabbeinu Tam

                case 16: hm = dz.ShkiaAtElevation + (int)(dz.ShaaZmanisMga * 1.2); break; //Night - 72 Zmaniyos
                }
                if (this.Offset != 0)
                {
                    hm += this.Offset;
                }
                return(hm);
            }
Exemplo n.º 6
0
        private void btnToday_Click(object sender, EventArgs e)
        {
            this._loading = true;
            this._displayingSecularDate = DateTime.Now;
            this._displayingJewishDate  = new JewishDate(this._displayingSecularDate);
            this.SetSecularDate();
            this._dailyZmanim = new DailyZmanim(this._secularDateAtMidnight, Program.CurrentLocation);
            if (this._dailyZmanim.ShkiaAtElevation <= DateTime.Now.TimeOfDay)
            {
                this._displayingSecularDate = this._displayingSecularDate.AddDays(1);
                this._displayingJewishDate  = new JewishDate(this._displayingSecularDate);
                this.SetSecularDate();
                this._dailyZmanim = new DailyZmanim(this._secularDateAtMidnight, Program.CurrentLocation);
            }

            this.ShowCurrentDateZmanimData();
            this.SetDayNightRadio();
            this.FillProblemOnahs();
            this._loading = false;
        }
Exemplo n.º 7
0
        private string getHtml()
        {
            StringBuilder html     = new StringBuilder();
            Location      location = new JewishCalendar.Location
            {
                LatitudeDegrees = (int)this.latDeg.Value,
                LatitudeMinutes = (double)(this.latDeg.Value +
                                           (this.latSec.Value / 60M)),
                LongitudeDegrees = (int)this.longDeg.Value,
                LongitudeMinutes = (double)(this.longDeg.Value +
                                            (this.longSec.Value / 60M)),
                Elevation = (int)this.nudElevation.Value,
                TimeZone  = (int)this.nudTimeZone.Value
            };
            var dz = new DailyZmanim(this.jdpFrom.Value.GregorianDate, location);

            html.AppendFormat("<h2>Zmanim at {0} feet</h2>", location.Elevation);
            html.Append("<ul>");
            if (dz.NetzMishor == TimeOfDay.NoValue)
            {
                html.Append("<li><strong>The sun does not rise at this location</strong></li>");
            }
            else
            {
                html.AppendFormat("<li>Alos - 90........<strong>{0}</strong></li>",
                                  dz.GetZman(ZmanType.NetzMishor, -90));
                html.AppendFormat("<li>Alos - 72........<strong>{0}</strong></li>",
                                  dz.GetZman(ZmanType.NetzMishor, -72));
                html.AppendFormat("<li>Mishyakir - 36........<strong>{0}</strong></li>",
                                  dz.GetZman(ZmanType.NetzMishor, -36));
                html.AppendFormat("<li>Netz at sea level........<strong>{0}</strong></li>",
                                  dz.NetzMishor);
            }
            if (dz.NetzAtElevation == TimeOfDay.NoValue)
            {
                html.AppendFormat("<li><strong>The sun does not rise at {0} feet at this location</strong></li>", location.Elevation);
            }
            else
            {
                html.AppendFormat("<li>Netz at elevation........<strong>{0}</strong></li>",
                                  dz.NetzAtElevation);
            }
            if (dz.NetzMishor == TimeOfDay.NoValue)
            {
                html.Append("<li><strong>The sun does not rise at this location</strong></li>");
            }
            else
            {
                html.AppendFormat("<li>Krias Shma MG\"A........<strong>{0}</strong></li>",
                                  dz.GetZman(ZmanType.KShmMga));
                html.AppendFormat("<li>Krias Shma GR\"A........<strong>{0}</strong></li>",
                                  dz.GetZman(ZmanType.KshmGra));
                html.AppendFormat("<li>Tefilla MG\"A........<strong>{0}</strong></li>",
                                  dz.GetZman(ZmanType.TflMga));
                html.AppendFormat("<li>Tefilla GR\"A........<strong>{0}</strong></li>",
                                  dz.GetZman(ZmanType.TflGra));
            }

            html.AppendFormat("<li>Chatzos........<strong>{0}</strong></li>",
                              dz.GetZman(ZmanType.Chatzos));
            html.AppendFormat("<li>Mincha Gedola........<strong>{0}</strong></li>",
                              dz.GetZman(ZmanType.MinchaG));
            html.AppendFormat("<li>MIncha Ketana........<strong>{0}</strong></li>",
                              dz.GetZman(ZmanType.MinchaK));
            html.AppendFormat("<li>Plag........<strong>{0}</strong></li>",
                              dz.GetZman(ZmanType.MinchaPlg));
            if (dz.ShkiaMishor == TimeOfDay.NoValue)
            {
                html.Append("<li>Sunset at sea level........<strong>The sun does not set at this location</strong></li>");
            }
            else
            {
                html.AppendFormat("<li>Sunset at sea level........<strong>{0}</strong></li>",
                                  dz.ShkiaMishor);
            }
            if (dz.ShkiaAtElevation == TimeOfDay.NoValue)
            {
                html.AppendFormat("<li>Sunset at {0} feet........<strong>The sun does not set at {0} feet at this location</strong></li>",
                                  location.Elevation);
            }
            else
            {
                html.AppendFormat("<li>Sunset at elevation........<strong>{0}</strong></li>",
                                  dz.ShkiaAtElevation);
                html.AppendFormat("<li>Night (45 minutes)........<strong>{0}</strong></li>",
                                  dz.GetZman(ZmanType.ShkiaAtElevation, 45));
                html.AppendFormat("<li>Night (72 minutes)........<strong>{0}</strong></li>",
                                  dz.GetZman(ZmanType.ShkiaAtElevation, 72));
            }


            html.Append("</ul>");
            return(Properties.Resources.template.Replace("#--CONTENT--#",
                                                         html.ToString()));
        }
Exemplo n.º 8
0
        private string GetHtml()
        {
            Location            location      = (Location)this.cmbLocations.SelectedItem;
            int                 month         = this.GetSelectedMonth();
            int                 year          = this.GetSelectedYear();
            StringBuilder       sbHeaderCells = new StringBuilder();
            StringBuilder       sbRows        = new StringBuilder();
            bool                showMonth     = this.choiceSwitcherDateType.ChoiceOneSelected;
            JewishDate          jd            = showMonth ? new JewishDate(year, month, 1) : this.jdpFrom.Value;
            DailyZmanim         dz            = new DailyZmanim(jd.GregorianDate, location);
            string              startSMonth   = dz.SecularDate.ToString("MM yyyy");
            SelectedZmanColumns columns       = this.GetSelectedColumns();
            bool                showSeconds   = this.choiceSeconds.ChoiceOneSelected;

            //Once "Generate" is clicked, we save the columns selected.
            Properties.Settings.Default.SelectedZmanColumns = columns;
            Properties.Settings.Default.ArmyTime            = this.choiceArmy.ChoiceOneSelected;
            Properties.Settings.Default.AmPm            = this.choiceAmPm.ChoiceOneSelected;
            Properties.Settings.Default.Width100        = (bool)this.choiceWidth100.SelectedValue;
            Properties.Settings.Default.DirectionRight  = (bool)this.choiceDirection.SelectedValue;
            Properties.Settings.Default.DateChooseMonth = this.choiceSwitcherDateType.ChoiceOneSelected;
            Properties.Settings.Default.ShowSeconds     = this.choiceSeconds.ChoiceOneSelected;
            Properties.Settings.Default.ShowDayDetails  = this.choiceDayDetails.ChoiceOneSelected;
            this.SaveDayOfWeek();

            var columnsSorted = from c in columns orderby c.ZmanIndex, c.Offset select c;

            foreach (var zmanColumn in columnsSorted)
            {
                sbHeaderCells.AppendFormat("<th>{0}</th>", zmanColumn.Header);
            }
            while (true)
            {
                sbRows.AppendFormat("<tr{0}>",
                                    (jd.DayOfWeek == DayOfWeek.Saturday ||
                                     SpecialDay.IsMajorYomTov(jd, location) ? " class='special'" :
                                     SpecialDay.IsMinorYomTovOrFast(jd, location) ? " class='special2'" : ""));

                if (Properties.Settings.Default.DOWFormat != DayOfWeekFormat.None)
                {
                    sbRows.AppendFormat("<td class=\"dow {0}\">{1}</td>",
                                        this.rbDOWEnglish.Checked ? "left" : "right",
                                        this.GetDayOfWeekString(jd, location));
                }

                sbRows.AppendFormat(
                    "<td style=\"direction:rtl;\">{0}</td><td>{1}</td>",
                    Utils.ToNumberHeb(jd.Day),
                    dz.SecularDate.Day);


                foreach (var zmanColumn in columnsSorted)
                {
                    string    zmanTime = null;
                    TimeOfDay zman     = TimeOfDay.NoValue;
                    if (zmanColumn.ZmanIndex == 17)
                    {
                        zmanTime = DafYomi.GetDafYomi(jd).ToStringHeb();
                    }
                    else if (zmanColumn.DaysOfWeek == null /* All days */ ||
                             zmanColumn.DaysOfWeek.Contains(jd.DayInWeek) ||
                             zmanColumn.AlternateOffset != 0)
                    {
                        zman = zmanColumn.GetZman(dz);
                        //For netz, if we are not showing seconds, we show the end of the minute
                        if (!showSeconds && zmanColumn.ZmanIndex.In(2, 3) && zman.Seconds > 0)
                        {
                            zman += 1;
                        }
                        zmanTime = zman.ToString(
                            Properties.Settings.Default.ArmyTime,
                            Properties.Settings.Default.AmPm);
                    }
                    if (!string.IsNullOrEmpty(zmanTime))
                    {
                        if (zmanColumn.Bold)
                        {
                            zmanTime = "<strong>" + zmanTime + "</strong>";
                        }
                        if (zman != TimeOfDay.NoValue && Properties.Settings.Default.ShowSeconds)
                        {
                            zmanTime += "<sub>:" +
                                        (zman.Seconds < 10 ? "0" : "") +
                                        zman.Seconds.ToString() + "</sub>";
                        }
                    }
                    sbRows.AppendFormat("<td>{0}</td>", zmanTime);
                }

                jd = jd + 1;
                if (showMonth ? jd.Month == month : jd <= this.jdpTo.Value)
                {
                    dz.SecularDate = jd.GregorianDate;
                }
                else
                {
                    sbRows.Append("</tr>");
                    break;
                }
            }
            string endSMonth   = dz.SecularDate.ToString("MM yyyy");
            string monthHeader = showMonth ?
                                 Utils.JewishMonthNamesHebrew[month] + " " + Utils.ToNumberHeb(year % 1000) :
                                 this.getFromToHeaderText();
            int inBuiltColsCount = Properties.Settings.Default.DOWFormat == DayOfWeekFormat.None ? 2 : 3;

            return(Properties.Resources.template
                   .Replace("#--DIRECTION--#", (Properties.Settings.Default.DirectionRight ? "direction:rtl;" : ""))
                   .Replace("#--TOTAL_CELLS--#", (columns.Count + inBuiltColsCount).ToString())
                   .Replace("#--LOCATION--#", location.NameHebrew)
                   .Replace("#--TABLE_WIDTH--#", Properties.Settings.Default.Width100 ? "width: 100%;" : "")
                   .Replace("#--MONTH--#", "<strong>" + monthHeader + "</strong> (" +
                            startSMonth +
                            (startSMonth != endSMonth ? " - " + endSMonth : "") + ")")
                   .Replace("#--HEADER_CELLS--#", sbHeaderCells.ToString())
                   .Replace("#--LOCATION_COL_SPAN--#", inBuiltColsCount.ToString())
                   .Replace("#--VALUE_ROWS--#", sbRows.ToString()));
        }