Exemplo n.º 1
0
 private void EmotionNameAutoSuggestBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
 {
     if (args.CheckCurrent())
     {
         UpdateEmotionSuggestions();
     }
 }
Exemplo n.º 2
0
 private void EmailTextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
 {
     if (args.CheckCurrent() && args.Reason == AutoSuggestionBoxTextChangeReason.UserInput)
     {
         _acvEmail.RefreshFilter();
     }
 }
Exemplo n.º 3
0
 private void FromBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
 {
     if (args.CheckCurrent())
     {
         using (var context = new parusaContext())
         {
             List <string> result = new List <string>();
             string        term   = fromBox.Text.ToLower();
             if (term == "")
             {
                 return;
             }
             var cities = context.Cities.Where(i => i.Name.StartsWith(term)).ToList();
             if (cities.Count != 0)
             {
                 List <Airports> ports = new List <Airports>();
                 foreach (var city in cities)
                 {
                     ports.AddRange(context.Airports.Where(i => i.City == city));
                 }
                 foreach (var air in ports)
                 {
                     string country = context.Countries.FirstOrDefault(q => q.Id == air.City.IdCountry).Name;
                     string item    = string.Format("{0}, {1}, {2}", air.City.Name, country, air.Iatacode);
                     result.Add(item);
                 }
             }
             // var airports = context.Airports.Where(i => i.Name.ToLower().Contains(term)).ToList();
             fromBox.ItemsSource          = result;
             fromBox.IsSuggestionListOpen = true;
         }
     }
 }
Exemplo n.º 4
0
 private async void controlsSearchBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
 {
     if (args.CheckCurrent() && args.Reason == AutoSuggestionBoxTextChangeReason.UserInput)
     {
         await ViewModel.GetSearchSuggestionsAsync();
     }
 }
Exemplo n.º 5
0
        private async void Host_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
        {
            if (await FileIO.IsFilePresent(FileIO.ACCSESS_FILE))
            {
                string txt = await FileIO.ReadFromFile(FileIO.ACCSESS_FILE);

                List <ConnectionString> list = FileIO.GetConnectionStrings(txt);

                if (args.CheckCurrent())
                {
                    if (string.IsNullOrEmpty(Host.Text))
                    {
                        selectConnectionString = null;
                        hosts.Clear();
                    }
                    else
                    {
                        var results = list.Where(i => i.host.ToLower().Contains(Host.Text)).ToList();
                        hosts.Clear();

                        foreach (ConnectionString item in results)
                        {
                            hosts.Add(item);
                        }
                    }
                }
            }
        }
Exemplo n.º 6
0
        private async void AutoSuggestBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
        {
            if (String.IsNullOrWhiteSpace(SearchBox.Text))
            {
                _stopList.Clear();
                _addressList.Clear();
                _favoritePlacesList.Clear();

                // this has to happen after the list clearing. clearing _stopList seems to force a SuggestionChosen(), which grabs the first item in the still-filled _addressList.
                SearchText    = "";
                SelectedPlace = null;
                return;
            }

            if (!args.CheckCurrent())
            {
                SearchText = SearchBox.Text;
            }

            if (args.Reason == AutoSuggestionBoxTextChangeReason.UserInput)
            {
                SelectedPlace = new Place
                {
                    Name = SearchText,
                    Type = ModelEnums.PlaceType.NameOnly
                };
                await TriggerSearch(SearchText);
            }
        }
Exemplo n.º 7
0
        private void searchLog_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
        {
            if (args.CheckCurrent() && sender.Text != null)
            {
                //List<string> suggestion = new List<string>();
                //foreach (string s in monsterNamesList)
                //{
                //    string checkList = "";
                //    string letterCase = sender.Text.ToUpper();
                //    string nameCheck = s.ToUpper();

                //    int i = 0;
                //    foreach(char c in letterCase)
                //    {
                //        if (i + 1 >= s.Length)
                //            break;

                //        if(c == nameCheck[i + 1])
                //            checkList += nameCheck[i + 1];
                //        i++;
                //    }

                //    if (letterCase == checkList)
                //        suggestion.Add(s);
                //}

                //searchLog.ItemsSource = suggestion;
            }
        }
