public CELGenerateCalendarPlusCore(GCAL.ContentServer content) { GPLocationProvider locProv = null; GPGregorianTime startWesternTime = null; GPGregorianTime endWesternTime = null; locProv = content.getLocationWithPostfix(""); if (locProv == null) { HtmlText = "<p>Error: location provider is null"; return; } startWesternTime = new GPGregorianTime(locProv); startWesternTime.setDate(content.getInt("startyear", startWesternTime.getYear()), content.getInt("startmonth", startWesternTime.getMonth()), content.getInt("startday", startWesternTime.getDay())); GPVedicTime startVedicTime, endVedicTime; int unitType = content.getInt("endperiodtype", 3); int nCount = content.getInt("endperiodlength", 1); GPEngine.VCTIMEtoVATIME(startWesternTime, out startVedicTime, locProv); GPEngine.CalcEndDate(locProv, startWesternTime, startVedicTime, out endWesternTime, out endVedicTime, unitType, GPEngine.CorrectedCount(unitType, nCount)); SetData(locProv, startWesternTime, endWesternTime); SyncExecute(); StringBuilder sb = new StringBuilder(); FormaterHtml.WriteCalendarPlusCoreHTML_BodyTable(CalculatedObject as GPCalendarPlusEventsResults, sb); HtmlText = sb.ToString(); }
public CELGenerateAppearanceDay(GCAL.ContentServer content) { GPLocationProvider locProv = null; GPGregorianTime startWesternTime = null; GPGregorianTime endWesternTime = null; locProv = content.getLocationWithPostfix(""); if (locProv == null) { locProv = GPAppHelper.getMyLocation(); } startWesternTime = new GPGregorianTime(locProv); startWesternTime.setDate(content.getInt("startyear", startWesternTime.getYear()), content.getInt("startmonth", startWesternTime.getMonth()), content.getInt("startday", startWesternTime.getDay())); startWesternTime.setDayHours(content.getInt("starthour", startWesternTime.getHour()) / 24.0 + content.getInt("startmin", startWesternTime.getMinuteRound()) / 1440.0); SetData(locProv, startWesternTime); SyncExecute(); StringBuilder sb = new StringBuilder(); FormaterHtml.WriteAppDayHTML_BodyTable(CalculatedObject as GPAppDayResults, sb); HtmlText = sb.ToString(); }
public void SetData(GPLocationProvider loa, GPLocationProvider lob, GPGregorianTime sd, int cn) { startDateA = new GPGregorianTime(sd); startDateA.setLocationProvider(loa); startDateB = new GPGregorianTime(sd); startDateB.setLocationProvider(lob); nCount = cn; }
public GPGregorianTime GetWesternDate() { GPGregorianTime vc = new GPGregorianTime(location); int y; int.TryParse(textBox1.Text, out y); vc.setDate(y, comboBox2.SelectedIndex + 1, comboBox1.SelectedIndex + 1); return(vc); }
public void InitializeData() { GPLocationProvider loc = GPAppHelper.getMyLocation(); myLocation = loc; myDate = new GPGregorianTime(loc); myDate.Today(); scaleIndex = GPUserDefaults.IntForKey("todayform.scaleindex", 2); }
private void CalendarControl_Paint(object sender, PaintEventArgs e) { Graphics g = e.Graphics; DateTime dt = DateTime.Now; g.FillRectangle(SystemBrushes.ControlLightLight, Bounds); if (currentMonth < 0) { currentMonth = dt.Month; currentYear = dt.Year; } else { dt = new DateTime(currentYear, currentMonth, 1); } int firstDow = dowToInt[mfi.FirstDayOfWeek]; int cdw = (dowToInt[dt.DayOfWeek] - firstDow + 7) % 7; int line = 0; int monthDays = GPGregorianTime.GetMonthMaxDays(currentYear, currentMonth); Rectangle rect = new Rectangle(0, 0, dayWidth * 7, dayHeight + 8); g.DrawString(string.Format("{0} {1}", mfi.GetMonthName(currentMonth), currentYear), titleFont, Brushes.Black, rect, centeredFormat); int tr = firstDow; for (int i = 0; i < 7; i++) { rect.Y = dayHeight + 16; rect.X = i * dayWidth; rect.Width = dayWidth; rect.Height = dayHeight; g.DrawString(mfi.GetAbbreviatedDayName(intToDow[tr]), SystemFonts.MenuFont, Brushes.Gray, rect, centeredFormat); tr = (tr + 1) % 7; } for (int i = 1; i <= monthDays; i++) { rect.X = cdw * dayWidth; rect.Y = 2 * dayHeight + 16 + line * dayHeight; g.DrawString(i.ToString(), SystemFonts.MenuFont, Brushes.Black, rect, centeredFormat); cdw++; if (cdw > 6) { cdw = 0; line++; } } }
private void listBox1_DrawItem(object sender, DrawItemEventArgs e) { // Cast the sender object back to ListBox type. ListBox theListBox = (ListBox)sender; // Get the string contained in each item. object item = theListBox.Items[e.Index]; // If the item is the selected item, then draw the rectangle // filled in blue. The item is selected when a bitwise And // of the State property and the DrawItemState.Selected // property is true. if ((e.State & DrawItemState.Selected) == DrawItemState.Selected) { e.Graphics.FillRectangle(Brushes.LightBlue, e.Bounds); } else { // Otherwise, draw the rectangle filled in beige. e.Graphics.FillRectangle(SystemBrushes.ControlLightLight, e.Bounds); } // Draw a rectangle in blue around each item. //e.Graphics.DrawRectangle(Pens.Blue, e.Bounds); if (item is GPLocation) { GPLocation loc = item as GPLocation; e.Graphics.DrawString(loc.getName(), labelCount.Font, Brushes.Black, e.Bounds.X + 4, e.Bounds.Y + 4); e.Graphics.DrawString("Timezone: " + loc.getTimeZone().getFullName(), label1.Font, Brushes.Black, e.Bounds.X + 4, e.Bounds.Y + 20); } else if (item is GPLocationChange) { GPLocationChange chan = item as GPLocationChange; GPGregorianTime gt = new GPGregorianTime(chan.LocationA); gt.setJulianGreenwichTime(new GPJulianTime(chan.julianStart, 0)); string humanStart = string.Format("{0} {1}", gt.getLongTimeString(), chan.LocationA.getTimeZoneName()); e.Graphics.DrawString(gt.getLongDateString() + " - travelling", labelCount.Font, Brushes.Black, e.Bounds.X + 48, e.Bounds.Y + 4); e.Graphics.DrawLine(Pens.Black, e.Bounds.X + 40, e.Bounds.Y + 4, e.Bounds.X + 40, e.Bounds.Bottom - 4); e.Graphics.DrawString("Start: " + chan.humanStart, label1.Font, Brushes.Black, e.Bounds.X + 48, e.Bounds.Y + 20); //e.Graphics.DrawString("End: " + chan.humanEnd, label1.Font, Brushes.Black, e.Bounds.X + 48, e.Bounds.Y + 36); e.Graphics.DrawString("Length: " + chan.humanLength, label1.Font, Brushes.Black, e.Bounds.X + 48, e.Bounds.Y + 36); } // Draw the focus rectangle around the selected item. e.DrawFocusRectangle(); }
/// <summary> /// Add new travelling /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { WizardDlg wizard = new WizardDlg(); LocationPickerControl lpc = new LocationPickerControl(); lpc.TravellerVisible = false; wizard.AddPage(lpc, "Start Location", "Select location, where you start your travelling"); LocationPickerControl lpc2 = new LocationPickerControl(); lpc2.TravellerVisible = false; wizard.AddPage(lpc2, "Target Location", "Select location, where you finish your traveling"); TravellingEditControl tec = new TravellingEditControl(); tec.LocationPicker = lpc; tec.LocationPicker2 = lpc2; tec.TransitionTimezoneIndex = 0; wizard.AddPage(tec, "Travelling time", "Specify travelling time"); wizard.ResetPages(); if (wizard.ShowDialog() == DialogResult.OK) { GPLocationChange newChange = new GPLocationChange(); newChange.LocationA = lpc.SelectedLocation.getLocation(0); newChange.LocationB = lpc2.SelectedLocation.getLocation(0); GPGregorianTime start = new GPGregorianTime(newChange.LocationA); start.setDateTime(tec.getUTCDateTime(0).AddHours(newChange.LocationA.getTimeZoneOffsetHours())); newChange.julianStart = start.getJulianGreenwichTime(); GPGregorianTime end = new GPGregorianTime(newChange.LocationB); end.setDateTime(tec.getUTCDateTime(1).AddHours(newChange.LocationB.getTimeZoneOffsetHours())); newChange.julianEnd = end.getJulianGreenwichTime(); newChange.TimezoneStart = (tec.TransitionTimezoneIndex == 0); GPLocationProvider lp = GPAppHelper.getMyLocation(); lp.addChange(newChange); RefreshList(); travellingChanged = true; } }
private void VedicChanged() { if (keepSycnhro) { int gyear; keepSycnhro = false; if (location != null && int.TryParse(textBox2.Text, out gyear)) { GPGregorianTime vc = null; GPVedicTime va = new GPVedicTime(comboBox3.SelectedIndex, GPAppHelper.ComboMasaToMasa(comboBox4.SelectedIndex), gyear); GPEngine.VATIMEtoVCTIME(va, out vc, location); comboBox2.SelectedIndex = vc.getMonth() - 1; textBox1.Text = vc.getYear().ToString(); comboBox1.SelectedIndex = vc.getDay() - 1; } keepSycnhro = true; } }
public CELGenerateCalendarTwoLocs(GCAL.ContentServer content) { GPLocationProvider locProvA = null; GPLocationProvider locProvB = null; GPGregorianTime startWesternTime = null; GPGregorianTime endWesternTime = null; locProvA = content.getLocationWithPostfix("a"); if (locProvA == null) { locProvA = GPAppHelper.getMyLocation(); } locProvB = content.getLocationWithPostfix("b"); if (locProvB == null) { locProvB = GPAppHelper.getMyLocation(); } startWesternTime = new GPGregorianTime(locProvA); startWesternTime.setDate(content.getInt("startyear", startWesternTime.getYear()), content.getInt("startmonth", startWesternTime.getMonth()), content.getInt("startday", startWesternTime.getDay())); GPVedicTime startVedicTime, endVedicTime; int unitType = content.getInt("endperiodtype", 3); int nCount = content.getInt("endperiodlength", 1); GPEngine.VCTIMEtoVATIME(startWesternTime, out startVedicTime, locProvA); GPEngine.CalcEndDate(locProvA, startWesternTime, startVedicTime, out endWesternTime, out endVedicTime, unitType, GPEngine.CorrectedCount(unitType, nCount)); nCount = Convert.ToInt32(endWesternTime.getJulianGreenwichNoon() - startWesternTime.getJulianGreenwichNoon()); SetData(locProvA, locProvB, startWesternTime, nCount); SyncExecute(); StringBuilder sb = new StringBuilder(); FormaterHtml.WriteCompareCalendarHTML_BodyTable(CalculatedObject as GPCalendarTwoLocResults, sb); HtmlText = sb.ToString(); }
public void AdjustDayCombo(int month, int year) { int sel = comboBox1.SelectedIndex; int max = GPGregorianTime.GetMonthMaxDays(year, month); while (comboBox1.Items.Count > max) { comboBox1.Items.RemoveAt(comboBox1.Items.Count - 1); } while (comboBox1.Items.Count < max) { comboBox1.Items.Add(comboBox1.Items.Count + 1); } if (sel > max - 1) { comboBox1.SelectedIndex = (max - 1); } }
public CELGenerateCoreEvents(GCAL.ContentServer content) { GPLocationProvider locProv = null; GPGregorianTime startWesternTime = null; GPGregorianTime endWesternTime = null; /*if (content.getString("locationtype") == "selected") * { * GPLocation loc = GPLocationList.getShared().findLocationById(content.getInt("locationid")); * if (loc != null) * locProv = new GPLocationProvider(loc); * }*/ locProv = content.getLocationWithPostfix(""); if (locProv == null) { locProv = GPAppHelper.getMyLocation(); } startWesternTime = new GPGregorianTime(locProv); startWesternTime.setDate(content.getInt("startyear", startWesternTime.getYear()), content.getInt("startmonth", startWesternTime.getMonth()), content.getInt("startday", startWesternTime.getDay())); GPVedicTime startVedicTime, endVedicTime; int unitType = content.getInt("endperiodtype", 3); int nCount = content.getInt("endperiodlength", 1); GPEngine.VCTIMEtoVATIME(startWesternTime, out startVedicTime, locProv); GPEngine.CalcEndDate(locProv, startWesternTime, startVedicTime, out endWesternTime, out endVedicTime, unitType, GPEngine.CorrectedCount(unitType, nCount)); nCount = Convert.ToInt32(endWesternTime.getJulianGreenwichNoon() - startWesternTime.getJulianGreenwichNoon()); SetData(locProv, startWesternTime, endWesternTime); SyncExecute(); StringBuilder sb = new StringBuilder(); FormaterHtml.WriteEventsHTML_BodyTable(CalculatedObject as GPCoreEventResults, sb); HtmlText = sb.ToString(); }
private void WesternChanged() { if (keepSycnhro) { int year; keepSycnhro = false; if (location != null && int.TryParse(textBox1.Text, out year)) { GPVedicTime va = null; GPGregorianTime vc = new GPGregorianTime(location); vc.setDate(year, comboBox2.SelectedIndex + 1, comboBox1.SelectedIndex + 1); vc.setDayHours(0.0); GPEngine.VCTIMEtoVATIME(vc, out va, location); comboBox3.SelectedIndex = va.tithi; comboBox4.SelectedIndex = GPAppHelper.MasaToComboMasa(va.masa); textBox2.Text = va.gyear.ToString(); } keepSycnhro = true; } }
private void EditTravellingInListbox(ListBox lbox, int index) { GPLocationChange newChange = (GPLocationChange)lbox.SelectedItem; if (newChange != null) { WizardDlg wizard = new WizardDlg(); GPGregorianTime start, end; TravellingEditControl tec = new TravellingEditControl(); tec.LocationObj = newChange.LocationA; tec.LocationObj2 = newChange.LocationB; wizard.AddPage(tec, "Travelling time", "Specify travelling time"); tec.TransitionTimezoneIndex = (newChange.TimezoneStart ? 0 : 1); start = new GPGregorianTime(newChange.TimezoneStart ? newChange.LocationA : newChange.LocationB); start.setJulianGreenwichTime(new GPJulianTime(newChange.julianStart, 0)); tec.setUTCDateTime(start.getLocalTime(), 0); start.setJulianGreenwichTime(new GPJulianTime(newChange.julianEnd, 0)); tec.setUTCDateTime(start.getLocalTime(), 1); wizard.ResetPages(); if (wizard.ShowDialog() == DialogResult.OK) { start = new GPGregorianTime(newChange.LocationA); start.setDateTime(tec.getUTCDateTime(0).AddHours(newChange.LocationA.getTimeZoneOffsetHours())); newChange.julianStart = start.getJulianGreenwichTime(); end = new GPGregorianTime(newChange.LocationB); end.setDateTime(tec.getUTCDateTime(1).AddHours(newChange.LocationB.getTimeZoneOffsetHours())); newChange.julianEnd = end.getJulianGreenwichTime(); newChange.TimezoneStart = (tec.TransitionTimezoneIndex == 0); listBox1.Invalidate(); listBox1.Update(); } } }
public void SetData(GPLocationProvider loa, GPLocationProvider lob, GPGregorianTime sd, double travelDurationHours) { GPLocationProvider lp = new GPLocationProvider(); lp.setDefaultLocation(loa.getDefaultLocation()); GPLocationChange locChange = new GPLocationChange(); locChange.LocationA = loa.getDefaultLocation(); locChange.LocationB = lob.getDefaultLocation(); locChange.TimezoneStart = true; locChange.julianStart = sd.getJulianGreenwichTime(); locChange.julianEnd = locChange.julianStart + travelDurationHours / 24.0; lp.addChange(locChange); provider = lp; startDateA = new GPGregorianTime(sd); startDateA.setLocationProvider(lp); startDateA.AddDays(-6); nCount = 15; }
public CELGenerateCalendarTravelling(GCAL.ContentServer content) { GPLocationProvider locProvA = null; GPLocationProvider locProvB = null; GPGregorianTime startWesternTime = null; //GPGregorianTime endWesternTime = null; locProvA = content.getLocationWithPostfix("a"); if (locProvA == null) { locProvA = GPAppHelper.getMyLocation(); } locProvB = content.getLocationWithPostfix("b"); if (locProvB == null) { locProvB = GPAppHelper.getMyLocation(); } startWesternTime = new GPGregorianTime(locProvA); startWesternTime.setDate(content.getInt("startyear", startWesternTime.getYear()), content.getInt("startmonth", startWesternTime.getMonth()), content.getInt("startday", startWesternTime.getDay())); double travelStart = content.getInt("starttravelhr", 12) * 1.0 + content.getInt("starttravelmin", 0) / 60.0; double travelDuration = content.getInt("durtravelhr", 6) * 1.0 + content.getInt("durtravelmin", 0) / 60.0; startWesternTime.setDayHours(travelStart / 24.0); SetData(locProvA, locProvB, startWesternTime, travelDuration); SyncExecute(); StringBuilder sb = new StringBuilder(); FormaterHtml.WriteCalendarHTML(CalculatedObject as GPCalendarResults, sb); HtmlText = sb.ToString(); }
/// <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(); }
/// <summary> /// static function for displaying Today screen /// </summary> public static void ShowForm(GPGregorianTime initDate) { if (shared_today_form == null) { shared_today_form = new TodayForm(initDate); if (GPUserDefaults.BoolForKey("todayform.bounds.initd", false)) { shared_today_form.StartPosition = FormStartPosition.Manual; shared_today_form.Location = new Point(GPUserDefaults.IntForKey("todayform.bounds.left", 10), GPUserDefaults.IntForKey("todayform.bounds.top", 10)); shared_today_form.Size = new Size(GPUserDefaults.IntForKey("todayform.bounds.width", 200), GPUserDefaults.IntForKey("todayform.bounds.height", 400)); } shared_today_form.Show(); } else { if (initDate != null) { shared_today_form.SetDate(initDate); } shared_today_form.BringToFront(); shared_today_form.Activate(); } }
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); } } } }
public void SetData(GPLocationProvider lo, GPGregorianTime sd, int cn) { location = lo; startDate = sd; nCount = cn; }
/// <summary> /// Sets specific date to display /// </summary> /// <param name="initDate"></param> public void SetDate(GPGregorianTime initDate) { myDate.Copy(initDate); RefreshText(); }
private void button1_Click(object sender, EventArgs e) { GPLocation loc; content.findLocations("Bratislava"); loc = content.getLocation(0); GPLocationProvider provider = new GPLocationProvider(loc); int nCount = 365; GPGregorianTime startDateA = new GPGregorianTime(loc); GPCalendarResults calA = new GPCalendarResults(); GPCalendarResults calB = new GPCalendarResults(); calA.progressReport = this; calB.progressReport = this; if (startDateA != null) { GPSun.sunPosMethod = GPSun.SUNPOSMETHOD_CALCULATOR; calA.CalculateCalendar(startDateA, nCount); GPSun.sunPosMethod = GPSun.SUNPOSMETHOD_CALCULATOREX; calB.CalculateCalendar(startDateA, nCount); } GPSun.sunPosMethod = GPSun.SUNPOSMETHOD_CALCULATOR; StringBuilder sb = new StringBuilder(); GPCalendarTwoLocResults cals = new GPCalendarTwoLocResults(); cals.CalendarA = calA; cals.CalendarB = calB; FormaterHtml.WriteCompareCalendarHTML(cals, sb); string HtmlText = sb.ToString(); webBrowser1.DocumentText = HtmlText; GPObserver obs = new GPObserver(); obs = loc; GPStrings.pushRich(false); StringBuilder sba = new StringBuilder(); GPJulianTime sunRise, sunNoon, sunSet; for (int i = 0; i < calA.getCount(); i++) { GPCalendarDay cd = calA.get(i); GPCalendarDay cd2 = calB.get(i); GPAstroEngine.CalculateTimeSun(cd.date, loc, out sunRise, out sunNoon, out sunSet); GPGregorianTime gt = new GPGregorianTime(loc); GPCelestialBodyCoordinates pos = GPAstroEngine.sun_coordinate(GPDynamicTime.getUniversalTimeFromDynamicTime(2457012.82313)); GPAstroEngine.calcHorizontal(pos, loc); sunRise.setLocalTimezoneOffset(loc.getTimeZoneOffsetHours()); sba.AppendFormat("{0} {1} {2} \n", cd.date.ToString(), cd.getSunriseTime().getLongTimeString(), cd2.getSunriseTime().getLongTimeString()); gt.setDate(1992, 10, 13); //cd.astrodata.sun.calculateCoordinatesMethodM(gt, 360/24.0); } GPStrings.popRich(); richTextBox1.Text = sba.ToString(); GPGregorianTime t1 = new GPGregorianTime(loc); t1.setDate(2015, 4, 4); double jd = t1.getJulianLocalNoon(); sba.Clear(); for (double d = 0.3; d < 1.0; d += 0.01) { double ml = GPAstroEngine.moon_coordinate(jd + d).eclipticalLongitude; double sl1 = GPAstroEngine.sun_coordinate(jd + d).eclipticalLongitude; double sl2 = GPAstroEngine.sunLongitudeMethodM(jd + d); sba.AppendFormat("{0} : {1} {2} {3}\n", jd + d, ml, sl1, sl2); } richTextBox2.Text = sba.ToString(); }
public GetPeriodLengthDlg(GPLocationProvider loc, GPGregorianTime startW, GPVedicTime startA) { InitializeComponent(); timeRangeLengthControl1.SetData(loc, startW, startA); }
public void SetData(GPLocationProvider loca, GPGregorianTime startWesternDate, GPVedicTime startVedicDate) { location = loca; startWesternTime = startWesternDate; startVedicTime = startVedicDate; }
// insert after private void button7_Click(object sender, EventArgs e) { ListBox lbox = listBox1; int index = lbox.SelectedIndex; int changeIndex = getChangeIndexFromListBoxIndex(index); GPLocationChange chng = null; GPLocationProvider provider = GPAppHelper.getMyLocation(); // ask for travelling time // ask for starting location WizardDlg wizard = new WizardDlg(); LocationPickerControl lpc = new LocationPickerControl(); lpc.TravellerVisible = false; wizard.AddPage(lpc, "Target Location", "Select location, where you end your travelling"); //LocationPickerControl lpc2 = new LocationPickerControl(); //lpc2.TravellerVisible = false; //wizard.AddPage(lpc2, "Target Location", "Select location, where you finish your traveling"); TravellingEditControl tec = new TravellingEditControl(); if (IsSelectedLocation) { tec.LocationObj = listBox1.SelectedItem as GPLocation; if ((listBox1.SelectedIndex - 1) > 0) { chng = (listBox1.Items[listBox1.SelectedIndex - 1] as GPLocationChange); } } if (IsSelectedTravelling) { chng = (listBox1.SelectedItem as GPLocationChange); tec.LocationObj = chng.LocationB; } tec.LocationPicker2 = lpc; tec.TransitionTimezoneIndex = 0; if (chng != null) { GPGregorianTime start = new GPGregorianTime(tec.LocationObj); start.setJulianGreenwichTime(new GPJulianTime(chng.julianStart, 0)); tec.SetBottomEndDateLimit(start.getLocalTime()); } wizard.AddPage(tec, "Travelling time", "Specify travelling time"); wizard.ResetPages(); if (wizard.ShowDialog() == DialogResult.OK) { GPLocationChange newChange = new GPLocationChange(); newChange.LocationA = tec.LocationObj; newChange.LocationB = lpc.SelectedLocation.getLocation(0); GPGregorianTime start = new GPGregorianTime(newChange.LocationA); start.setDateTime(tec.getUTCDateTime(0).AddHours(newChange.LocationA.getTimeZoneOffsetHours())); newChange.julianStart = start.getJulianGreenwichTime(); GPGregorianTime end = new GPGregorianTime(newChange.LocationB); end.setDateTime(tec.getUTCDateTime(1).AddHours(newChange.LocationB.getTimeZoneOffsetHours())); newChange.julianEnd = end.getJulianGreenwichTime(); newChange.TimezoneStart = (tec.TransitionTimezoneIndex == 0); // remove travellings before changeIndex // insert new travelling at index 0 provider.removeChangesAfterIndex(changeIndex); provider.addChange(newChange); RefreshList(); travellingChanged = true; } }
public void SetData(GPLocationProvider aloc, GPGregorianTime dt) { Location = aloc; DateTime = new GPGregorianTime(dt); }
public void SetData(GPLocationProvider lo, GPGregorianTime sd, GPGregorianTime ed) { location = lo; startDate = sd; endDate = ed; }
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; }