protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            await base.InitializeAsync(cancellationToken, progress);

            await JoinableTaskFactory.SwitchToMainThreadAsync();    // Command constructors need to be on main thread.

            PickColorCommand.Initialize(this);
            ResetColorCommand.Initialize(this);
            EnableAutoPickColorCommand.Initialize(this);

            listener = new SolutionOpenListener(this);

            await UpdateTitleBarControllerListAsync();

            // Window events won't give us events for undocking so we can't use that.
            //var dte = VSUtils.GetDTE();
            //windowEvents = dte.Events.WindowEvents;
            //windowEvents.WindowCreated += (Window) => CheckForNewController();
            //windowEvents.WindowClosing += (Window) => CheckForNewController();

            // Instead we're using a bigger gun: The Automation framework!
            // Sadly, it is not enough to listen to child windows of VS since code window popups are direct children of the desktop in terms of UI.
            Automation.AddAutomationEventHandler(WindowPattern.WindowOpenedEvent, AutomationElement.RootElement, TreeScope.Children, OnWindowOpenedClosed);
            // Weirdly, this doesn't apply to ALL child windows, and some are children of the main window after all. (Repro: Create a window out of two non-code views)
            var windowHandle            = new WindowInteropHelper(Application.Current.MainWindow).Handle;
            var windowAutomationElement = AutomationElement.FromHandle(windowHandle);

            Automation.AddAutomationEventHandler(WindowPattern.WindowOpenedEvent, windowAutomationElement, TreeScope.Subtree, OnWindowOpenedClosed);

            // Cant use TreeScope.Children on WindowClosedEvent.
            Automation.AddAutomationEventHandler(WindowPattern.WindowClosedEvent, AutomationElement.RootElement, TreeScope.Subtree, OnWindowOpenedClosed);
        }
 /// <summary>
 /// Initializes the singleton instance of the command.
 /// </summary>
 /// <param name="package">Owner package, not null.</param>
 public static void Initialize(SolutionColorPackage package)
 {
     Instance = new EnableAutoPickColorCommand(package);
 }