示例#1
0
        public static int WriteXML_FirstDay_Year(StringBuilder doc, GPGregorianTime vcStart)
        {
            vcStart = GPGaurabdaYear.getFirstDayOfYear(vcStart.getLocationProvider(), vcStart.getYear());

            // write
            doc.Append("<xml>\n");
            doc.Append("\t\t<arg name=\"longitude\" val=\"" + vcStart.getLocation().GetLongitudeEastPositive() + "\" />\n");
            doc.Append("\t\t<arg name=\"latitude\" val=\"" + vcStart.getLocation().GetLatitudeNorthPositive() + "\" />\n");
            doc.Append("\t\t<arg name=\"year\" val=\"" + vcStart.getYear() + "\" />\n");
            doc.Append("\t</request>\n");
            doc.Append("\t<result name=\"FirstDay_of_GaurabdaYear\">\n");
            doc.Append("\t\t<firstday date=\"" + vcStart
                       + "\" dayweekid = \"" + vcStart.getDayOfWeek() + "\" dayweek=\"" + getSharedStringHtml(vcStart.getDayOfWeek()) + "\" />\n");
            doc.Append("\t</result>\n");
            doc.Append("</xml>\n");

            return(0);
        }
示例#2
0
 public string getWeekdayAbbr()
 {
     return(GPStrings.getString(date.getDayOfWeek()).Substring(2));
 }
示例#3
0
        /// <summary>
        /// get date text for today screen
        /// </summary>
        /// <param name="vc"></param>
        public static string getDateText(GPGregorianTime vc)
        {
            string str = string.Empty;

            getShared().TodayDate = new GPGregorianTime(vc);
            getShared().TodayDate.Today();

            int input = Convert.ToInt32(vc.getJulianLocalNoon());
            int today = Convert.ToInt32(getShared().TodayDate.getJulianLocalNoon());

            if ((vc.getDay() > 0) && (vc.getDay() < 32) && (vc.getMonth() > 0) && (vc.getMonth() < 13) && (vc.getYear() >= 1500) && (vc.getYear() < 4000))
            {
                if (input - today == 0)
                {
                    str = string.Format("{0} ({1}) - {2}", vc.ToString(), GPStrings.getString(43), GPStrings.getString(vc.getDayOfWeek()));
                }
                else if (input - today == 1)
                {
                    str = string.Format("{0} ({1}) - {2}", vc.ToString(), GPStrings.getString(854), GPStrings.getString(vc.getDayOfWeek()));
                }
                else if (input - today == -1)
                {
                    str = string.Format("{0} ({1}) - {2}", vc.ToString(), GPStrings.getString(853), GPStrings.getString(vc.getDayOfWeek()));
                }
                else
                {
                    str = string.Format("{0} - {1}", vc.ToString(), GPStrings.getString(vc.getDayOfWeek()));
                }
            }

            return(str);
        }
示例#4
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);
        }
示例#5
0
        public static XmlDocument GetSankrantiXml(GPLocationProvider loc, GPGregorianTime vcStart, GPGregorianTime vcEnd)
        {
            XmlDocument doc = new XmlDocument();
            XmlElement  e1, e2, e3, eday, e5, e6;

            GPGregorianTime d = new GPGregorianTime(loc);
            int             zodiac;

            d.Copy(vcStart);


            e1 = doc.CreateElement("xml");
            doc.AppendChild(e1);

            e2 = doc.CreateElement("request");
            e1.AppendChild(e2);
            e2.SetAttribute("name", "Sankranti");
            e2.SetAttribute("version", GPFileHelper.FileVersion);

            e3 = doc.CreateElement("arg");
            e2.AppendChild(e3);
            e3.SetAttribute("name", "longitude");
            e3.SetAttribute("val", loc.GetLongitudeEastPositive().ToString());

            e3 = doc.CreateElement("arg");
            e2.AppendChild(e3);
            e3.SetAttribute("name", "latitude");
            e3.SetAttribute("val", loc.GetLatitudeNorthPositive().ToString());

            e3 = doc.CreateElement("arg");
            e2.AppendChild(e3);
            e3.SetAttribute("name", "timezone");
            e3.SetAttribute("val", (loc.getTimeZone().OffsetSeconds / 60).ToString());

            e3 = doc.CreateElement("arg");
            e2.AppendChild(e3);
            e3.SetAttribute("name", "startdate");
            e3.SetAttribute("val", vcStart.ToString());

            e3 = doc.CreateElement("arg");
            e2.AppendChild(e3);
            e3.SetAttribute("name", "enddate");
            e3.SetAttribute("val", vcEnd.ToString());

            e2 = doc.CreateElement("result");
            e1.AppendChild(e2);
            e2.SetAttribute("name", "SankrantiList");



            while (d.IsBeforeThis(vcEnd))
            {
                d = GPSankranti.GetNextSankranti(d, out zodiac);

                eday = doc.CreateElement("sank");
                e2.AppendChild(eday);

                eday.SetAttribute("date", d.getLongDateString());
                eday.SetAttribute("time", d.getLongTimeString());
                eday.SetAttribute("dayweekid", d.getDayOfWeek().ToString());
                eday.SetAttribute("dayweek", getSharedStringHtml(d.getDayOfWeek()));

                e5 = doc.CreateElement("zodiac");
                eday.AppendChild(e5);

                e5.SetAttribute("sans", GPSankranti.GetNameSan(zodiac));
                e5.SetAttribute("eng", GPSankranti.GetNameEng(zodiac));
                e5.SetAttribute("id", zodiac.ToString());

                d.NextDay();
                d.NextDay();
            }

            return(doc);
        }