public void InitializeData() { GPLocationProvider loc = GPAppHelper.getMyLocation(); myLocation = loc; myDate = new GPGregorianTime(loc); myDate.Today(); scaleIndex = GPUserDefaults.IntForKey("todayform.scaleindex", 2); }
/// <summary> /// constructor /// </summary> public TodayForm(GPGregorianTime initDate) { InitializeComponent(); InitializeData(); SetWebBrowserAutoSizeBehaviour(GPDisplays.Today.WindowAutosize()); if (initDate == null) { myDate.Today(); } else { myDate.Copy(initDate); } RefreshText(); SupervisorForm.WindowOpened(this); //object c = TimeZoneInfo.GetSystemTimeZones(); }
protected override void Execute() { loc = GPAppHelper.getMyLocation(); //Testing.Report(loc, "gcal13"); //loc1.setLatitudeNorthPositive(48.16); //loc1.setLongitudeEastPositive(17.09); //loc1.setTimeZoneName("Europe/Bratislava"); p_today = new GPGregorianTime(loc); p_today.Today(); /* * Debugger.Log(0,"", String.Format("Location: {0} {1} {2}\n", loc.getFullName(), loc1.getLongitudeString(), loc1.getLatitudeString())); * * double date = p_today.getJulianLocalNoon(); * TEclipse te; * for (int i = 0; i < 30; i++) * { * te = MA.Engine.NextEclipse(ref date, true); * int y, m, d; * MA.Engine.DecodeDateCorrect(date, out y, out m, out d); * Debugger.Log(0, "", String.Format("eclipse:{0} date: {1} {2} {3}\n", te, y, m, d)); * date += 20; * } * * //double a1 = MA.GPMeeusEngine.star_time(2456708.3200) ; * //a1 = MA.GPMeeusEngine.star_time(2452083) - a1; * * * double lat1 = 48.16, lat2 = 120; * double lon1 = 17.09, lon2 = 123; * double dStart = 0.287399999999998; * double dEnd = 0.287799999999998; * GPObserver obs = new GPObserver(); * obs.setLatitudeNorthPositive(lat1).setLongitudeEastPositive(lon1).SetAltitude(0.2); * * GPJulianTime rise, trans, set; * * * GPJulianTime time = new GPJulianTime(); * * time.setLocalJulianDay(2456708.5); * time.setLocalTimezoneOffset(1); * for (int l = 0; l < 40; l++) * { * Log("Julian {0} = {1} / {2} / {3} {4}:{5}:{6}\n", time.GetJulianDay(), time.GetYear(), * time.GetMonth(), time.GetDay(), time.GetHour(), time.GetMinute(), time.GetSecond()); * time.AddSeconds(79367.6); * } * * //GPGregorianTime gt = new GPGregorianTime(loc); * //gt.setJulianGreenwichTime(time); * //double rise = MA.GPMeeusEngine.Sun_Rise(p_today.GetJulianDetailed() - 0.5, loc.Latitude, -loc.Longitude); * //GPAstroEngine.CalculateTimeSun(gt, obs, out rise, out trans, out set); * * //Log("Rise: {0}, \nTrans:{1}, \nSet:{2}", rise, trans, set); * * //MA.Testing.TestSunCoordinates(); * //MA.Testing.TestSiderealTime(); * //MA.Testing.TestMoonEvents(); * * //GPSun sun = new GPSun(); * //sun.SunCalc(p_today, loc); * TRiseSet kind; * double deltaphi, epsilon, srt; * GPJulianTime dp = new GPJulianTime(); * dp.setLocalJulianDay(2456710.500000); * * obs.setLongitudeEastPositive(-25.858).setLatitudeNorthPositive(-23.983); * srt = 2452081.000000; * * //MA.Testing.TestMoonEclipse(); * * Testing.TestConjunctions(); * * //MA.GPCelestialBodyCoordinates coord = MA.GPMeeusEngine.moon_coordinate(2448724.5); * //double phi, eps; * //MA.GPMeeusEngine.calc_epsilon_phi(2446895.5, out phi, out eps); * //Log("Sidereal time: {0}", MA.GPMeeusEngine.star_time(2446895.5)); * //Log("Epsilon: {0}, phi: {1}", eps, phi); * //Log("Sunrise {0}", sun.rise.LongTimeString); * * return; */ int maxCount = GPUserDefaults.IntForKey("nextfest.days", 16); if (maxCount < 3) { maxCount = 16; GPUserDefaults.SetIntForKey("nextfest.days", maxCount); } bool onlyFast = GPUserDefaults.BoolForKey("nextfest.onlyfast", true); p_cal.CalculateCalendar(p_today, maxCount); List <string> temp = new List <string>(); for (int i = 0; i < p_cal.getCount(); i++) { temp.Clear(); GPCalendarDay vd = p_cal.get(i); if (onlyFast) { if (vd.sEkadasiVrataName.Length > 0) { temp.Add(string.Format(GPStrings.getString(87), vd.sEkadasiVrataName)); } else if (vd.hasEkadasiParana()) { temp.Add(vd.getEkadasiParanaString()); } } else { if (vd.hasEkadasiParana()) { temp.Add(vd.getEkadasiParanaString()); } foreach (GPCalendarDay.Festival fest in vd.Festivals) { if (GPUserDefaults.BoolForKey(fest.ShowSettingItem, true)) { temp.Add(fest.Text); } } } if (temp.Count > 0) { for (int j = 0; j < temp.Count; j++) { GPStringPair dr = new GPStringPair(); if (j == 0) { dr.Name = vd.date.ToString() + " " + GPStrings.getString(150 + vd.date.getDayOfWeek()); } dr.Value = temp[j]; lines.Add(dr); } } } }
protected override void Execute() { ResultsList.Clear(); //ClearControlList(); int limit; if (Location == null || p_text == null || p_text.Length == 0) { return; } // find in texts StringBuilder sb = new StringBuilder(); Results res = new Results(this, p_text); GPGregorianTime vc = new GPGregorianTime(Location); vc.Today(); // // today results (this day, tomorrow and day after // #region today screen results limit = GPUserDefaults.IntForKey("search.today.days", 3); for (int i = 0; i < limit; i++) { sb.Remove(0, sb.Length); FormaterPlain.AvcGetTodayInfo(vc, Location, sb); res.Title = GPAppHelper.getDateText(vc); res.Type = GPStrings.getString(174); res.ScanText(p_text, sb); if (res.Lines.Count > 0) { res.Operation = GPCalculationOperation.Today; res.Parameters.Add(GPCalculationParameters.LocationProvider, Location); res.Parameters.Add(GPCalculationParameters.StartWesternDate, vc.Copy()); res.ActionScript += string.Format("scriptObject.setMyDate({0},{1},{2});", vc.getYear(), vc.getMonth(), vc.getDay()); res.ActionScript += "window.location.href='today.html'"; ResultsList.Add(res); res = new Results(this, p_text); } vc.NextDay(); } // move results to control if (!ShouldCancel) { FlushResultsToControl(); } #endregion #region calendar results limit = GPUserDefaults.IntForKey("search.calendar.months", 12); GPCalendarResults rcal = new GPCalendarResults(); vc.Today(); vc.AddDays(1 - vc.getDay()); for (int i = 0; i < limit; i++) { rcal.CalculateCalendar(vc, GPGregorianTime.GetMonthMaxDays(vc.getYear(), vc.getMonth())); FormaterPlain.FormatCalendarPlain(rcal, sb); res.Title = string.Format("{0} {1}", GPStrings.getString(759 + vc.getMonth()), vc.getYear()); res.Type = GPStrings.getString(44); res.ScanText(p_text, sb); if (res.Lines.Count > 0) { res.Operation = GPCalculationOperation.Calendar; res.Parameters.Add(GPCalculationParameters.LocationProvider, Location); res.Parameters.Add(GPCalculationParameters.StartWesternDate, vc.Copy()); GPGregorianTime vc2 = vc.Copy(); vc2.AddMonths(1); res.Parameters.Add(GPCalculationParameters.EndWesternDate, vc2); res.ActionScript += "saveString('locationtype', 'mylocation');"; res.ActionScript += "saveString('startyear', '" + vc.getYear() + "');"; res.ActionScript += "saveString('startmonth', '" + vc.getMonth() + "');"; res.ActionScript += "saveString('startday', '" + vc.getDay() + "');"; res.ActionScript += "saveString('endperiodtype', '3');"; res.ActionScript += "saveString('endperiodlength', '1');"; res.ActionScript += "window.location.href='calendar.html'"; ResultsList.Add(res); res = new Results(this, p_text); } vc.AddMonths(1); } // move results to control if (!ShouldCancel) { FlushResultsToControl(); } #endregion #region core events results limit = GPUserDefaults.IntForKey("search.coreevents.months", 1); GPCoreEventResults reve = new GPCoreEventResults(); vc.Today(); vc.AddDays(1 - vc.getDay()); for (int i = 0; i < limit; i++) { sb.Remove(0, sb.Length); GPGregorianTime vcEnd = vc.Copy(); vcEnd.AddDays(31); reve.CalculateEvents(Location, vc, vcEnd); FormaterPlain.FormatEventsText(reve, sb); res.Title = string.Format("{0} {1}", GPStrings.getString(759 + vc.getMonth()), vc.getYear()); res.Type = GPStrings.getString(46); res.ScanText(p_text, sb); if (res.Lines.Count > 0) { res.Operation = GPCalculationOperation.CoreEvents; res.Parameters.Add(GPCalculationParameters.LocationProvider, Location); res.Parameters.Add(GPCalculationParameters.StartWesternDate, vc.Copy()); res.Parameters.Add(GPCalculationParameters.EndWesternDate, vcEnd); res.ActionScript += "saveString('locationtype', 'mylocation');"; res.ActionScript += "saveString('startyear', '" + vc.getYear() + "');"; res.ActionScript += "saveString('startmonth', '" + vc.getMonth() + "');"; res.ActionScript += "saveString('startday', '" + vc.getDay() + "');"; res.ActionScript += "saveString('endperiodtype', '3');"; res.ActionScript += "saveString('endperiodlength', '1');"; res.ActionScript += "window.location.href='coreevents.html'"; ResultsList.Add(res); res = new Results(this, p_text); } vc.AddMonths(1); } // move results to control if (!ShouldCancel) { FlushResultsToControl(); } #endregion #region masa list limit = GPUserDefaults.IntForKey("search.masalist.years", 3); GPMasaListResults rmas = new GPMasaListResults(); vc.Today(); for (int i = 0; i < limit; i++) { sb.Remove(0, sb.Length); rmas.CalcMasaList(Location, vc.getYear(), 1); FormaterPlain.FormatMasaListText(rmas, sb); res.Title = string.Format("{0}", vc.getYear()); res.Type = GPStrings.getString(48); res.ScanText(p_text, sb); if (res.Lines.Count > 0) { res.Operation = GPCalculationOperation.MasaList; res.Parameters.Add(GPCalculationParameters.LocationProvider, Location); res.Parameters.Add(GPCalculationParameters.StartYear, vc.getYear()); res.Parameters.Add(GPCalculationParameters.CountYear, 1); res.ActionScript += "saveString('locationtype', 'mylocation');"; res.ActionScript += "saveString('startyear', '" + vc.getYear() + "');"; res.ActionScript += "saveString('yearcount', '1');"; res.ActionScript += "window.location.href='masalist.html'"; ResultsList.Add(res); res = new Results(this, p_text); } vc.AddYears(1); } // move results to control if (!ShouldCancel) { FlushResultsToControl(); } #endregion finished = true; }