Esempio n. 1
0
        // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

        /// <summary>
        /// Populates the Favorites menu
        /// </summary>
        /// <param name="control"></param>
        /// <returns></returns>
        public string GetFavoritesContent(IRibbonControl control)
        {
            //logger.WriteLine($"GetFavoritesContent({control.Id}) culture:{AddIn.Culture.Name}");

            // TODO: this doesn't seem to work!
            System.Threading.Thread.CurrentThread.CurrentCulture   = AddIn.Culture;
            System.Threading.Thread.CurrentThread.CurrentUICulture = AddIn.Culture;

            var favorites = new FavoritesProvider(ribbon).LoadFavoritesMenu();

            var sep = favorites.Elements()
                      .FirstOrDefault(e => e.Attribute("id").Value == "omFavoritesSeparator");

            if (sep != null)
            {
                var snippets = new SnippetsProvider().MakeSnippetsMenu(ns);
                sep.AddAfterSelf(snippets);

                var plugins = new PluginsProvider().MakePluginsMenu(ns);
                if (plugins != null)
                {
                    snippets.AddAfterSelf(plugins);
                }
            }

            return(favorites.ToString(SaveOptions.DisableFormatting));
        }
Esempio n. 2
0
        // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

        /// <summary>
        /// Populates the Favorites menu
        /// </summary>
        /// <param name="control"></param>
        /// <returns></returns>
        public string GetFavoritesContent(IRibbonControl control)
        {
            //logger.WriteLine($"GetFavoritesContent({control.Id})");
            var favorites = new FavoritesProvider(ribbon).LoadFavoritesMenu();

            var sep = favorites.Elements()
                      .FirstOrDefault(e => e.Attribute("id").Value == "omFavoritesSeparator");

            if (sep != null)
            {
                var snippets = new SnippetsProvider().MakeSnippetsMenu(ns);
                sep.AddAfterSelf(snippets);

                var plugins = new PluginsProvider().MakePluginsMenu(ns);
                if (plugins != null)
                {
                    snippets.AddAfterSelf(plugins);
                }
            }

            return(favorites.ToString(SaveOptions.DisableFormatting));
        }