private void AutoSuggestBox_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
 {
     ForView.Unwrap<SubscriptionViewModel>(DataContext, vm =>
     {
         vm.QuerySubmitted();
     });
 }
 private void searchAutoSuggestBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
 {
     if (string.IsNullOrEmpty(sender.Text)) goBack();
     SoundManger.GetAllSounds(Sounds);
     Suggestions = Sounds.Where(p => p.Name.StartsWith(sender.Text)).Select(p=>p.Name).ToList();
     searchAutoSuggestBox.ItemsSource = Suggestions; 
 }
Пример #3
0
        /// <summary>Initializes a new instance of the <see cref="SearchHamburgerItem"/> class.</summary>
        public SearchHamburgerItem()
        {
            AutoSuggestBox = new AutoSuggestBox();
            AutoSuggestBox.QueryIcon = new SymbolIcon { Symbol = Symbol.Find };
            AutoSuggestBox.AutoMaximizeSuggestionArea = false;
            AutoSuggestBox.Loaded += delegate { AutoSuggestBox.PlaceholderText = PlaceholderText; };
            AutoSuggestBox.QuerySubmitted += OnQuerySubmitted;
            AutoSuggestBox.GotFocus += OnGotFocus;

            Content = AutoSuggestBox;
            Icon = new SymbolIcon(Symbol.Find);

            CanBeSelected = false;
            ShowContentIcon = false;
            PlaceholderText = string.Empty;
            
            Click += (sender, args) =>
            {
                args.Hamburger.IsPaneOpen = true;
                args.Hamburger.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                {
                    AutoSuggestBox.Focus(FocusState.Programmatic);
                });
            };
        }
Пример #4
0
 private void Searchbox_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
 {
     if (!string.IsNullOrWhiteSpace(args.QueryText))
     {
         this.RootFrame?.NavigateAsync(typeof(Views.SearchPage), args.QueryText);
     }
 }
        private async void ui_search_autosuggestboxFrom_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
        {
            string stationSearchedFor = args.QueryText;

            if (string.IsNullOrWhiteSpace(stationSearchedFor) || stationSearchedFor.Length <= 3)
            {
                //user did not input more than three letters
                FromStopLocations.Clear();
                _fromId = "";

                //dirty way to show error message
                const string noResults = "Skriv mer än tre bokstäver...";
                StopLocation notCorrectEntry = new StopLocation { name = noResults };
                FromStopLocations.Add(notCorrectEntry);
                IsReadyForSearch();

                //add to autosuggestionbox
                ui_search_autosuggestboxFrom.ItemsSource = FromStopLocations;

                return;
            }
            else
            {
                //user searched for new station, clear list from old stations.
                FromStopLocations.Clear();
                //call api to get stations from user inputted text
                await ApiCaller.SearchForStationAsync(FromStopLocations, stationSearchedFor);

                //populate autosuggestionbox
                ui_search_autosuggestboxFrom.ItemsSource = FromStopLocations;

            }

        }
Пример #6
0
        private async void AutoSuggestBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
        {
            try
            {
                if (sender.Text.Length != 0)
                {
                    //ObservableCollection<String>
                    var data = new ObservableCollection<string>();
                    var httpclient = new Noear.UWP.Http.AsyncHttpClient();
                    httpclient.Url("http://mobilecdn.kugou.com/new/app/i/search.php?cmd=302&keyword="+sender.Text);
                    var httpresult = await httpclient.Get();
                    var jsondata = httpresult.GetString();
                    var obj = Windows.Data.Json.JsonObject.Parse(jsondata);
                    var arryobj = obj.GetNamedArray("data");
                    foreach (var item in arryobj)
                    {
                        data.Add(item.GetObject().GetNamedString("keyword"));
                    }
                    sender.ItemsSource = data;
                    //sender.IsSuggestionListOpen = true;
                }
                else
                {
                    sender.IsSuggestionListOpen = false;
                }
            }
            catch (Exception)
            {

            }
        }
