private void SearchButton_Click(object sender, RoutedEventArgs e) { var search = new SearchPrompt(); Observable.FromEvent <PopUpEventArgs <string, PopUpResult> >(search, "Completed").Take(1).ObserveOnDispatcher() .Subscribe( q => { try { if (q.EventArgs.PopUpResult == PopUpResult.Ok && !string.IsNullOrWhiteSpace(q.EventArgs.Result)) { this.NavigationService.Navigate(PageUrl.SearchMixes(q.EventArgs.Result)); } } catch (InvalidOperationException) { // Couldn't navigate we're probably being closed } }); search.ActionPopUpButtons.Clear(); search.Show(); }
private void PerformSearch() { if (string.IsNullOrWhiteSpace(this.searchText.Text)) { this.CloseSearch(); return; } this.Searches.OnNext(this.searchText.Text); try { this.Navigation.Navigate(PageUrl.SearchMixes(this.searchText.Text)); } catch (InvalidOperationException) { // Thrown when task is not in the foreground. } }