Ejemplo n.º 1
0
        async void Grid_Popup_Search_textbox_TextChanged(object sender, TextChangedEventArgs e)
        {
            try
            {
                string searchString      = grid_Popup_Search_textbox.Text;
                string placeholderString = (string)grid_Popup_Search_textbox.GetValue(TextboxPlaceholder.PlaceholderProperty);
                if (!string.IsNullOrWhiteSpace(searchString) && searchString != placeholderString)
                {
                    //Clear the current popup list
                    List_Search.Clear();

                    //Search and add applications
                    IEnumerable <DataBindApp> searchResult = CombineAppLists(true, true, true).Where(x => x.Name.ToLower().Contains(searchString.ToLower()));
                    foreach (DataBindApp dataBindApp in searchResult)
                    {
                        try
                        {
                            await ListBoxAddItem(lb_Search, List_Search, dataBindApp, false, false);
                        }
                        catch { }
                    }

                    //Update the search results count
                    UpdateSearchResults();

                    //Select the first search index
                    lb_Search.SelectedIndex = 0;

                    Debug.WriteLine("Added search application: " + searchString);
                }
                else
                {
                    //Clear the current popup list
                    List_Search.Clear();

                    //Reset the search text
                    grid_Popup_Search_Count_TextBlock.Text        = string.Empty;
                    grid_Popup_Search_textblock_Result.Text       = "Please enter a search term above.";
                    grid_Popup_Search_textblock_Result.Visibility = Visibility.Visible;
                }
            }
            catch { }
        }
Ejemplo n.º 2
0
        //Reset the popup to defaults
        async Task Popup_Reset_Search(bool FocusTextbox)
        {
            try
            {
                //Clear the current popup list
                List_Search.Clear();

                //Reset the search text
                grid_Popup_Search_Count_TextBlock.Text = string.Empty;

                if (FocusTextbox)
                {
                    //Empty the textbox text
                    grid_Popup_Search_textbox.Text = string.Empty;

                    //Force focus on element
                    await FrameworkElementFocus(grid_Popup_Search_textbox, false, vProcessCurrent.MainWindowHandle);
                }
                else
                {
                    string placeholderString = (string)grid_Popup_Search_textbox.GetValue(TextboxPlaceholder.PlaceholderProperty);
                    grid_Popup_Search_textbox.Text = placeholderString;
                }

                grid_Popup_Search_textblock_Result.Text       = "Please enter a search term above.";
                grid_Popup_Search_textblock_Result.Visibility = Visibility.Visible;

                //Show or hide the keyboard icon
                if (CheckKeyboardEnabled())
                {
                    grid_Popup_Search_button_KeyboardControllerIcon.Visibility = Visibility.Visible;
                }
                else
                {
                    grid_Popup_Search_button_KeyboardControllerIcon.Visibility = Visibility.Collapsed;
                }
            }
            catch { }
        }