Exemplo n.º 8
0
 private void OnTextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
 {
     if (args.CheckCurrent())
     {
         Element.Text = Control.Text;
     }
 }
 private async void SearchBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
 {
     if (args.CheckCurrent())
     {
         await mainviewmodel.SerializeSearchResults(SearchBox.Text);
     }
 }
Exemplo n.º 10
0
 private void TagTokens_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
 {
     // Make sure the event is fired because of the user
     if (args.CheckCurrent() && args.Reason == AutoSuggestionBoxTextChangeReason.UserInput)
     {
         Acv.RefreshFilter();
     }
 }
Exemplo n.º 11
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;
     }
 }
Exemplo n.º 12
0
 private void Control_name_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
 {
     if (args.CheckCurrent())
     {
         var searchTerm = control_name.Text.ToLower();
         var result     = _usuals.Where(i => i.Contains(searchTerm)).ToList();
         control_name.ItemsSource = result;
     }
 }
Exemplo n.º 13
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;
     }
 }
Exemplo n.º 14
0
 private void txtSearchSuggest_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
 {
     if (args.CheckCurrent() && args.Reason == AutoSuggestionBoxTextChangeReason.UserInput)
     {
         var search_term = txtSearchSuggest.Text;
         var results     = FindContact(search_term);
         txtSearchSuggest.ItemsSource = results;
     }
 }
