private void OnLibrarySelfDestruct(object sender, EventArgs e)
        {
            try
            {
                if (_libraryPanel != null)
                {
                    var panel = _libraryPanel;

                    _libraryPanel = null;

                    LibraryPanelContainer.Children.Remove(panel);

                    Diagnostics.LogTrace("LibraryPanel: Removed from the visual tree.");
                }
            }
            catch (Exception ex)
            {
                Diagnostics.LogException(ex);
            }
        }
        public void OnShowLibrary()
        {
            // Kill off the timer immediately so it doesn't fire
            // while we are loading.
            DestroyLibrarySelfDestructTimer();

            if (_libraryPanel == null)
            {
                LibraryPanel newPanel = new LibraryPanel();

                Binding binding = new Binding("Packages");
                binding.Mode = BindingMode.OneWay;
                newPanel.SetBinding(LibraryPanel.PackagesSourceProperty, binding);

                LibraryPanelContainer.Children.Add(newPanel);

                _libraryPanel = newPanel;
            }

            _libraryPanel.SetInitialFocus();
        }