Пример #1
0
        // метод перемещения по маршруту
        private void MoveByRoute()
        {
            double pointss = 100 / route.getLocations().Count;

            foreach (var point in route.getLocations())
            {
                this.location = point;
                Application.Current.Dispatcher.Invoke(delegate
                {
                    this.location   = point;
                    marker.Position = point;
                    gMap.Position   = point;
                    (Application.Current.MainWindow as MainWindow).Progress.Value += pointss + 1;
                    if (pers != null)
                    {
                        pers.setLocation(point);
                        pers.getMarker().Position = point;
                    }
                });
                Thread.Sleep(300);
            }
            // отправка события о прибытии после достижения последней точки маршрута
            if (pers == null)
            {
                Arrived?.Invoke(this, null);
            }
            else
            {
                pers.endOfJourney();
                pers = null;
            }
        }
Пример #2
0
        public void passengerSeated(object sender, EventArgs e)
        {
            pers = (CPers)sender;

            Application.Current.Dispatcher.Invoke(delegate {
                // gMap.Markers.Add(moveTo(pers.getDestination()));
                (Application.Current.MainWindow as MainWindow).Progress.Value = 0;
            });


            Application.Current.Dispatcher.Invoke(delegate {
                gMap.Markers.Add(moveTo(pers.getDestination()));
            });

            //Application.Current.Dispatcher.Invoke((Application.Current.MainWindow as MainWindow).Progress.Value = 0;);
        }
Пример #3
0
 public void setPerson(CPers pers)
 {
     this.pers = pers;
 }