Exemplo n.º 15
0
        private async void StandardStop_TextChangedAsync(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
        {
            await Task.Delay(500);

            if (sender.Text.Length > 2 && args.CheckCurrent())
            {
                await viewModel.LoadStopLocationsAsync(sender.Text);
            }
        }
Exemplo n.º 16
0
 private void SearchBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
 {
     if (args.Reason == AutoSuggestionBoxTextChangeReason.UserInput)
     {
         if (args.CheckCurrent())
         {
             UpdateSuggestions(sender);
         }
     }
 }
Exemplo n.º 17
0
 private async void OnTextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
 {
     if (args.Reason == AutoSuggestionBoxTextChangeReason.UserInput)
     {
         if (args.CheckCurrent())
         {
             Items = String.IsNullOrEmpty(sender.Text) ? null : await GetItems(sender.Text);
         }
     }
 }
Exemplo n.º 18
0
 private void FindProduct_OnTextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
 {
     if (args.Reason == AutoSuggestionBoxTextChangeReason.UserInput)
     {
         if (args.CheckCurrent())
         {
             sender.ItemsSource = Suggestions.Where(p => p.Name.ToUpper().Contains(sender.Text.ToUpper())).ToList();
         }
     }
 }
Exemplo n.º 19
0
        private void TokenBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
        {
            if (!args.CheckCurrent())
            {
                return;
            }

            if (args.Reason == AutoSuggestionBoxTextChangeReason.UserInput)
            {
                var text = sender.Text;
                var list = SuggestedItemsSource as IList;

                if (list != null)
                {
                    _typeTimer.Debounce(
                        async() =>
                    {
                        var graph = ProviderManager.Instance.GlobalProvider.Graph;
                        if (graph != null)
                        {
                            // If empty, will clear out
                            list.Clear();

                            if (!string.IsNullOrWhiteSpace(text))
                            {
                                foreach (var user in (await graph.FindUserAsync(text)).CurrentPage)
                                {
                                    // Exclude people in suggested list that we already have picked
                                    if (!Items.Any(person => (person as Person)?.Id == user.Id))
                                    {
                                        list.Add(user.ToPerson());
                                    }
                                }

                                // Grab ids of current suggestions
                                var ids = list.Cast <object>().Select(person => (person as Person).Id);

                                foreach (var contact in (await graph.FindPersonAsync(text)).CurrentPage)
                                {
                                    // Exclude people in suggested list that we already have picked
                                    // Or already suggested
                                    if (!Items.Any(person => (person as Person)?.Id == contact.Id) &&
                                        !ids.Any(id => id == contact.Id))
                                    {
                                        list.Add(contact);
                                    }
                                }
                            }
                        }

                        // TODO: If we don't have Graph connection and just list of Person should we auto-filter here?
                    }, TimeSpan.FromSeconds(0.3));
                }
            }
        }
Exemplo n.º 20
0
 private void OuiCompanies_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
 {
     if (args.CheckCurrent())
     {
         var search_term = OuiCompanies.Text.ToLower();
         var results     = App.OuiApp.Groups
                           .Where(i => i.groupName.ToString().ToLower().Contains
                                      (search_term.ToLower())).OrderBy(i => i.groupName).ToList();
         OuiCompanies.ItemsSource = results;
     }
 }
Exemplo n.º 21
0
 void Control_name_TextChanged(AutoSuggestBox sender,
                               AutoSuggestBoxTextChangedEventArgs args)
 {
     if (args.CheckCurrent())
     {
         string        search_term = control_name.Text.ToLower();
         List <string> results     = _usuals.
                                     Where(i => i.Contains(search_term.ToLower())).ToList();
         control_name.ItemsSource = results;
     }
 }
 private void Control_name_TextChanged(AutoSuggestBox sender,
                                       AutoSuggestBoxTextChangedEventArgs args)
 {
     if (args.CheckCurrent())
     {
         var search_term = control_name.Text.ToLower();
         var results     = App.Model.Customers
                           .Where(i => i.CustomerName.ToLower()
                                  .Contains(search_term.ToLower())).ToList();
         control_name.ItemsSource = results;
     }
 }
Exemplo n.º 23
0
 private void Buscador_clientes_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
 {
     if (args.Reason == AutoSuggestionBoxTextChangeReason.UserInput)
     {
         if (args.CheckCurrent())
         {
             ClientesBuscados = String.IsNullOrEmpty(sender.Text) ? null : Cliente.GetClientes(sender.Text);
             Buscador_clientes.ItemsSource = null;
             Buscador_clientes.ItemsSource = ClientesBuscados;
         }
     }
 }
Exemplo n.º 24
0
        private async void controlsSearchBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
        {
            if (!args.CheckCurrent())
            {
                return;
            }

            var r = await GetSuggestions(sender.Text);

            if (r == null)
            {
                return;
            }
            Results = new ObservableCollection <MicrosoftStore.Models.Product>(r.Where(s => s.Source == "Apps"));

            if (args.Reason == AutoSuggestionBoxTextChangeReason.UserInput)
            {
                var suggestions = new List <MicrosoftStore.Models.Product>();

                var querySplit    = sender.Text.Split(" ");
                var matchingItems = Results.Where(
                    item =>
                {
                    // Idea: check for every word entered (separated by space) if it is in the name,
                    // e.g. for query "split button" the only result should "SplitButton" since its the only query to contain "split" and "button"
                    // If any of the sub tokens is not in the string, we ignore the item. So the search gets more precise with more words
                    bool flag = true;
                    foreach (string queryToken in querySplit)
                    {
                        // Check if token is not in string
                        if (item.Title.IndexOf(queryToken, StringComparison.CurrentCultureIgnoreCase) < 0)
                        {
                            // Token is not in string, so we ignore this item.
                            flag = false;
                        }
                    }
                    return(flag);
                }
                    );
                foreach (var item in matchingItems)
                {
                    suggestions.Add(item);
                }
                if (suggestions.Count > 0)
                {
                    controlsSearchBox.ItemsSource = suggestions.OrderByDescending(i => i.Title.StartsWith(sender.Text, StringComparison.CurrentCultureIgnoreCase)).ThenBy(i => i.Title);
                }
                else
                {
                    controlsSearchBox.ItemsSource = new string[] { "No results found" };
                }
            }
        }
Exemplo n.º 25
0
        private void suggestBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
        {
            if (args.CheckCurrent())
            {
                var term = suggestBox.Text.ToLower();

                var results = list_of_persons.Where(i => i.LastName.Ru != null &&
                                                    i.LastName.Ru.ToLower().Contains(term)).ToList();
                suggestBox.ItemsSource       = results;
                suggestBox.DisplayMemberPath = "LastName.Ru";
            }
        }
 private void TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
 {
     if (args.CheckCurrent() && args.Reason == AutoSuggestionBoxTextChangeReason.UserInput)
     {
         if (string.IsNullOrWhiteSpace(sender.Text))
         {
             _ttb.SuggestedItemsSource = Array.Empty <object>();
         }
         else
         {
             _ttb.SuggestedItemsSource = _samples.Where((item) => item.Text.Contains(sender.Text, System.StringComparison.CurrentCultureIgnoreCase)).OrderByDescending(item => item.Text);
         }
     }
 }
Exemplo n.º 27
0
 private void AutoSuggestBoxBranch_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
 {
     if (args.CheckCurrent())
     {
         SearchTerm = autoSuggestBoxBranch.Text;
         if (!IsFilteredBranchesNull())
         {
             autoSuggestBoxBranch.ItemsSource = SimpleIoc.Default.GetInstance <BranchesViewModel>().Branches;
             FilterListOfBranches();
             List <string> name_results = new List <string>();
             SimpleIoc.Default.GetInstance <BranchesViewModel>().FilteredBranches.ForEach(b => name_results.Add(b.Name));
             autoSuggestBoxBranch.ItemsSource = name_results;
         }
     }
 }
Exemplo n.º 28
0
        private static async void asb_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
        {
            var needAutoComplete = args.Reason == AutoSuggestionBoxTextChangeReason.UserInput;
            var currentState     = GetStateCode(sender);

            if (needAutoComplete)
            {
                var r = await loadSuggestion(sender);

                if (args.CheckCurrent() && currentState == GetStateCode(sender))
                {
                    sender.ItemsSource = r;
                }
            }
        }
Exemplo n.º 29
0
 private void AutoSuggestBoxSubscription_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
 {
     if (args.CheckCurrent())
     {
         SearchTerm = autoSuggestBoxSubscription.Text;
         if (isFilteredSubscriptionsNull() == false)
         {
             autoSuggestBoxSubscription.ItemsSource = SimpleIoc.Default.GetInstance <BranchesViewModel>().Subscriptions;
             filterListOfSubscriptions();
             List <string> name_results = new List <string>();
             SimpleIoc.Default.GetInstance <BranchesViewModel>().FilteredSubscriptions.ForEach(s => name_results.Add(s.Branch.Name));
             autoSuggestBoxSubscription.ItemsSource = name_results;
         }
     }
 }
Exemplo n.º 30
0
        private async void CompanySearchBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
        {
            if (args.CheckCurrent())
            {
                App.OuiApp.GAddress.Clear();
                var search_term = CompanySearchBox.Text.ToLower();
                if (search_term.Length >= 3)
                {
                    await GetAllPredectionsFromGoogle(search_term);

                    var results = App.OuiApp.GAddress
                                  .Where(i => i.description.ToString().ToLower().Contains
                                             (search_term.ToLower())).OrderBy(i => i.description).ToList();
                    CompanySearchBox.ItemsSource = results;
                }
            }
        }
Exemplo n.º 31
0
        private void TokenBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
        {
            if (!args.CheckCurrent())
            {
                return;
            }

            if (args.Reason == AutoSuggestionBoxTextChangeReason.UserInput)
            {
                _typeTimer.Debounce(
                    async() =>
                {
                    var text = sender.Text;
                    await UpdateResultsAsync(text);

                    // TODO: If we don't have Graph connection and just list of Person should we auto-filter here?
                }, TimeSpan.FromSeconds(0.3));
            }
        }