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(); }
private void myLocationToolStripMenuItem_Click(object sender, EventArgs e) { if (EditMyLocation()) { myLocation = GPAppHelper.getMyLocation(); RefreshText(); } }
// clear all private void button4_Click(object sender, EventArgs e) { GPLocationProvider prov = GPAppHelper.getMyLocation(); prov.Clear(); RefreshList(); travellingChanged = true; }
public void InitializeData() { GPLocationProvider loc = GPAppHelper.getMyLocation(); myLocation = loc; myDate = new GPGregorianTime(loc); myDate.Today(); scaleIndex = GPUserDefaults.IntForKey("todayform.scaleindex", 2); }
// remove after private void button3_Click(object sender, EventArgs e) { ListBox lbox = listBox1; int index = lbox.SelectedIndex; int changeIndex = getChangeIndexFromListBoxIndex(index); GPLocationProvider provider = GPAppHelper.getMyLocation(); while (lbox.Items.Count > changeIndex) { provider.removeChangeAtIndex(changeIndex); } RefreshList(); travellingChanged = true; }
/// <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 LoadProvider() { GPLocationProvider lp = GPAppHelper.getMyLocation(); int i; int count = lp.getChangeCount(); listBox1.Items.Clear(); for (i = 0; i < count; i++) { listBox1.Items.Add(lp.getLocationAtIndex(i)); listBox1.Items.Add(lp.getChangeAtIndex(i)); } listBox1.Items.Add(lp.getLocationAtIndex(i)); UpdateEnabledButtons(); }
private void UpdateEnabledButtons() { bool bItems = (GPAppHelper.getMyLocation().getChangeCount() > 0); bool bSomeSelected = listBox1.SelectedIndex >= 0; bool bLocSelected = (listBox1.SelectedItem is GPLocation); bool bNotFirstItem = listBox1.SelectedIndex > 0; bool bNotLastItem = listBox1.SelectedIndex < (listBox1.Items.Count - 1); buttonAddTravelling.Enabled = !bItems; buttonEdit.Enabled = bSomeSelected & !bLocSelected; buttonRemoveAfter.Enabled = bSomeSelected & bItems & (listBox1.SelectedIndex < (listBox1.Items.Count - 2)); buttonClearAll.Enabled = bItems; buttonRemoveBefore.Enabled = bSomeSelected & bItems & (listBox1.SelectedIndex > 1); buttonInsertBefore.Enabled = bSomeSelected & bItems; buttonInsertAfter.Enabled = bSomeSelected & bItems; }
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 CELGenerateMasaList(GCAL.ContentServer content) { GPLocationProvider locProv = null; locProv = content.getLocationWithPostfix(""); if (locProv == null) { locProv = GPAppHelper.getMyLocation(); } SetData(locProv, content.getInt("startyear", 2015), content.getInt("yearcount", 1)); SyncExecute(); StringBuilder sb = new StringBuilder(); FormaterHtml.WriteMasaListHTML_BodyTable(CalculatedObject as GPMasaListResults, sb); HtmlText = sb.ToString(); }
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 webBrowser1_Navigating(object sender, WebBrowserNavigatingEventArgs e) { string url = e.Url.AbsoluteUri; if (url == "about:blank") { } else if (url.StartsWith("http://gcal.app/")) { e.Cancel = true; url = url.Substring("http://gcal.app/".Length); if (url == "mylocation") { if (EditMyLocation()) { myLocation = GPAppHelper.getMyLocation(); RefreshText(); } } } }
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(); }
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); } } } }
// 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; } }