Example #1
0
        public List <Festival> CompleteFestivalList(GPCalendarDay prevDay, GPCalendarDay nextDay)
        {
            List <Festival> fests = new List <Festival>();

            if (hasEkadasiParana())
            {
                fests.Add(new Festival(10, getEkadasiParanaString()));
            }


            foreach (Festival fest in Festivals)
            {
                fests.Add(fest);
            }

            if (sankranti_zodiac >= 0)
            {
                fests.Add(new Festival(300, GPDisplays.Keys.CalendarSankranti, string.Format(GPStrings.getString(975), GPSankranti.getName(sankranti_zodiac), sankranti_day.ToString(), sankranti_day.getLongTimeString())));
            }

            if (hasKsayaTithi())
            {
                fests.Add(new Festival(301, GPDisplays.Keys.CalendarKsaya, string.Format(GPStrings.getString(976), ksayaTithi.getName(), getKsayaTimeString(0), getKsayaTimeString(1))));
            }

            if (IsSecondDayTithi)
            {
                fests.Add(new Festival(302, GPDisplays.Keys.CalendarVriddhi, GPStrings.getString(977)));
            }

            // tithi at arunodaya
            if (GPDisplays.Calendar.TithiArunodayaVisible())
            {
                fests.Add(new Festival(303, GPDisplays.Keys.CalArunodayaTithi, string.Format("{0}: {1}", GPStrings.getString(98), GPTithi.getName(astrodata.getTithiAtArunodaya()))));
            }

            //"Arunodaya Time",//1
            if (GPDisplays.Calendar.TimeArunodayaVisible())
            {
                fests.Add(new Festival(304, GPDisplays.Keys.CalArunodayaTime, string.Format(GPStrings.getString(99), astrodata.sun.arunodaya.getShortTimeString())));
            }

            //List<string> gstr = GPStrings.getSharedStrings().gstr;

            if (GPDisplays.Calendar.TimeSunriseVisible())
            {
                fests.Add(new Festival(305, GPDisplays.Keys.CalSunriseTime, string.Format("{0} {1}", GPStrings.getString(51), astrodata.sun.rise.getShortTimeString())));
            }

            if (GPDisplays.Calendar.NoonTime())
            {
                fests.Add(new Festival(306, GPDisplays.Keys.CalNoonTime, string.Format("{0} {1}", GPStrings.getString(857), astrodata.sun.noon.getShortTimeString())));
            }

            if (GPDisplays.Calendar.TimeSunsetVisible())
            {
                fests.Add(new Festival(307, GPDisplays.Keys.CalSunsetTime, string.Format("{0} {1}", GPStrings.getString(52), astrodata.sun.set.getShortTimeString())));
            }

            if (GPDisplays.Calendar.TimeMoonriseVisible())
            {
                if (moonrise != null)
                {
                    fests.Add(new Festival(308, GPDisplays.Keys.CalMoonriseTime, string.Format("{0} {1}", GPStrings.getString(53), moonrise.getShortTimeString())));
                }
            }

            if (GPDisplays.Calendar.TimeMoonsetVisible())
            {
                if (moonset != null)
                {
                    fests.Add(new Festival(309, GPDisplays.Keys.CalMoonsetTime, string.Format("{0} {1}", GPStrings.getString(54), moonset.getShortTimeString())));
                }
            }

            if (GPDisplays.Calendar.SunLongitudeVisible())
            {
                fests.Add(new Festival(310, GPDisplays.Keys.CalSunLong, string.Format("{0}: {1} (*)", GPStrings.getString(100), astrodata.sun.eclipticalLongitude)));
            }

            if (GPDisplays.Calendar.MoonLongitudeVisible())
            {
                fests.Add(new Festival(311, GPDisplays.Keys.CalMoonLong, string.Format("{0}: {1} (*)", GPStrings.getString(101), astrodata.moon.longitude_deg)));
            }

            if (GPDisplays.Calendar.AyanamsaValueVisible())
            {
                fests.Add(new Festival(312, GPDisplays.Keys.CalAyanamsa, string.Format("{0} {1} ({2}) (*)", GPStrings.getString(102), astrodata.msAyanamsa, GPAyanamsa.CurrentName)));
            }

            if (GPDisplays.Calendar.JulianDayVisible())
            {
                fests.Add(new Festival(313, GPDisplays.Keys.CalJulian, string.Format("{0} {1} (*)", GPStrings.getString(103), astrodata.jdate)));
            }

            if (GPDisplays.Calendar.StartMasaVisible())
            {
                if (prevDay != null)
                {
                    if (prevDay.astrodata.nMasa != this.astrodata.nMasa)
                    {
                        fests.Add(new Festival(314, GPDisplays.Keys.CalMasaChange, string.Format("{0} {1} {2}", GPStrings.getString(780), GPMasa.GetName(astrodata.nMasa), GPStrings.getString(22))));
                    }
                }
                if (nextDay != null)
                {
                    if (nextDay.astrodata.nMasa != this.astrodata.nMasa)
                    {
                        fests.Add(new Festival(315, GPDisplays.Keys.CalDstChange, string.Format("{0} {1} {2}", GPStrings.getString(781), GPMasa.GetName(astrodata.nMasa), GPStrings.getString(22))));
                    }
                }
            }

            if (GPDisplays.Calendar.DSTNotice())
            {
                if (prevDay != null && prevDay.isDaylightInEffect() == 0 && this.isDaylightInEffect() == 1)
                {
                    fests.Add(new Festival(316, GPDisplays.Keys.CalDstChange, GPStrings.getString(855)));
                }

                if (nextDay != null && this.isDaylightInEffect() == 1 && nextDay.isDaylightInEffect() == 0)
                {
                    fests.Add(new Festival(316, GPDisplays.Keys.CalDstChange, GPStrings.getString(856)));
                }
            }
            return(fests);
        }
