Esempio n. 1
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);
        }
Esempio n. 2
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);
        }