コード例 #1
0
 private void SetPopup(TransitStop stop)
 {
     ArrivalsPopup.Stop = stop;
     if (ArrivalsPopup.Visibility != Visibility.Visible)
     {
         ArrivalsPopup.Visibility = Visibility.Visible;
         OnMapPopup.Visibility    = Visibility.Visible;
         OffMapPopup.Visibility   = Visibility.Visible;
         ArrivalsPopup.Offset(offsetY: 0).Fade(value: 1).SetDurationForAll(ANIMATION_DURATION).Start();
     }
     MapControl.SetLocation(OnMapPopup, stop.Position.ToGeopoint());
     SetTakeover(new MapView(stop.Position));
 }
コード例 #2
0
        private static void TripLegChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            TripDetailListIntermediates _this = d as TripDetailListIntermediates;

            if (_this == null)
            {
                return;
            }

            TripLeg newLeg = e.NewValue as TripLeg;

            if (newLeg == null)
            {
                return;
            }

            if (newLeg.IntermediateStops?.Count > 0)
            {
                _this._backingIntermediatesList = newLeg.IntermediateStops;
                _this._backingSimpleText        = $"{newLeg.IntermediateStops.Count} {AppResources.TripDetailListIntermediates_IntermediateStopsNumber}";
            }
            else
            {
                var distanceString = newLeg.DistanceMeters.ToString("N0");
                if (newLeg.Mode == ApiEnums.ApiMode.Walk)
                {
                    _this._backingSimpleText = String.Format(AppResources.TripDetailListIntermediates_WalkDistance, distanceString);
                }
                else
                {
                    _this._backingSimpleText = String.Format(AppResources.TripDetailListIntermediates_TransitDistance, distanceString);
                }
            }

            if (_this._isShowingIntermediateStops)
            {
                _this.ItemsBackingCollection = new ObservableCollection <TransitStop>(_this._backingIntermediatesList);
            }
            else
            {
                TransitStop simpleTextProxy = new TransitStop {
                    Name = _this._backingSimpleText
                };
                _this.ItemsBackingCollection = new ObservableCollection <TransitStop>();
                _this.ItemsBackingCollection.Add(simpleTextProxy);
            }
            _this.IntermediateStopsControl.ItemsSource = _this.ItemsBackingCollection;
        }
コード例 #3
0
        //private void RegisterArrivalsViewModelCloseEventHandler()
        //{
        //    if (!ArrivalsViewModelCloseEventHandled && ArrivalsViewModel != null)
        //    {
        //        ArrivalsViewModel.Closed += ArrivalsViewModel_Closed;
        //        ArrivalsViewModelCloseEventHandled = true;
        //    }
        //}

        //private void UnregisterArrivalsViewModelCloseEventHandler()
        //{
        //    if (ArrivalsViewModelCloseEventHandled)
        //    {
        //        ArrivalsViewModel.Closed -= ArrivalsViewModel_Closed;
        //        ArrivalsViewModelCloseEventHandled = true;
        //    }
        //}
        #endregion

        #region Functions
        private static TransitStop CombineSeveralStops(LatLon?center, params TransitStop[] stops)
        {
            if (stops.Length == 0)
            {
                throw new ArgumentException("stops needs to contain at least one stop.", "stops");
            }
            if (stops.Length == 1)
            {
                return(stops[0]);
            }
            TransitStop result = new TransitStop();

            result.Name      = $"Selected Stops";
            result.Direction = Data.StopDirection.Unspecified;
            result.ID        = stops.Aggregate("", (acc, stop) => acc + "&" + stop.ID).Substring(1);
            result.Position  = center ?? stops[0].Position;
            result.Children  = stops.Select(stop => stop.ID).ToArray();
            return(result);
        }
コード例 #4
0
 public TransitStopIconWrapper(TransitStop stop)
 {
     if (stop.Path == null)
     {
         Element = new MapIcon()
         {
             Location = stop.Position.ToGeopoint(), NormalizedAnchorPoint = new Windows.Foundation.Point(0.5, 0.5), CollisionBehaviorDesired = MapElementCollisionBehavior.RemainVisible, ZIndex = 5
         };
     }
     else
     {
         Element = new MapPolygon()
         {
             Path = new Windows.Devices.Geolocation.Geopath(GooglePolylineConverter.Decode(stop.Path).Select(ll => ll.ToBasicGeoposition())), StrokeColor = Colors.Black, FillColor = Colors.DarkGray, StrokeThickness = 2, ZIndex = 4
         };
     }
     AttachedProperties.SetElementType(Element, "TransitStop");
     AttachedProperties.SetElementID(Element, stop.ID);
     Stop = stop;
     SetStopSize();
 }
コード例 #5
0
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            var fwtc  = new string[] { "1_80439", "1_80431", "1_80438", "1_80432", "1_80437", "1_80433", "3_27814", "3_29410" };
            var stops = await _1_1.Data.ApiLayer.GetTransitStopsForArea(MainMap.Area, new System.Threading.CancellationToken());

            var fwtcStop = new TransitStop()
            {
                ID = "FWTC", Position = new LatLon(47.31753, -122.30486), Path = "_vx_HlnniVF??LJ??MF??nIG??MK??LG?", Name = "Federal Way Transit Center"
            };

            TransitStop.SqlProvider.Insert(fwtcStop, DatabaseManager.MemoryDatabase);
            foreach (var stop in stops)
            {
                var finalStop = stop;
                if (fwtc.Contains(finalStop.ID))
                {
                    finalStop.Parent = "FWTC";
                }
                TransitStop.SqlProvider.Insert(finalStop, DatabaseManager.MemoryDatabase);
            }
            LoadFromDatabase();
            //MainGrid.Children.Add(new Controls.StopArrivalsControl() { DataContext = new StopArrivalsViewModel(new TransitStop() { Children = new string[] { "FWTC" }, Name = "Selected Stops" }), Margin = new Thickness(50) });
        }
コード例 #6
0
ファイル: MessageTypes.cs プロジェクト: pingzing/trippit
 public StopsListSelectionChanged(TransitStop stop)
 {
     SelectedStop = stop;
 }
コード例 #7
0
 public override Task <RetrievedData <TransitStop> > CorrectTransitStop(TransitStop stop, CancellationToken cancellationToken)
 {
     throw new NotImplementedException();
 }
コード例 #8
0
 protected virtual void OnStopChanged(TransitStop stop)
 {
 }
コード例 #9
0
 protected override void OnStopChanged(TransitStop stop)
 {
     VM.ShowArrivals = true;
     VM.Stop         = stop;
 }
コード例 #10
0
 public StopSearchElementViewModel(TransitStop backingStop, IMessenger messenger)
 {
     BackingStop = backingStop;
     _messenger  = messenger;
 }