Example #2
0
        public static void FormatTodayInfoRtf(GPGregorianTime vc, GPLocationProvider loc, StringBuilder str)
        {
            string str2, str3 = string.Empty;

            GPCalendarResults db = new GPCalendarResults();

            GPGregorianTime vc2 = new GPGregorianTime(vc);

            vc2.PreviousDay();
            vc2.PreviousDay();
            vc2.PreviousDay();
            vc2.PreviousDay();
            db.CalculateCalendar(vc2, 9);

            int           i = db.FindDate(vc);
            GPCalendarDay p = db.get(i);

            if (p == null)
            {
                return;
            }

            str.Remove(0, str.Length);
            AppendRtfHeader(str);
            str2 = string.Format("\\f2\\fs{0} {1} ", g_HeaderSize, GPAppHelper.getDateText(vc));
            str.Append(str2);

            str.AppendFormat("\\par\\f2\\fs{0} {{\\fs{1} {2}}\\line {3} ({4}, {5}, {6}: {7})",
                             g_TextSize, g_TextSize + 4, getSharedStringRtf(p.date.getDayOfWeek()), loc.getFullName(), loc.getLocation(0).getLatitudeString(),
                             loc.getLocation(0).getLongitudeString(), getSharedStringRtf(12),
                             loc.getLocation(0).getTimeZoneName());
            str.AppendLine("\\par");
            str.AppendLine("\\par");
            str.AppendFormat("  {0}, {1}", p.getTithiName(), p.getPaksaName());
            str.AppendLine("\\par");
            str.AppendFormat("  {0}, {1}", p.getMasaLongName(), p.getGaurabdaYearLongString());
            str.AppendLine("\\par");
            str.AppendLine("\\par");


            // adding mahadvadasi
            // adding spec festivals

            foreach (GPCalendarDay.Festival fest in p.CompleteFestivalList(db.get(i - 1), db.get(i + 1)))
            {
                if (GPUserDefaults.BoolForKey(fest.ShowSettingItem, true))
                {
                    if (fest.ShowSettingItem == GPDisplays.Keys.CalendarSankranti)
                    {
                        str.AppendLine(fest.Text.PadLeft((80 + str2.Length) / 2, '-').PadRight(80, '-'));
                        str.AppendLine("\\par");
                    }
                    else
                    {
                        str.Append("\\tab");
                        str.Append(fest.Text);
                        str.AppendLine("\\par");
                    }
                }
            }

            str.AppendLine("\\par");


            if (GPDisplays.Today.BrahmaMuhurtaVisible())
            {
                str.AppendLine("\\par");
                str.AppendFormat("{0} {1}", getSharedStringRtf(988), p.astrodata.sun.arunodaya.getShortMuhurtaRange(0));
            }

            if (GPDisplays.Today.SunriseVisible())
            {
                str.AppendLine("\\par");
                str.AppendFormat("{0} {1} ", getSharedStringRtf(51), p.astrodata.sun.rise.getShortTimeString());
                if (GPDisplays.Today.SandhyaTimesVisible())
                {
                    str.AppendFormat(" {0} {1} ", getSharedStringRtf(989), p.astrodata.sun.rise.getShortSandhyaRange());
                }
                str.AppendFormat(" ({0})", GPAppHelper.GetDSTSignature(p.isDaylightInEffect()));
                str.AppendLine("\\par");
            }
            if (GPDisplays.Today.NoonVisible())
            {
                str2 = string.Format("{0} {1} ", getSharedStringRtf(857), p.astrodata.sun.noon.getShortTimeString());
                str.Append(str2);
                if (GPDisplays.Today.SandhyaTimesVisible())
                {
                    str.AppendFormat(" {0} {1} ", getSharedStringRtf(989), p.astrodata.sun.noon.getShortSandhyaRange());
                }
                str.AppendFormat(" ({0})", GPAppHelper.GetDSTSignature(p.isDaylightInEffect()));
                str.AppendLine("\\par");
            }
            if (GPDisplays.Today.SunsetVisible())
            {
                str.AppendFormat("{0}  {1} ", getSharedStringRtf(52), p.astrodata.sun.set.getShortTimeString());
                if (GPDisplays.Today.SandhyaTimesVisible())
                {
                    str.AppendFormat(" {0} {1} ", getSharedStringRtf(989), p.astrodata.sun.set.getShortSandhyaRange());
                }
                str.AppendFormat(" ({0})", GPAppHelper.GetDSTSignature(p.isDaylightInEffect()));
                str.AppendLine("\\par");
            }
            if (GPDisplays.Today.SunriseInfo())
            {
                str.AppendLine("\\par");
                str.Append(getSharedStringRtf(990));
                str.AppendLine("\\par");
                str.AppendFormat("   {1} {2}", GPNaksatra.getName(p.astrodata.nNaksatra), getSharedStringRtf(15));
                if (GPDisplays.Today.NaksatraPadaVisible())
                {
                    str.AppendFormat(", {0} {1} ({2})", p.astrodata.nNaksatraElapse, getSharedStringRtf(993), getSharedStringRtf(811 + p.getNaksatraPada()));
                }
                if (GPDisplays.Today.RasiOfMoonVisible())
                {
                    str.AppendFormat(", {0}: {1}", getSharedStringRtf(991), GPSankranti.getName(p.astrodata.nMoonRasi));
                }
                str.AppendFormat(", {0} {1}", GPYoga.getName(p.astrodata.nYoga), getSharedStringRtf(104));
                str.AppendLine("\\par");
                str.AppendFormat("  {0} {1}", getSharedStringRtf(992), GPSankranti.getName(p.astrodata.nSunRasi));
                str.AppendLine("\\par");
            }
            /* END GCAL 1.4.3 */

            AddNoteRtf(str);
        }
