public override void Execute() { DTE dte = (DTE)GetService(typeof(DTE)); string resourcesFileName = Resources.get_FileNames(1); SourceControlHelper.EnsureWritable(dte, resourcesFileName); ResourcesHelper.AddResource(resourcesFileName, string.Format("{0}{1}", NodeInfo.NodeName, Microsoft.Practices.EnterpriseLibrary.BlockFactory.Properties.Resources.UICommandText), string.Format(Microsoft.Practices.EnterpriseLibrary.BlockFactory.Properties.Resources.RecourceValueNeeded, string.Format("{0}{1}", NodeInfo.NodeName, Microsoft.Practices.EnterpriseLibrary.BlockFactory.Properties.Resources.UICommandText))); ResourcesHelper.AddResource(resourcesFileName, string.Format("{0}{1}", NodeInfo.NodeName, Microsoft.Practices.EnterpriseLibrary.BlockFactory.Properties.Resources.UICommandLongText), string.Format(Microsoft.Practices.EnterpriseLibrary.BlockFactory.Properties.Resources.RecourceValueNeeded, string.Format("{0}{1}", NodeInfo.NodeName, Microsoft.Practices.EnterpriseLibrary.BlockFactory.Properties.Resources.UICommandLongText))); foreach (DesignTimePropertyInfo designTimePropertyInfo in NodeInfo.DesignTimeProperties) { if (!designTimePropertyInfo.Action.Equals(IncludePropertyAction.Ignore)) { string propertyDescriptionResourceEntry = string.Format("{0}{1}", designTimePropertyInfo.PropertyInfo.Name, DescriptionSuffix); ResourcesHelper.AddResource(resourcesFileName, propertyDescriptionResourceEntry, string.Format(Microsoft.Practices.EnterpriseLibrary.BlockFactory.Properties.Resources.RecourceValueNeeded, propertyDescriptionResourceEntry)); } } VSProjectItem vsResources = Resources.Object as VSProjectItem; if (vsResources != null) { vsResources.RunCustomTool(); } }
public override void Execute() { DTE vs = GetService <DTE>(); string resourcesFileName = Resources.get_FileNames(1); SourceControlHelper.EnsureWritable(vs, resourcesFileName); IDictionaryService dictionaryService = GetService <IDictionaryService>(); ResourcesHelper.AddResource(resourcesFileName, ArgumentsHelper.ReplaceToken(ResourceName, dictionaryService), ArgumentsHelper.ReplaceToken(ResourceValue, dictionaryService)); VSProjectItem vsResources = Resources.Object as VSProjectItem; if (vsResources != null && RunCustomTool) { vsResources.RunCustomTool(); } }