/// <summary> /// Loops through all the from Stations and adds them to the /// comboBoxPrimary combo box. It only adds one of each station, /// since they are sorted alphabetically it does this by checking /// against the previous value. /// </summary> private void InitialiseComboBoxPrimary() { this.stnList = new ObservableCollection <string>(); this.stnList.Add(string.Empty); string previousvalue = string.Empty; string location = string.Empty; for (int i = 0; i < journeyController.GetMileageDetailsLength(); i++) { location = journeyController.GetFromStation(i); if (location != previousvalue) { this.stnList.Add(location); } previousvalue = location; } }
/// <summary> /// InitialiseEditTab, performs all the initialisation tasks for the /// edit tab. /// 1. Get the routes data and populate the outward combobox. /// </summary> /// <returns>success flag</returns> private void InitialiseEditTab() { string previousValue = string.Empty; string fromStn = string.Empty; this.EditMode = false; this.InitialiseEditFields(); this.RaiseEditPropertyChangedEvents(); for (int i = 0; i < journeyController.GetMileageDetailsLength(); i++) { fromStn = journeyController.GetFromStation(i); if (fromStn != previousValue) { this.JnyFromList.Add(fromStn); } previousValue = fromStn; } this.FromIndexChanged(); }