/// when the directions have been generated update the directions display private void updateDirections() { if (beginTextBox.InvokeRequired) { this.Invoke(finishedProcessing); } else { toolStripStatusLabel2.Text = "Done,"; lookupToolStripProgressBar.Value = 0; updateRideMap(false); currentTurnStatusLabel.Text = _ps.getCurrentTurnString(); // update startTextBox if (_ps.Addresses != null && _ps.Addresses.Count > 0) { beginTextBox.Text = "Start at " + _ps.Addresses[0].AddressString; // update the cue sheet ListView updateListView(); // update endTextBox endTextBox.Text = "End at " + _ps.Addresses[_ps.Addresses.Count - 1].AddressString + "\r\nTotal distance: " + DirectionsPrinter.getDistanceInUnits(_ps.Path.TotalDistance, _units); } else { beginTextBox.Text = _ps.Status; } } }
// set the contents of the cue sheet ListView control private void updateListView() { if (_ps.Turns == null) { return; } //clear the list view cueSheetListView.Items.Clear(); //add necessary columns to list view // moved to MainForm.Designer.cs! for (int i = 0; i < _ps.Turns.Count; i++) { Turn t = _ps.Turns[i]; ListViewItem lvi = null; if (t.TurnDirection == "left") { lvi = new ListViewItem((i + 1).ToString(), 0); } else if (t.TurnDirection == "right") { lvi = new ListViewItem((i + 1).ToString(), 1); } else if (t.TurnDirection == "straight") { lvi = new ListViewItem((i + 1).ToString(), 2); } else { lvi = new ListViewItem((i + 1).ToString(), 3); } lvi.SubItems.Add(DirectionsPrinter.getDistanceInUnits(t.Locs[1].GpxLocation.Distance, _units)); lvi.SubItems.Add(t.TurnDirection); lvi.SubItems.Add(t.Locs[2].StreetName); cueSheetListView.Items.Add(lvi); } // highlight the first turn in the display if (_ps.Turns.Count > 0) { highlightCurrentTurn(); } }