Пример #7
0
        private void OnQuerySubmitted(AutoSuggestBox box, AutoSuggestBoxQuerySubmittedEventArgs args)
        {
            AutoSuggestBox.Text = "";

            var hamburger = box.GetVisualParentOfType<Hamburger>();
            hamburger.IsPaneOpen = false;
        }
        private async void asbox_Search_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
        {


            Func<HPUserDetail, string> f = h => h.ou;

            setWorking(true);

            string searchText = args.ChosenSuggestion == null ? args.QueryText : args.ChosenSuggestion.ToString();
            SearchInfo result = null;
            try
            {
                result = await PeopleFinderHelper.Search(searchText);
                tbl_Msg.Text = "";
            }
            catch(Exception ex)
            {
                tbl_Msg.Text = ex.Message;
            }
            
            var myResult = result?.result.GroupBy(g => new { g.co, g.c}).OrderBy(o => o.Key.co).Select(gu => new PeopleFinderViewModel() { Group = gu.Key.co,SecondGroup=gu.Key.c, Peoples = gu.ToList() });
            ViewModel = myResult;

           
            this.Bindings.Update();

            setWorking(false);




        }
Пример #9
0
 /// <summary>
 /// Invoked when a custom name is entered for a list item.
 /// </summary>
 /// <param name="sender">The name entry box</param>
 /// <param name="args">Event arguments</param>
 private void nameBox_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
 {
     var vm = DataContext as Favourites;
     var platform = sender.DataContext as DataStorage.Favourite;
     vm.ChangeCustomName(platform.PlatformNo, sender.Text);
     this.editFlyout.Hide();
 }
 private void SearchAutoSuggestBox_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
 {
     SoundManager.GetSoundsByName(Sounds, sender.Text);
     CategoryTextBlock.Text = sender.Text;
     MenuItemsListView.SelectedItem = null;
     BackButton.Visibility = Visibility.Visible;
 }
        private async void FromStationText_OnQuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
        {
            string textSubmitted = args.QueryText; //query from user

            if (textSubmitted.Length > 3)
            {
                //user searched for new station, clear list from old stations.
                FromStopLocations.Clear();
                //call api to get stations from user inputted text
                Task t = ApiCaller.PopulateStopLocationsAsync(FromStopLocations, textSubmitted);
                await t;

                //populate autosuggestionbox
                fromStationText.ItemsSource = FromStopLocations;
                IsReadyForSearch();
            }
            else
            {
                //user did not input more than three letters
                FromStopLocations.Clear();

                //dirty way to show error message
                string noResults = "Skriv mer än tre bokstäver...";
                var notCorrectEntry = new StopLocation {name = noResults};
                FromStopLocations.Add(notCorrectEntry);

                //add to autosuggestionbox
                fromStationText.ItemsSource = FromStopLocations;
            }
        }
Пример #12
0
 private void SearchBox_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
 {
     if (sender.Text.Length > 0)
     {
         SearchResultPanel.StartSearch(Frame, sender.Text);
     }
 }
 private void XmppDomainSuggest_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
 {
     if (args.Reason == AutoSuggestionBoxTextChangeReason.UserInput)
     {
         viewModel.XmppDomainSuggestions =
             new ObservableCollection<string>(viewModel.baseDomainSuggestions.Where(p => p.Contains(XmppDomainSuggest.Text)));
     }
 }
Пример #14
0
 private void AutoSuggestBox_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
 {
     ForView.Unwrap<SearchViewModel>(DataContext, vm =>
     {
         vm.QuerySubmitted();
     });
     ResultsList.Focus(FocusState.Keyboard);
 }
 /// <summary>
 /// 发表回应
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 private void MyComment_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
 {
     if (!MyComment.Text.Equals(""))
     {
         _totalHtml = _totalHtml.Replace("<a id='ok'></a>", "") + ChatBoxTool.Send("http://pic.cnblogs.com/avatar/624159/20150505133758.png", "青柠檬", MyComment.Text, DateTime.Now.ToString()) + "<a id='ok'></a>";
         FlashComment.NavigateToString(_totalHtml);
     }
 }
