public void UpdateMap(IOutputService output, int selectedCurrentPathIndex = -1) { if (output != null) { CurrentState = output; if (output.CurrentIteration == 1 && CurrentPaths.Count == 2) { GenerateTemporaryPathsNamesToComboBox(output.CurrentPaths.Count); } _mapControl.LoadMapView(Map); if (ShowPheromones) { _mapControl.UpdatePheromones(output.Pheromones); } if (ShowBestPath) { _mapControl.UpdateBestPath(output.BestPath); } CurrentIteration = output.CurrentIteration; if (selectedCurrentPathIndex == -1) { selectedCurrentPathIndex = CurrentPaths.IndexOf(SelectedCurrentPath); } _mapControl.UpdateCurrentPaths(output.CurrentPaths, selectedCurrentPathIndex); } }
private void SelectedCurrentPathPropertyChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == "SelectedCurrentPath") { //Console.WriteLine("A property has changed: " + CurrentPaths.IndexOf(SelectedCurrentPath)); UpdateMap(CurrentState, CurrentPaths.IndexOf(SelectedCurrentPath)); } }