public ToolbarControl()
        {
            InitializeComponent();

            Loaded   += OnLoaded;
            Unloaded += OnUnloaded;

            ApplicationResources.Instance.ResourceChanged += (object sender, ResourcesChangedEventArgs e) =>
            {
                try
                {
                    Resources.MergedDictionaries.Add(e.NewResource);
                    Properties.Settings.Default.Save();
                }
                catch (Exception ex)
                {
                    ToolbarLogger.GetLogger("EverythingToolbar").Error(ex, "Failed to apply resource.");
                }
            };
            ApplicationResources.Instance.LoadDefaults();

            SearchResultsPopup.Closed += (object sender, EventArgs e) =>
            {
                Keyboard.Focus(KeyboardFocusCapture);
                UnfocusRequested?.Invoke(this, new EventArgs());
            };

            ShortcutManager.Instance.AddOrReplace("FocusSearchBox",
                                                  (Key)Properties.Settings.Default.shortcutKey,
                                                  (ModifierKeys)Properties.Settings.Default.shortcutModifiers,
                                                  FocusSearchBox);
        }
        public ToolbarControl()
        {
            InitializeComponent();

            ApplicationResources.Instance.ResourceChanged += (object sender, ResourcesChangedEventArgs e) =>
            {
                try
                {
                    Resources.MergedDictionaries.Add(e.NewResource);
                    Properties.Settings.Default.Save();
                }
                catch (Exception ex)
                {
                    ToolbarLogger.GetLogger("EverythingToolbar").Error(ex, "Failed to apply resource.");
                }
            };
            ApplicationResources.Instance.LoadDefaults();

            SearchBox.LostKeyboardFocus += (object sender, KeyboardFocusChangedEventArgs e) =>
            {
                Keyboard.Focus(KeyboardFocusCapture);
                UnfocusRequested?.Invoke(this, new EventArgs());
            };

            if (!ShortcutManager.Instance.AddOrReplace("FocusSearchBox",
                                                       (Key)Properties.Settings.Default.shortcutKey,
                                                       (ModifierKeys)Properties.Settings.Default.shortcutModifiers,
                                                       FocusSearchBox))
            {
                ShortcutManager.Instance.SetShortcut(Key.None, ModifierKeys.None);
                MessageBox.Show(Properties.Resources.MessageBoxFailedToRegisterHotkey,
                                Properties.Resources.MessageBoxErrorTitle,
                                MessageBoxButton.OK,
                                MessageBoxImage.Error);
            }

            ShortcutManager.Instance.SetFocusCallback(FocusSearchBox);
            if (Properties.Settings.Default.isReplaceStartMenuSearch)
            {
                ShortcutManager.Instance.HookStartMenu();
            }
        }