private void btnNewRace_Click(object sender, EventArgs e) { CurrentRace = new RaceEntry(); SyncRace(); }
private void lstRace_SelectedIndexChanged(object sender, EventArgs e) { if (lstRace.SelectedItems.Count == 1 && lstRace.SelectedItems[0] != null) { CurrentRace = (RaceEntry)lstRace.SelectedItems[0].Tag; } SyncRace(); }
private void btnRemvRace_Click(object sender, EventArgs e) { try { if (lstRace.SelectedItems.Count == 1 && lstRace.SelectedItems[0] != null) { InformationPool.Client.RemoveRace(((RaceEntry)lstRace.SelectedItems[0].Tag).ID); CurrentRace = new RaceEntry(); LoadRaces(); SyncRace(); } } catch (Exception ex) { MessageBox.Show("Error Rmoving Race " + ex.ToString()); } }
private void btnSaveRace_Click(object sender, EventArgs e) { t_Race r = new t_Race(); r.Name = CurrentRace.Name; if (CurrentRace.PilotA != 0) { r.t_Pilot = new t_Pilot(); r.t_Pilot.ID = CurrentRace.PilotA; } if (CurrentRace.PilotB != 0) { r.t_Pilot1 = new t_Pilot(); r.t_Pilot1.ID = CurrentRace.PilotB; } if (CurrentRace.PilotC != 0) { r.t_Pilot2 = new t_Pilot(); r.t_Pilot2.ID = CurrentRace.PilotC; } if (CurrentRace.PilotD != 0) { r.t_Pilot3 = new t_Pilot(); r.t_Pilot3.ID = CurrentRace.PilotD; } r.ID_PolygonGroup = CurrentRace.Polygons.ID; r.t_PolygonGroup = new t_PolygonGroup(); r.t_PolygonGroup.Name = CurrentRace.Polygons.Name; r.t_PolygonGroup.t_Polygons = new List<t_Polygon>(); foreach (Polygon p in CurrentRace.Polygons.Polygons) { t_Polygon poly = new t_Polygon(); poly.t_PolygonPoints = new List<t_PolygonPoint>(); poly.Type = (int)p.Type; foreach (PolygonPoint pp in p.Points) { t_PolygonPoint temp_poly_point = new t_PolygonPoint(); temp_poly_point.altitude = pp.Altitude; temp_poly_point.latitude = pp.Latitude; temp_poly_point.longitude = pp.Longitude; poly.t_PolygonPoints.Add(temp_poly_point); } r.t_PolygonGroup.t_Polygons.Add(poly); } r.t_PolygonGroup.ID = CurrentRace.Polygons.ID; r.TimeStart = CurrentRace.StartTime; r.TimeEnd = CurrentRace.StartTime.Add(new TimeSpan(0,(int)CurrentRace.Duration,0)); InformationPool.Client.AddRace(r); LoadRaces(); CurrentRace = new RaceEntry(); SyncRace(); }
private void btnRacesRefresh_Click(object sender, EventArgs e) { LoadRaces(); CurrentRace = new RaceEntry(); SyncRace(); }