private void ButtonClearClick(object sender, RoutedEventArgs e) { textBoxDistance.Text = ""; textBoxShortestWay.Text = ""; LinesOpearions.DeleteLinesIfNeeded(grid); CheckBoxesOperations.UncheckedCheckBoxes(cities, grid); CheckBoxesOperations.ClearList(cities); }
private void Button_CheckDistance_Click(object sender, RoutedEventArgs e) { CheckBoxesOperations.ClearList(cities); int howManyChecked = CheckBoxesOperations.AddCheckedCheckBoxes(cities, grid); if (!CheckBoxesOperations.ExactlyTwoChecked(howManyChecked)) { textBoxDistance.Text = "Make sure that you have marked exactly 2 cities!"; return; } LinesOpearions.DeleteLinesIfNeeded(grid); double distance = Math.Round(Distance.DistanceBetweenTwoCity(cities.CheckBoxesList, 0, 1, grid, sender), 2); textBoxDistance.Text = $"Distance between {cities.CheckBoxesList[0].Tag.ToString()} and {cities.CheckBoxesList[1].Tag.ToString()}: {distance} km "; }
private void Button_Way_Click(object sender, RoutedEventArgs e) { LinesOpearions.DeleteLinesIfNeeded(grid); textBoxShortestWay.Text = Distance.ShortestWay(cities.CheckBoxesList, grid); }