Пример #16
0
 private void suggestBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
 {
     if (args.CheckCurrent())
     {
         var term = suggestBox.Text.ToLower();
         var results = news.Where(i => i.Title.Contains(term)).ToList();
         suggestBox.ItemsSource = results;
     }
 }
 private void AutoSuggestBox_OnTextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
 {
     myManaApartmentManger.GetAllApartments(apartments);
     Suggestions = apartments
         .Where(p => p.ApartmentCity.ToString().ToLower().StartsWith(sender.Text))
         .Select(p => p.ApartmentCity.ToString()).Distinct()
         .ToList();
     AutoSuggestBox.ItemsSource = Suggestions;
 }
Пример #18
0
 private void StationsBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
 {
     if (args.Reason == AutoSuggestionBoxTextChangeReason.UserInput)
     {
         sender.ItemsSource = (sender.Text.Length > 0) ?
             stationsData.Where(x => x.StartsWith(sender.Text, StringComparison.OrdinalIgnoreCase)) :
             new string[] { };
     }
 }
Пример #19
0
 private void FoundServiceSubmitted(
     AutoSuggestBox sender,
     AutoSuggestBoxQuerySubmittedEventArgs args)
 {
     var choosenService = (args.ChosenSuggestion as ServiceInformation);
     if (choosenService != null)
     {
         ConcreteDataContext.NavigateToService.Execute(choosenService);
     }
 }
 private void AutoSuggestBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
 {
     if (args.Reason == AutoSuggestionBoxTextChangeReason.UserInput)
     {
         Suggestions.Clear();
         Suggestions.Add(sender.Text + "1");
         Suggestions.Add(sender.Text + "2");
     }
     Control1.ItemsSource = Suggestions;
 }
        private void alimentInput_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
        {
            if (args.Reason == AutoSuggestionBoxTextChangeReason.UserInput)
            {
                //sender.ItemsSource = fakeDB.Where(s => s.Contains(sender.Text));
                alimlist = getAlimListFromDB(sender.Text);
                sender.ItemsSource = alimlist;
            }

        }
 private async void OnQuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
 {
     string message = $"query: {args.QueryText}";
     if (args.ChosenSuggestion != null)
     {
         message += $" suggestion: {args.ChosenSuggestion}";
     }
     var dlg = new MessageDialog(message);
     await dlg.ShowAsync();
 }
Пример #23
0
 private async void searchBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
 {
     if(searchBox.Text.Length >= 3 && args.Reason == AutoSuggestionBoxTextChangeReason.UserInput)
     {
         string[] addedTags = searchBox.Text.Split(searchBoxTagSeparator);
         string partialTag = addedTags[addedTags.Length - 1];
         System.Collections.Generic.List<Common.Model.Tag> tagset = await Common.Search.TagSearch.FetchTags(partialTag);
         searchBox.ItemsSource = tagset;
     }
 }
Пример #24
0
        private void AutoSuggestBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
        {
            var txt = ((AutoSuggestBox)sender).Text;
            if (txt != " " && txt != "")
            {
                App.CurrentSearchWord = txt;
                searchDocListView.ItemsSource = new IncrementalLoadingCollection<SearchDocSource, Document>(10);

            }
        }
Пример #25
0
 private void AutoSuggestBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
 {
     // Only get results when it was a user typing, 
     // otherwise assume the value got filled in by TextMemberPath 
     // or the handler for SuggestionChosen.
     if (args.Reason == AutoSuggestionBoxTextChangeReason.UserInput)
     {
         //Set the ItemsSource to be your filtered dataset
         //sender.ItemsSource = dataset;
     }
 }
        private void AutoSuggestBoxPostalCodes_OnTextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
        {
            var vm = this.DataContext as SearchFormViewModel;
            if (null != vm)
            {
                var suggestions = vm.SuggessedPostalCodeList;

                string filter = sender.Text.ToUpper();
                AutoSuggestBoxPostalCodes.ItemsSource = suggestions.Where(s => s.Contains(filter));
            }
        }
