Ejemplo n.º 1
0
        private void ShowDepartures(Station[] allStations, Station fromStation, string from, string to, bool actSilently)
        {
            var toStationCandidates = allStations.Where(x => MainAndFilterPage.Filter(to, fromStation, null, x)).ToArray();
            var toStation           = toStationCandidates.Length == 1 ? toStationCandidates[0] : null;

            if (fromStation != null)
            {
                if (toStation != null)
                {
                    var target = DeparturesAndArrivalsTable.Create(fromStation, toStation);
                    NavigationService.Navigate(StationPage.GetUri(this, target, removeBackEntry: true));
                    return;
                }
                else
                {
                    if (string.IsNullOrEmpty(to))
                    {
                        var target = DeparturesAndArrivalsTable.Create(fromStation);
                        NavigationService.Navigate(StationPage.GetUri(this, target));
                    }
                    else
                    {
                        NavigationService.Navigate(MainAndFilterPage.GetUri(this, fromStation, initialFilter: to, removeBackEntry: true));
                    }
                    return;
                }
            }
            else
            {
                NavigationService.Navigate(MainAndFilterPage.GetUri(this, null, initialFilter: from, removeBackEntry: true));
            }
        }
Ejemplo n.º 2
0
        private void GoToStation(object dataContext)
        {
            var target = dataContext as DeparturesAndArrivalsTable;

            if (target != null)
            {
                if (fromStation != null)
                {
                    Debug.Assert(!target.HasDestinationFilter);
                    target = DeparturesAndArrivalsTable.Create(fromStation, target.Station);
                }
            }
            else
            {
                var station = dataContext as Station ?? ((Tuple <double, Station>)dataContext).Item2;
                target = fromStation == null?DeparturesAndArrivalsTable.Create(station) :
                             DeparturesAndArrivalsTable.Create(fromStation, station);
            }
            NavigationService.Navigate(StationPage.GetUri(this, target, removeBackEntry: fromStation != null));
        }