private void SearchTextBox_PreviewKeyDown(object sender, KeyEventArgs e)
 {
     // Tab key for autocomplete
     if (e.Key == Key.Tab)
     {
     }
     // Up and down arrow key for navigation in history
     if (e.Key == Key.Up || e.Key == Key.Down)
     {
     }
     // Take action on enter key, if not multiline: if multiline interface then ignore enter as action
     if (e.Key == Key.Enter && ((interfaceOption & InterfaceOption.MultilineEditing) != InterfaceOption.MultilineEditing))
     {
         // If InterfaceOption.ExtendedFunctions is enabled check option in combo box
         if ((interfaceOption & InterfaceOption.ExtendedFunctions) == InterfaceOption.ExtendedFunctions && SearchModeComboBox.SelectedIndex == 1)
         {
             // Search web
             VirtualWorkspaceWindow current = VirtualWorkspaceWindow.Current;
             current.OpenWebpage(SearchTextBox.Text);
         }
         else
         {
             // Do nothing
         }
     }
 }
        private void SearchTextBox_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            // Pass to Secondary Handler
            SecondaryPreviewKeyDownEvent.Invoke(e);
            if (e.Handled == true)
            {
                return;
            }

            // Number key for clue selection
            #region Functional Key Handling
            if (ClueFragmentSelectionpane.ItemsSource != null)
            {
                List <ClueFragment> clueFragments = ClueFragmentSelectionpane.ItemsSource as List <ClueFragment>;
                switch (e.Key)
                {
                case Key.F1:
                    if (clueFragments.Count >= 1)
                    {
                        AppendClueFragment(clueFragments[0].Name);
                        e.Handled = true;
                    }
                    break;

                case Key.F2:
                    if (clueFragments.Count >= 2)
                    {
                        AppendClueFragment(clueFragments[1].Name);
                        e.Handled = true;
                    }
                    break;

                case Key.F3:
                    if (clueFragments.Count >= 3)
                    {
                        AppendClueFragment(clueFragments[2].Name);
                        e.Handled = true;
                    }
                    break;

                case Key.F4:
                    if (clueFragments.Count >= 4)
                    {
                        AppendClueFragment(clueFragments[3].Name);
                        e.Handled = true;
                    }
                    break;

                case Key.F5:
                    if (clueFragments.Count >= 5)
                    {
                        AppendClueFragment(clueFragments[4].Name);
                        e.Handled = true;
                    }
                    break;

                case Key.F6:
                    if (clueFragments.Count >= 6)
                    {
                        AppendClueFragment(clueFragments[5].Name);
                        e.Handled = true;
                    }
                    break;

                case Key.F7:
                    if (clueFragments.Count >= 7)
                    {
                        AppendClueFragment(clueFragments[6].Name);
                        e.Handled = true;
                    }
                    break;

                case Key.F8:
                    if (clueFragments.Count >= 8)
                    {
                        AppendClueFragment(clueFragments[7].Name);
                        e.Handled = true;
                    }
                    break;

                case Key.F9:
                    if (clueFragments.Count >= 9)
                    {
                        AppendClueFragment(clueFragments[8].Name);
                        e.Handled = true;
                    }
                    break;

                case Key.System:
                    if (e.SystemKey == Key.F10 && clueFragments.Count >= 10)
                    {
                        AppendClueFragment(clueFragments[9].Name);
                        e.Handled = true;
                    }
                    break;

                case Key.F11:
                    if (clueFragments.Count >= 11)
                    {
                        AppendClueFragment(clueFragments[10].Name);
                        e.Handled = true;
                    }
                    break;

                case Key.F12:
                    if (clueFragments.Count >= 12)
                    {
                        AppendClueFragment(clueFragments[11].Name);
                        e.Handled = true;
                    }
                    break;

                default:
                    break;
                }
            }
            #endregion
            // Tab key for autocomplete using the first available clue
            if (e.Key == Key.Tab && ClueFragmentSelectionpane.ItemsSource != null)
            {
                List <ClueFragment> clueFragments = ClueFragmentSelectionpane.ItemsSource as List <ClueFragment>;
                if (clueFragments.Count >= 1)
                {
                    AppendClueFragment(clueFragments[0].Name);
                    e.Handled = true;
                }
            }
            // Up and down arrow key for navigation in history
            if (e.Key == Key.Up || e.Key == Key.Down)
            {
            }
            // Take action on enter key, if not multiline: if multiline interface then ignore enter as action
            if (e.Key == Key.Enter && ((InterfaceOption & InterfaceOption.MultilineEditing) != InterfaceOption.MultilineEditing))
            {
                // If InterfaceOption.ExtendedFunctions is enabled check option in combo box
                if ((InterfaceOption & InterfaceOption.ExtendedFunctions) == InterfaceOption.ExtendedFunctions && ComboBoxSelection == SearchComboBoxEnum.Web)
                {
                    // Search web
                    VirtualWorkspaceWindow current = VirtualWorkspaceWindow.CurrentWindow;
                    current.OpenWebpage(SearchTextBox.Text);
                }
                else
                {
                    // Do nothing
                }
            }
        }