Пример #27
0
 private void suggestions_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
 {
     if (args.Reason == AutoSuggestionBoxTextChangeReason.UserInput)
     {
         Suggestions.Clear();
         Suggestions.Add(sender.Text + "1");
         Suggestions.Add(sender.Text + "2");
         Suggestions.Add(sender.Text + "3");
         Suggestions.Add(sender.Text + "4");
     }
 }
Пример #28
0
 private void searchBox_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
 {
     if (args.ChosenSuggestion == null)
     {
         string[] temp = searchBox.Text.TrimEnd(searchBoxTagSeparator).Split(searchBoxTagSeparator);
         System.Collections.Generic.List<string> tagsList = new System.Collections.Generic.List<string>();
         foreach (string tag in temp)
             tagsList.Add(tag.Replace(' ','_').Trim('"'));
         Shell.ContentFrame.Navigate(typeof(SearchResultsPage), tagsList);
     }
 }
Пример #29
0
        // Event handler when user is typing a search query, show a list of suggestions
        private void SearchBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
        { 
            //We only want to get results when it was a user typing
            if (args.Reason == AutoSuggestionBoxTextChangeReason.UserInput) 
            { 
                var matchingEvents = EventController.GetMatchingEvents(events, sender.Text);

                RefreshEventList(sender.Text);
                sender.ItemsSource = matchingEvents.ToList(); 
            } 
        }
Пример #30
0
 private void AutoSuggestBox_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
 {
     if (args.ChosenSuggestion != null)
     {
         // User selected an item from the suggestion list, take an action on it here.
     }
     else
     {
         // Use args.QueryText to determine what to do.
     }
 }
Пример #31
0
 /*** Find controls **/
 private void findBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args) => FindAndHighLightAllOccurrence(sender.Text);
Пример #32
0
 private void SearchAutoBox_SuggestionChosen(AutoSuggestBox sender, AutoSuggestBoxSuggestionChosenEventArgs args)
 {
     SearchAutoSuggestBox.Text = (args.SelectedItem as LittleAnimal).Name;
 }
Пример #33
0
 private void auto_suggest_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
 {
 }
Пример #34
0
 private void AutoSuggestBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
 {
     //var Auto = (AutoSuggestBox)sender;
     //Auto.ItemsSource = th
 }
Пример #35
0
 private void AutoSuggestBox_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
 {
     (sender.DataContext as SearchViewModel).SearchCommand.Execute("default");
 }
Пример #36
0
        private void AutoSuggestBox_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
        {
            var query = args.QueryText;

            ContentFrame.Navigate(typeof(SearchView), query);
        }
Пример #37
0
 private void AutoSuggestBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
 {
     _searching = true;
     Data.Search(sender.Text);
     _searching = false;
 }
Пример #38
0
 private void asbName_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
 {
     ViewModel.ProjectName = sender.Text;
     ViewModel.UpdataSearchProject();
 }