Example #3
0
        public static void AvcGetTodayInfo(GPGregorianTime vc, GPLocationProvider loc, StringBuilder str)
        {
            string str2;

            GPCalendarResults db = new GPCalendarResults();

            GPGregorianTime vc2 = new GPGregorianTime(vc);

            vc2.AddDays(-4);
            db.CalculateCalendar(vc2, 9);

            int           i = db.FindDate(vc);
            GPCalendarDay p = db.get(i);

            if (p == null)
            {
                return;
            }

            str.AppendFormat("{0}, {1} {2}", loc.getFullName(), loc.getLocation(0).getLatitudeString(), loc.getLocation(0).getLongitudeString());
            str.AppendLine();
            str.AppendFormat("{0}: {1}", getSharedStringPlain(12), loc.getLocation(0).getTimeZoneString());
            str.AppendLine();
            str.AppendLine();
            str.AppendFormat("[{0} - {1}]", vc, getSharedStringPlain(vc.getDayOfWeek()));
            str.AppendLine();
            str.AppendFormat("  {0}, {1} {2}", GPTithi.getName(p.astrodata.nTithi), GPPaksa.getName(p.astrodata.nPaksa), getSharedStringPlain(20));
            str.AppendLine();
            str.Append("  ");
            str.AppendFormat("{0}, {1}", p.getMasaLongName(), p.getGaurabdaYearLongString());
            str.AppendLine();
            str.AppendLine();

            if (p.hasEkadasiParana())
            {
                str.AppendLine(p.getEkadasiParanaString());
            }

            // adding mahadvadasi
            // adding spec festivals

            foreach (GPCalendarDay.Festival fest in p.CompleteFestivalList(db.get(i - 1), db.get(i + 1)))
            {
                if (GPUserDefaults.BoolForKey(fest.ShowSettingItem, true))
                {
                    if (fest.ShowSettingItem == GPDisplays.Keys.CalendarSankranti)
                    {
                        str.AppendLine(GPAppHelper.CenterString(fest.Text, 80, '-'));
                    }
                    else
                    {
                        str.AppendFormat("   {0}", fest.Text);
                        str.AppendLine();
                    }
                }
            }


            str.AppendLine();


            if (GPDisplays.Today.BrahmaMuhurtaVisible())
            {
                str.AppendLine();
                str.AppendFormat("{0} {1}", getSharedStringPlain(988), p.astrodata.sun.arunodaya.getShortMuhurtaRange(0));
            }

            if (GPDisplays.Today.SunriseVisible())
            {
                str.AppendLine();
                str2 = string.Format("{0} {1} ",
                                     getSharedStringPlain(51), p.astrodata.sun.rise.getShortTimeString());
                str.Append(str2);
                if (GPDisplays.Today.SandhyaTimesVisible())
                {
                    str.AppendFormat(" {0} {1}", getSharedStringPlain(989), p.astrodata.sun.rise.getShortSandhyaRange());
                }
                str.AppendFormat(" ({0})", GPAppHelper.GetDSTSignature(p.isDaylightInEffect()));
                str.AppendLine();
            }
            if (GPDisplays.Today.NoonVisible())
            {
                str2 = string.Format("{0}    {1} ", getSharedStringPlain(857), p.astrodata.sun.noon.getShortTimeString());
                str.Append(str2);
                if (GPDisplays.Today.SandhyaTimesVisible())
                {
                    str.AppendFormat(" {0} {1} ", getSharedStringPlain(989), p.astrodata.sun.noon.getShortSandhyaRange());
                }
                str2 = string.Format(" ({0})", GPAppHelper.GetDSTSignature(p.isDaylightInEffect()));
                str.Append(str2);
                str.AppendLine();
            }
            if (GPDisplays.Today.SunsetVisible())
            {
                str2 = string.Format("{0}  {1} ", getSharedStringPlain(52), p.astrodata.sun.set.getShortTimeString());
                str.Append(str2);
                if (GPDisplays.Today.SandhyaTimesVisible())
                {
                    str.AppendFormat(" {0} {1} ", getSharedStringPlain(989), p.astrodata.sun.set.getShortSandhyaRange());
                }
                str.AppendFormat(" ({0})", GPAppHelper.GetDSTSignature(p.isDaylightInEffect()));
                str.AppendLine();
            }

            if (GPDisplays.Today.SunriseInfo())
            {
                str.AppendLine();
                str.AppendLine(getSharedStringPlain(990));
                str.AppendLine();
                str.AppendFormat("   {0} {1}", GPNaksatra.getName(p.astrodata.nNaksatra), getSharedStringPlain(15));
                if (GPDisplays.Today.NaksatraPadaVisible())
                {
                    str.AppendFormat(", {0} {1} ({2})", p.getNaksatraElapsedString(), getSharedStringPlain(993), getSharedStringPlain(811 + p.getNaksatraPada()));
                }
                if (GPDisplays.Today.RasiOfMoonVisible())
                {
                    str.AppendFormat(", {0}: {1}", getSharedStringPlain(991), GPSankranti.getName(p.astrodata.nMoonRasi), getSharedStringPlain(105));
                }
                str.AppendFormat(", {0} {1}", GPYoga.getName(p.astrodata.nYoga), getSharedStringPlain(104));
                str.AppendLine();
                str.AppendFormat("   {0}: {1}.", getSharedStringPlain(992), GPSankranti.getName(p.astrodata.nSunRasi));
                str.AppendLine();
            }

            AddNoteText(str);
        }