private void ClearMap_Click(object sender, RoutedEventArgs e)
 {
     Map.Markers.Clear();
     _lastMapObjectPoints.Clear();
     _mapObjects.Clear();
     NearbyObjects.Items.Clear();
     MapObjectName.Text = $"Object {_mapObjects.Count + 1}";
     _passengersList.Clear();
     TaxiProgress.Value = 0;
     TaxiAborted?.Invoke(this, EventArgs.Empty);
 }
        public void PassengerArrivedToDestinationPoint(object sender, EventArgs e)
        {
            lock (_lock)
            {
                if (!(sender is Car car))
                {
                    return;
                }
                var passenger = car.GetPassenger();

                car.Arrived      -= passenger.CarArrived;
                passenger.Seated -= car.PassengerSeated;

                _passengersList.Remove(passenger);
                _mapObjects.Remove(passenger);
                Map.Markers.Remove(passenger.GetMarker());

                if (_passengersList.Count == 0)
                {
                    TaxiAborted?.Invoke(this, EventArgs.Empty);
                    MessageBox.Show("Every passenger has arrived to his destination.");
                    return;
                }

                var point = car.GetFocus();

                _passengersList.Sort((x, y) => x.GetDistance(point).CompareTo(y.GetDistance(point)));

                car.Arrived += _passengersList[0].CarArrived;
                _passengersList[0].Seated += car.PassengerSeated;

                car.AddPassenger(_passengersList[0]);
                Map.Markers.Add(car.CreateRouteToDestinationPoint(_passengersList[0].GetFocus()));

                Map.Markers.Move(Map.Markers.IndexOf(car.GetMarker()), Map.Markers.Count - 1);
                foreach (var human in _passengersList)
                {
                    Map.Markers.Move(Map.Markers.IndexOf(human.GetMarker()), Map.Markers.Count - 1);
                }

                car.StartMove();
            }
        }