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)); } }
private void ShowDepartures(string from, string to, bool actSilently) { var allStations = Stations.GetAll(); var fromStationCandidates = allStations.Where(x => MainAndFilterPage.Filter(from, null, null, x)).ToArray(); var fromStation = fromStationCandidates.Length == 1 ? fromStationCandidates[0] : null; ShowDepartures(allStations, fromStation, from, to, actSilently); }