private void button1_Click(object sender, EventArgs e) { LocationWrapper lw = new LocationWrapper(SelectedLocation); if (SelectedLocation == null) { SelectedLocation = lw.location; } double d; SelectedLocation.CityName = textBox1.Text; SelectedLocation.CountryISOCode = (comboBox1.SelectedItem as TCountry).ISOCode; ToDouble(textBox2.Text, out d, 'N', 'S'); SelectedLocation.Latitude = d; ToDouble(textBox3.Text, out d, 'E', 'W'); SelectedLocation.Longitude = d; TTimeZone tz = comboBox2.SelectedItem as TTimeZone; SelectedLocation.TimeZone = tz; if (OnEditLocationDone != null) { OnEditLocationDone(lw, e); } Controller.RemoveFromContainer(); }
private void eventMapOverlayView1_OnClick(object o, EventmapOverlayEventArgs e) { GregorianDateTime dt = new GregorianDateTime(SelectedDate); dt.PreviousDay(); dt.PreviousDay(); GCLocation loc = new GCLocation(); TTimeZone tz = new TTimeZone(); loc.Latitude = 0; loc.Longitude = 0; loc.TimeZone = tz; TResultCalendar cal = new TResultCalendar(); cal.EkadasiOnly = true; VAISNAVADAY vd = GetCalcDay(dt, loc, cal, e.Longitude, e.Latitude); string str = string.Format("{0}, sunrise: {1}, longitude: {2}, latitude: {3}" , vd.date.ToString(), vd.astrodata.sunRise.ToLongTimeString() , e.Longitude, e.Latitude); labelStatus.Text = str; }
private void textBox2_TextChanged(object sender, EventArgs e) { if (textBox2.Text.Trim().Length == 0) { UpdateTimezoneList(); return; } string[] ps = textBox2.Text.Trim().ToLower().Split(' '); int A, B; listView1.BeginUpdate(); listView1.Items.Clear(); foreach (TTimeZone timezone in TTimeZone.TimeZoneList) { A = B = 0; foreach (string s in ps) { A++; if (timezone.Name.IndexOf(s, 0, StringComparison.CurrentCultureIgnoreCase) >= 0) { B++; } } if (A == B) { ListViewItem lvi = new ListViewItem(timezone.Name); lvi.SubItems.Add(TTimeZone.GetTimeZoneOffsetText(timezone.OffsetMinutes / 60.0)); lvi.Tag = timezone; listView1.Items.Add(lvi); } } listView1.EndUpdate(); }
private void FunctionCalcBoundariesSync(Quadrant map, GregorianDateTime date) { GCLog.Write("Ekadasi Boundaries Calculation START"); RootArray = null; CalculationFinished = false; GregorianDateTime dt = new GregorianDateTime(date); dt.PreviousDay(); dt.PreviousDay(); GCLocation loc = new GCLocation(); TTimeZone tz = new TTimeZone(); loc.Latitude = 0; loc.Longitude = 0; loc.TimeZone = tz; TResultCalendar cal = new TResultCalendar(); cal.EkadasiOnly = true; List <Quadrant> quandrantList = new List <Quadrant>(); quandrantList.Add(map); QuadrantArray qa; map = null; int count = 0, maxCount = 2000; while (quandrantList.Count > 0) { map = quandrantList[0]; quandrantList.RemoveAt(0); if (stopRequested) { break; } map.Details = CalculateQuadrantArray(map, dt, loc, cal, quandrantList); if (RootArray == null) { RootArray = map.Details; } // for testing count++; if (count >= maxCount) { break; } } CalculationFinished = true; GCLog.Write("Ekadasi Boundaries Calculation END"); StopMethodDelegate stopMethod = new StopMethodDelegate(PerformeStop); this.Invoke(stopMethod); }
private static void UpdateListViewItem(TTimeZone timezone, ListViewItem lvi) { lvi.SubItems.Clear(); lvi.Text = timezone.Name; lvi.SubItems.Add(TTimeZone.GetTimeZoneOffsetText(timezone.OffsetMinutes / 60.0)); lvi.Tag = timezone; }
public void setTimeZone(TTimeZone tz) { if (tz == null) { textBox1.Text = "Untitled/Timezone"; offsetNoDST.ValueMinutes = 0; checkBox1.Checked = false; } else { textBox1.Text = tz.Name; offsetNoDST.ValueMinutes = tz.OffsetMinutes; if (tz.BiasMinutes == 0) { checkBox1.Checked = false; offsetDST.ValueMinutes = 0; dstStartPanel.Value = new TTimeZoneDst(); dstEndPanel.Value = new TTimeZoneDst(); } else { checkBox1.Checked = true; offsetDST.ValueMinutes = tz.OffsetMinutes + tz.BiasMinutes; dstStartPanel.Value = tz.StartDst; dstEndPanel.Value = tz.EndDst; } } SelectedTimeZone = tz; }
private void UpdateDSTInfo() { TTimeZone tz = cbTimezones.SelectedItem as TTimeZone; if (tz != null) { labelDstInfo.Text = tz.HumanDstText(); } }
public void setLocation(TLocation selloc) { SelectedLocation = selloc; TCountry findCountry = (PrefferedCountry is TCountry ? PrefferedCountry as TCountry : null); comboBox1.BeginUpdate(); foreach (TCountry ct in TCountry.Countries) { comboBox1.Items.Add(ct); } comboBox1.Sorted = true; comboBox1.EndUpdate(); comboBox2.BeginUpdate(); foreach (TTimeZone tz in TTimeZone.TimeZoneList) { comboBox2.Items.Add(tz); } comboBox2.EndUpdate(); if (SelectedLocation == null) { textBox1.Text = "<new location>"; textBox2.Text = "12N50"; textBox3.Text = "50W13"; comboBox1.SelectedIndex = 0; comboBox2.SelectedIndex = 0; } else { textBox1.Text = SelectedLocation.CityName; for (int i = 0; i < comboBox1.Items.Count; i++) { TCountry tc = comboBox1.Items[i] as TCountry; if (tc.Name.Equals(SelectedLocation.Country.Name)) { comboBox1.SelectedIndex = i; break; } } textBox2.Text = GCEarthData.GetTextLatitude(SelectedLocation.Latitude); textBox3.Text = GCEarthData.GetTextLongitude(SelectedLocation.Longitude); for (int j = 0; j < comboBox2.Items.Count; j++) { TTimeZone tz = comboBox2.Items[j] as TTimeZone; if (tz.Name.Equals(SelectedLocation.TimeZoneName)) { comboBox2.SelectedIndex = j; break; } } } }
private void AddLocationToListView(TLocation loc) { ListViewItem lvi = new ListViewItem(loc.CityName); lvi.SubItems.Add(loc.Country.Name); lvi.SubItems.Add(GCEarthData.GetTextLatitude(loc.Latitude)); lvi.SubItems.Add(GCEarthData.GetTextLongitude(loc.Longitude)); lvi.SubItems.Add(TTimeZone.GetTimeZoneOffsetText(loc.TimeZone.OffsetMinutes / 60.0)); lvi.Tag = loc; listView1.Items.Add(lvi); }
private void button1_Click(object sender, EventArgs e) { SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = "Text Files (*.txt)|*.txt||"; sfd.DefaultExt = ".txt"; if (sfd.ShowDialog() == DialogResult.OK) { TTimeZone.SaveFile(sfd.FileName); } }
private static void TestLocations() { foreach (TLocation loc in TLocationDatabase.LocationList) { TTimeZone tz = loc.TimeZone; if (tz == null) { Debugger.Log(0, "", string.Format("{0} {1} => {2}\n", loc.CityName, loc.TimeZoneName, "Undefined")); } else { //Debugger.Log(0, "", string.Format("{0} {1} => {2}\n", loc.CityName, loc.Country.Name, tz.Name)); } } Debugger.Log(0, "", "----\n"); }
private void OnDetailsDialogSaved(object sender, EventArgs e) { TTimeZone tz = SelectedTimeZone; if (tz == null) { UpdateTimezoneList(); } else { foreach (ListViewItem lvi in listView1.Items) { if (lvi.Tag == tz) { UpdateListViewItem(tz, lvi); break; } } } }
private void SelectTimezone(TTimeZone timeZone) { cbTimezones.SelectedItem = timeZone; }
public void SaveTimeZoneData() { bool changed = false; bool created = false; if (SelectedTimeZone == null) { SelectedTimeZone = new TTimeZone(); created = true; } if (SelectedTimeZone != null) { if (SelectedTimeZone.Name == null || !SelectedTimeZone.Name.Equals(textBox1.Text)) { SelectedTimeZone.Name = textBox1.Text; changed = true; } if (SelectedTimeZone.OffsetMinutes != offsetNoDST.ValueMinutes) { SelectedTimeZone.OffsetMinutes = offsetNoDST.ValueMinutes; changed = true; } if (SelectedTimeZone.BiasMinutes != offsetDST.ValueMinutes - offsetNoDST.ValueMinutes) { SelectedTimeZone.BiasMinutes = offsetDST.ValueMinutes - offsetNoDST.ValueMinutes; changed = true; } if (checkBox1.Checked && SelectedTimeZone.BiasMinutes != 0) { if (SelectedTimeZone.StartDst.IntegerValue != dstStartPanel.Value.IntegerValue || SelectedTimeZone.EndDst.IntegerValue != dstEndPanel.Value.IntegerValue) { SelectedTimeZone.StartDst = dstStartPanel.Value; SelectedTimeZone.EndDst = dstEndPanel.Value; changed = true; } } else { if (SelectedTimeZone.StartDst.IntegerValue != 0) { SelectedTimeZone.StartDst.Clear(); changed = true; } if (SelectedTimeZone.EndDst.IntegerValue != 0) { SelectedTimeZone.EndDst.Clear(); changed = true; } } if (created) { TTimeZone.TimeZoneList.Add(SelectedTimeZone); changed = true; } if (changed) { TTimeZone.Modified = true; } } }
public void setCopyTimeZone(TTimeZone tz) { setTimeZone(tz); textBox1.Text = textBox1.Text + " (copy)"; SelectedTimeZone = null; }