Exemplo n.º 1
0
        /// <summary>
        /// This method loads a localized string based on the specified resource.
        /// </summary>
        /// <param name="resourceName">Resource to load</param>
        /// <returns>String loaded for the specified resource</returns>
        internal string GetResourceString(string resourceName)
        {
            string             resourceValue;
            IVsResourceManager resourceManager = (IVsResourceManager)GetService(typeof(SVsResourceManager));

            if (resourceManager == null)
            {
                throw new InvalidOperationException("Could not get SVsResourceManager service. Make sure the package is Sited before calling this method");
            }
            Guid packageGuid = myPackage.GetType().GUID;
            int  hr          = resourceManager.LoadResourceString(ref packageGuid, -1, resourceName, out resourceValue);

            Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(hr);
            return(resourceValue);
        }