/// <summary> /// Get the coordinate file and process the data to build Simio map route objects. /// If any are found, return is true, but unfound addresses are reported in explanation /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public bool ProcessPairDataFile(string path, IMapHelper mapHelper, string mapKey, out SimioMapRoutes mapRoutes, out string explanation) { explanation = ""; string marker = "Begin"; int lineNbr = 0; mapRoutes = null; StringBuilder sbErrors = new StringBuilder(); Cursor.Current = Cursors.WaitCursor; try { string name = Path.GetFileNameWithoutExtension(path); mapRoutes = new SimioMapRoutes(name); mapRoutes.ProviderInformation = mapHelper.GetProviderInformation(); //Todo: Add processing if (string.IsNullOrEmpty(comboGisSource.Text)) { alert($"Please select a GIS Source"); return(false); } if (!LoadAddressPairsFile(textAddressPairsFilepath.Text, out List <GisFromToPair> pairList, out explanation)) { explanation = $"Cannot Load Pairs File={explanation}"; return(false); } foreach (GisFromToPair pair in pairList) { lineNbr++; marker = $"Line={lineNbr} Loading Pair={pair}"; labelStatus.Text = marker; if (!mapHelper.GetRoute(mapKey, pair.FromLocation.ToString(), pair.ToLocation.ToString(), out SimioMapRoute mapRoute, out string requestUrl, out explanation)) { sbErrors.AppendLine($"Cannot Get Route. Err={explanation}"); } mapRoutes.RouteList.Add(mapRoute); } explanation = sbErrors.ToString(); return(true); } catch (Exception ex) { explanation = $"Marker={marker} Err={ex.Message}"; return(false); } finally { Cursor.Current = Cursors.Default; } }