private async Task DoSearch() { if (Date == DateTime.MinValue) { Date = DateTime.Now; } if (Time == DateTime.MinValue) { Time = DateTime.Now; } if (string.IsNullOrEmpty(Type)) { Type = "vertrek"; } //Create planner object with GUID PlannerSearch search = new PlannerSearch() { Id = Guid.NewGuid(), SearchDateTime = DateTime.Now, VanStation = VanStation, NaarStation = NaarStation, ViaStation = ViaStation, IsHogesnelheid = IsHogesnelheid, IsYearCard = IsYearCard, Type = Type, Date = Date, Time = Time }; if (search.VanStation != null && search.NaarStation != null) { try { //Save settings var settings = SettingService.GetSettings(); settings.HasYearCard = IsYearCard; settings.UseHsl = IsHogesnelheid; SettingService.SaveSettings(settings); } catch { //never allow it to crash, this is really important } //Save planner object await PlannerService.AddSearchAsync(search); //Navigate to new page and pass GUID //string url = string.Format("/Views/Reisadvies.xaml?id={0}", search.Id); NavigationService.NavigateToReisadvies(search.Id); } }