void AddRouteToTable(MapRoute route) { if (route.NamesVisited.Count < 2) return; string names = GetRouteName(route); DataSet.RoutesRow existing = dataSet.Routes.FindByRoute(names); if (existing != null) return; DataSet.RoutesRow row = dataSet.Routes.NewRoutesRow(); row.Distance = route.Distance; row.Route = names; row.Link = route.MapURL; dataSet.Routes.AddRoutesRow(row); }
private void comboBoxList1_SelectedValueChanged(object sender, EventArgs e) { UpdateNumberOfRows(); ContactList contacts = GetContactSequence(); MapRoute route = new MapRoute(); }
void UpdateRoute() { SetWaitState(true, "Calculating Route..."); try { ContactList contacts = GetContactSequence(); MapRoute route = new MapRoute(); route.CalculateRoute(contacts); AddRouteToTable(route); } catch (Exception ex) { MessageBox.Show("" + ex); } SetWaitState(false); }
private string GetRouteName(MapRoute route) { List<string> abbrevNames = new List<string>(); foreach (string s in route.NamesVisited) abbrevNames.Add(AbbreviateName(s)); string names = abbrevNames[0]; for (int i = 1; i < abbrevNames.Count; i++) names += "-" + abbrevNames[i]; return names; }