Пример #39
0
 private void FilteringTextBox_TextChanged_1(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
 {
     _advancedCollectionView.RefreshFilter();
 }
 private async void OnPersonNameQuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
 {
     await this.AddPerson(args.ChosenSuggestion != null?args.ChosenSuggestion.ToString() : args.QueryText);
 }
Пример #41
0
 private void OnQuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
 {
     QuerySubmitted?.Invoke(sender, args);
 }
Пример #42
0
 private void SearchAutoSuggestBox_OnQuerySubmitted(AutoSuggestBox sender,
                                                    AutoSuggestBoxQuerySubmittedEventArgs args)
 {
 }
Пример #43
0
        }//END getSuggestions

        private void SearchboxSearch(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
        {
            suggestBox.ItemsSource = null;
            SearchAsync(sender.Text);
        }
Пример #44
0
 private void AutoSuggestBox_SuggestionChosen(AutoSuggestBox sender, AutoSuggestBoxSuggestionChosenEventArgs args)
 {
     sender.Text = (args.SelectedItem as EmojiData).Name;
 }
Пример #45
0
 private void Username_SuggestionChosen(AutoSuggestBox sender, AutoSuggestBoxSuggestionChosenEventArgs args)
 {
     sender.Text = args.SelectedItem?.ToString();
 }
 // observe if query is submitted from search box
 private void SearchBox_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
 {
     SearchQuery(args.QueryText);
 }
Пример #47
0
 private void MyAutoSuggestBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
 {
     sender.ItemsSource = selectionItems.Where(s => s.StartsWith(sender.Text)).ToArray();
 }
Пример #48
0
 private void textBox3_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
 {
 }
Пример #49
0
 /***Replace Control***/
 private void replaceBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
 {
 }
Пример #50
0
 private void textBox3_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
 {
 }
 private void CommandTextBox_OnSuggestionChosen(AutoSuggestBox sender, AutoSuggestBoxSuggestionChosenEventArgs args)
 {
     _lastChosenCommand = (args.SelectedItem as CommandItemViewModel)?.ExecutedCommand;
 }
Пример #52
0
        // AUTOSUGGEST text in the box has changed
        private void TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
        {
            // Only get results when it was a user typing,
            if (args.Reason == AutoSuggestionBoxTextChangeReason.UserInput)
            {
                //Set the ItemsSource to be your filtered dataset
                //sender.ItemsSource = dataset;

                // ALGORITHM
                // - we will prioritise substrings of the available search
                // - after that we will add the lowest levenshtein distance results up to a constant
                // - max 8

                List <string> matched = new List <string>();
                string        source  = sender.Text;
                int           results = 0;

                // go though each member of the contacts and check it
                foreach (string test in searchable_contacts)
                {
                    // if the contact contains what weve typed do far
                    if (test.Contains(source))
                    {
                        matched.Add(test);
                        results++;
                    }
                    // if we have enough get out
                    if (results > 5)
                    {
                        break;
                    }
                }

                // if we're running out of results we can get some with small errors
                if (results < 5)
                {
                    // go though each member of the contacts and check it
                    foreach (string test in searchable_contacts)
                    {
                        // we want to check only up to the characters that have been typed
                        string test_s;
                        try
                        {
                            test_s = test.Substring(0, source.Length);
                        }
                        catch (ArgumentOutOfRangeException)
                        {
                            // the search text is longer than the name oh well
                            test_s = test;
                        }

                        // if the difference number is less than 3 and its not already in
                        if (LevenshteinDistance(source, test_s) < 3 && !matched.Contains(test))
                        {
                            matched.Add(test);
                            results++;
                        }
                        // if we have enough get out
                        if (results > 7)
                        {
                            break;
                        }
                    }
                }

                sender.ItemsSource = matched;
            }
        }
Пример #53
0
 // TEXT CHANGED ON SEARCH BOX
 private void SearchAutoSuggestBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
 {
     goBack();
 }
Пример #54
0
 // AUTOSUGGEST one of the suggestions is chosen/ highlighted
 private void SuggestionChosen(AutoSuggestBox sender, AutoSuggestBoxSuggestionChosenEventArgs args)
 {
     // Set sender.Text. You can use args.SelectedItem to build your text string.
     sender.Text = args.SelectedItem.ToString();
 }
Пример #55
0
 private void AutoSuggestBox_SuggestionChosen(AutoSuggestBox sender, AutoSuggestBoxSuggestionChosenEventArgs args)
 {
 }
 private void txtSearch_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
 {
     txtSearch.ItemsSource = listkh.Where(kh => kh.StartsWith(txtSearch.Text, StringComparison.OrdinalIgnoreCase)).ToArray();
 }
Пример #57
0
        public PokedexPage()
        {
            InitializeComponent();

            // Observe changes on state
            Store.Select(
                CombineSelectors(SelectLoading, SelectIsPokedexEmpty)
                )
            .ObserveOnDispatcher()
            .Subscribe(x =>
            {
                var(loading, isPokedexEmpty) = x;

                OpenPokedexButton.ShowIf(!loading && isPokedexEmpty);

                GlobalLoadingProgressRing.IsActive = loading && isPokedexEmpty;
                GlobalLoadingProgressRing.ShowIf(loading && isPokedexEmpty);
                RootStackPanel.ShowIf(!isPokedexEmpty);
            });

            Store.Select(SelectSuggestions, 5)
            .ObserveOnDispatcher()
            .Subscribe(suggestions =>
            {
                AutoSuggestBox.ItemsSource = suggestions;
            });

            Store.Select(SelectPokemon)
            .ObserveOnDispatcher()
            .Subscribe(pokemon =>
            {
                PokemonPanel.ShowIf(pokemon.HasValue);
                PokemonIdTextBlock.Text   = pokemon.HasValue ? $"#{pokemon.Value.Id}" : string.Empty;
                PokemonNameTextBlock.Text = pokemon.HasValue ? pokemon.Value.Name : string.Empty;
                PokemonImage.Source       = pokemon.HasValue ? new BitmapImage(new Uri(pokemon.Value.Image)) : null;
            });

            Store.Select(SelectErrors)
            .ObserveOnDispatcher()
            .Subscribe(errors =>
            {
                ErrorsListView.ItemsSource = errors;
            });

            // Observe UI events
            OpenPokedexButton.Events().Click
            .ObserveOnDispatcher()
            .Subscribe(_ => Store.Dispatch(new GetPokemonListAction()));

            AutoSuggestBox.Events().TextChanged
            .ObserveOnDispatcher()
            .Subscribe(_ =>
            {
                Store.Dispatch(new UpdateSearchStringAction {
                    Search = AutoSuggestBox.Text
                });
            });

            AutoSuggestBox.Events().SuggestionChosen
            .ObserveOnDispatcher()
            .Subscribe(e =>
            {
                var selectedPokemonOption = (e.SelectedItem as PokemonGeneralInfo).ToOption();
                if (selectedPokemonOption.HasValue)
                {
                    AutoSuggestBox.Text = selectedPokemonOption.Value.Name;     // Avoid the automatic change of the Text property of SuggestBox
                    Store.Dispatch(new UpdateSearchStringAction {
                        Search = selectedPokemonOption.Value.Name
                    });
                }
            });

            // Register Effects
            Store.RegisterEffects(
                LoadPokemonList,
                LoadPokemonById,
                SearchPokemon
                );

            // Initialize Documentation
            DocumentationComponent.LoadMarkdownFilesAsync("Pokedex");

            GoToGitHubButton.Events().Click
            .Subscribe(async _ =>
            {
                var uri = new Uri("https://github.com/Odonno/ReduxSimple/tree/master/ReduxSimple.Samples/Pokedex");
                await Launcher.LaunchUriAsync(uri);
            });

            OpenDevToolsButton.Events().Click
            .Subscribe(async _ =>
            {
                await Store.OpenDevToolsAsync();
            });

            ContentGrid.Events().Tapped
            .Subscribe(_ => DocumentationComponent.Collapse());
            DocumentationComponent.ObserveOnExpanded()
            .Subscribe(_ => ContentGrid.Blur(5).Start());
            DocumentationComponent.ObserveOnCollapsed()
            .Subscribe(_ => ContentGrid.Blur(0).Start());
        }
Пример #58
0
        private void SearchAutoSuggestBox_OnTextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
        {
            var suggestion = Words.Where(x => x.Value.StartsWith(sender.Text) || x.Value.StartsWith(sender.Text.ToLower()) || x.Value.StartsWith(sender.Text.ToUpper())).Select(x => x.Key).ToList();

            SearchAutoSuggestBox.ItemsSource = suggestion;
        }
Пример #59
0
 private void FilteringTextBox_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
 {
     ItemsList.SelectedItem = args.ChosenSuggestion;
     ItemsList.ScrollIntoView(args.ChosenSuggestion, ScrollIntoViewAlignment.Leading);
 }
Пример #60
0
 private void CBoxLotNums_SuggestionChosen(AutoSuggestBox sender, AutoSuggestBoxSuggestionChosenEventArgs args)
 {
     SelectedLot = args.SelectedItem as LotItem;
     sender.Text = SelectedLot.Code;
 }