private void InitializeCommands()
        {
            CommandManager.BeginUpdate();

            commandWeblogPicker = new CommandWeblogPicker();
            _editingSite.CommandManager.Add(commandWeblogPicker);
            _editingSite.WeblogListChanged -= EditingSiteOnWeblogListChanged;
            _editingSite.WeblogListChanged += EditingSiteOnWeblogListChanged;

            commandAddWeblog          = new Command(CommandId.AddWeblog);
            commandAddWeblog.Execute += new EventHandler(commandAddWeblog_Execute);
            CommandManager.Add(commandAddWeblog);

            commandConfigureWeblog          = new Command(CommandId.ConfigureWeblog);
            commandConfigureWeblog.Execute += new EventHandler(commandConfigureWeblog_Execute);
            CommandManager.Add(commandConfigureWeblog);

            commandSelectBlog = new SelectBlogGalleryCommand(_editingManager);
            commandSelectBlog.ExecuteWithArgs += new ExecuteEventHandler(commandSelectBlog_ExecuteWithArgs);
            commandSelectBlog.Invalidate();
            CommandManager.Add(commandSelectBlog);

            CommandManager.EndUpdate();

            // create the dynamic menu items that correspond to the available weblogs
            _switchWeblogCommandMenu = new DynamicCommandMenu(this);
        }
        private void _editingManager_BlogSettingsChanged(string blogId, bool templateChanged)
        {
            using (Blog blog = new Blog(blogId))
            {
                // Find the item that is changing.
                var blogItem = commandSelectBlog.Items.Find(item => item.Cookie.Equals(blogId, StringComparison.Ordinal));

                if (blogItem != null &&
                    !blogItem.Label.Equals(SelectBlogGalleryCommand.GetShortenedBlogName(blog.Name), StringComparison.Ordinal))
                {
                    // The blog name has changed so we need to do a full reload to refresh the UI.
                    commandSelectBlog.ReloadAndInvalidate();
                }
                else
                {
                    // WinLive 43696: The blog settings have changed, but the UI doesn't need to be refreshed. In
                    // order to avoid "Windows 8 Bugs" 43242, we don't want to do a full reload.
                    commandSelectBlog.Invalidate();
                }
            }

            UpdateWeblogPicker();
        }