Пример #1
0
 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);
 }
Пример #2
0
 private void comboBoxList1_SelectedValueChanged(object sender, EventArgs e)
 {
     UpdateNumberOfRows();
     ContactList contacts = GetContactSequence();
     MapRoute route = new MapRoute();
 }
Пример #3
0
 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);
 }
Пример #4
0
 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;
 }