Ejemplo n.º 1
0
 private void Search_GamesList_Reset(ModernWpf.Controls.AutoSuggestBox sender, ModernWpf.Controls.AutoSuggestBoxTextChangedEventArgs args)
 {
     if (string.IsNullOrEmpty(sender.Text))
     {
         RefreshGamesList(Library.GetAllEntires());
     }
 }
Ejemplo n.º 2
0
 private void Search_GamesList(ModernWpf.Controls.AutoSuggestBox sender, ModernWpf.Controls.AutoSuggestBoxQuerySubmittedEventArgs args)
 {
     if (string.IsNullOrEmpty(sender.Text))
     {
         RefreshGamesList(Library.GetAllEntires());
     }
     else
     {
         RefreshGamesList(Library.GetEntiresSearch(sender.Text));
     }
 }
Ejemplo n.º 3
0
 private void controlsSearchBox_QuerySubmitted(ModernWpf.Controls.AutoSuggestBox sender, ModernWpf.Controls.AutoSuggestBoxQuerySubmittedEventArgs args)
 {
     if (args.ChosenSuggestion != null && args.ChosenSuggestion is string)
     {
         var item = _controlPages.FirstOrDefault(i => i.Content.ToString().Equals(args.QueryText, StringComparison.OrdinalIgnoreCase));
         navView.SelectedItem = item;
         navView.UpdateLayout();
     }
     else if (!string.IsNullOrEmpty(args.QueryText))
     {
         var item = _controlPages.FirstOrDefault(i => i.Content.ToString().Equals(args.QueryText, StringComparison.OrdinalIgnoreCase));
         if (item != null)
         {
             navView.SelectedItem = item;
             navView.UpdateLayout();
         }
     }
 }
Ejemplo n.º 4
0
        private void controlsSearchBox_TextChanged(ModernWpf.Controls.AutoSuggestBox sender, ModernWpf.Controls.AutoSuggestBoxTextChangedEventArgs args)
        {
            var suggestions = new List <string>();

            if (args.Reason == AutoSuggestionBoxTextChangeReason.UserInput)
            {
                var querySplit    = sender.Text.Split(' ');
                var matchingItems = _controlPages.Where(
                    item =>
                {
                    bool flag = true;
                    foreach (string queryToken in querySplit)
                    {
                        if (item.Content.ToString().IndexOf(queryToken, StringComparison.CurrentCultureIgnoreCase) < 0)
                        {
                            flag = false;
                        }
                    }
                    return(flag);
                });
                foreach (var item in matchingItems)
                {
                    suggestions.Add(item.Content.ToString());
                }
                if (suggestions.Count > 0)
                {
                    for (int i = 0; i < suggestions.Count; i++)
                    {
                        autoBox.ItemsSource = suggestions;
                    }
                }
                else
                {
                    autoBox.ItemsSource = new string[] { "No results found" };
                }
            }
        }
Ejemplo n.º 5
0
 internal AutoSuggestBoxTextChangedEventArgs(AutoSuggestBox source, string value)
 {
     m_source = new WeakReference <AutoSuggestBox>(source);
     m_value  = value;
 }
 internal AutoSuggestBoxTextChangedEventArgs(AutoSuggestBox source, string value, AutoSuggestionBoxTextChangeReason reason)
 {
     m_source = new WeakReference <AutoSuggestBox>(source);
     m_value  = value;
     Reason   = reason;
 }