当前位置: 首页>>代码示例>>C#>>正文


C# ProjectItem类代码示例

本文整理汇总了C#中ProjectItem的典型用法代码示例。如果您正苦于以下问题:C# ProjectItem类的具体用法?C# ProjectItem怎么用?C# ProjectItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ProjectItem类属于命名空间,在下文中一共展示了ProjectItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateNewProcessOverview

        public static void CreateNewProcessOverview(string ProcessName, ProjectItem processFile, ProjectItem diagramFile)
        {
            var store = new Store(typeof(CloudCoreArchitectProcessOverviewDomainModel));
            var partition = new Partition(store);
            var result = new SerializationResult();

            using (Transaction t = store.TransactionManager.BeginTransaction("create new process overview model"))
            {
                try
                {
                    var processOverviewSerializationHelper = CloudCoreArchitectProcessOverviewSerializationHelper.Instance;
                    Architect.ProcessOverview.Process process = processOverviewSerializationHelper.CreateModelHelper(partition);

                    SetProcessOverviewProperties(ProcessName, process);

                    var diagram = processOverviewSerializationHelper.CreateDiagramHelper(partition, process);

                    processOverviewSerializationHelper.SaveModelAndDiagram(result, process, processFile.FileNames[0], diagram, diagramFile.FileNames[0]);

                    AddAssemblyReference(ProcessName, process);

                    t.Commit();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }

        }
开发者ID:Exclr8,项目名称:CloudCore,代码行数:30,代码来源:FileHelper.cs

示例2: RemoveSubItemsAndAssociatedFiles

        public static void RemoveSubItemsAndAssociatedFiles(ProjectItem parentItem)
        {
            if (parentItem == null) return;

            var projectItems = parentItem.ProjectItems.Cast<ProjectItem>();
            RemoveSubItemsAndAssociatedFiles(projectItems);
        }
开发者ID:Robin--,项目名称:raml-dotnet-tools,代码行数:7,代码来源:InstallerServices.cs

示例3: VisitClass

 protected override void VisitClass(CodeClass codeClass)
 {
     if (codeClass.FullName == _classFullName)
     {
         _result = codeClass.ProjectItem;
     }
 }
开发者ID:569550384,项目名称:Rafy,代码行数:7,代码来源:TypeFileFinder.cs

示例4: ContainsDeployableItem

 private bool ContainsDeployableItem(ProjectItem pitem)
 {
     if (pitem != null && pitem.ProjectItems != null)
     {
         foreach (ProjectItem childItem in pitem.ProjectItems)
         {
             if (childItem.Kind == EnvDTE.Constants.vsProjectItemKindPhysicalFile)
             {
                 //ok, is file
                 if (ItemIsDeployable(childItem))
                 {
                     return true;
                 }
             }
             else
             {
                 if (ContainsDeployableItem(childItem))
                 {
                     return true;
                 }
             }
         }
     }
     return false;
 }
开发者ID:manuel11g,项目名称:SharePoint-Software-Factory,代码行数:25,代码来源:SolutionHiveReference.cs

示例5: CreateFileCodeModel

 public static FileCodeModel CreateFileCodeModel(DTE dte, ProjectItem item, CodeDomProvider provider, string fileName)
 {
     if (null == item) {
         throw new ArgumentNullException("item");
     }
     return new CodeDomFileCodeModel(dte, item, provider, fileName);
 }
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:7,代码来源:PythonCodeModelFactory.cs

示例6: ProjectItemRelationship

		public ProjectItemRelationship (ProjectItem parentProjectItem, MD.ProjectItem msbuildProjectItem)
		{
			this.ParentProjectItem = parentProjectItem;
			this.MSBuildProjectItem = msbuildProjectItem;
			this.Project = (Project)parentProjectItem.ContainingProject;
			GetRelationship ();
		}
开发者ID:modulexcite,项目名称:monodevelop-nuget-extensions,代码行数:7,代码来源:ProjectItemRelationship.cs

示例7: RunFeatures

        public bool RunFeatures(ProjectItem projectItem, bool debug)
        {
            if (IsAllowDebugGeneratedFilesSet(projectItem))
                return runnerGateway_CodeBehind.RunFeatures(projectItem, debug);

            return runnerGateway_TestWindowInvoke.RunFeatures(projectItem, debug);
        }
开发者ID:BEllis,项目名称:SpecFlow,代码行数:7,代码来源:VS2012RunnerGateway.cs

示例8: Edit

        public ActionResult Edit(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            var user = db.UserModels
                         .Include("UserProjectRoles")
                         .Include("UserProjectRoles.Role")
                         .Where(m => m.Id == id).ToList().First();

            var userProjectsList = user.UserProjectRoles.ToList();
            var projectList = db.Projects.ToList();

            var viewmodel = new UserViewModel();
            viewmodel.Id = user.Id;
            viewmodel.Email = user.Email;
            viewmodel.FirstName = user.FirstName;
            viewmodel.LastName = user.LastName;
            viewmodel.IsAdmin = user.Admin;

            foreach (var item in projectList)
            {
                var toAdd = new ProjectItem();
                toAdd.ProjectId = item.Id;
                toAdd.ProjectName = item.Name;
                toAdd.IsManager = userProjectsList.Where(m => m.ProjectId == item.Id && m.Role.Role1 == "Manager").ToList().Count > 0;
                toAdd.IsDeveloper = userProjectsList.Where(m => m.ProjectId == item.Id && m.Role.Role1 == "Developer").ToList().Count > 0;
                toAdd.IsSubmitter = userProjectsList.Where(m => m.ProjectId == item.Id && m.Role.Role1 == "Submitter").ToList().Count > 0;
                viewmodel.ProjectItems.Add(toAdd);
            }

            return View(viewmodel);
        }
开发者ID:KageJittai,项目名称:CF-BugTrackerDemo,代码行数:34,代码来源:UserController.cs

示例9: CodeDomFileCodeModel

        private CodeDomCodeNamespace vsTopNamespace; // top-level CodeModel namespace

        #endregion Fields

        #region Constructors

        public CodeDomFileCodeModel(DTE dte, ProjectItem parent, CodeDomProvider provider, string filename)
            : base(dte, filename)
        {
            this.parent = parent;
            this.provider = provider as IMergableProvider;
            if (provider == null) throw new ArgumentException("provider must implement IMergeableProvider interface");
        }
开发者ID:smartmobili,项目名称:parsing,代码行数:13,代码来源:FileCodeModel.cs

示例10: ProcessFile

        internal static IEnumerable<IntellisenseObject> ProcessFile(ProjectItem item, HashSet<CodeClass> underProcess = null)
        {
            if (item.FileCodeModel == null)
                return null;

            List<IntellisenseObject> list = new List<IntellisenseObject>();

            if (underProcess == null)
                underProcess = new HashSet<CodeClass>();

            foreach (CodeElement element in item.FileCodeModel.CodeElements)
            {
                if (element.Kind == vsCMElement.vsCMElementNamespace)
                {
                    CodeNamespace cn = (CodeNamespace)element;

                    foreach (CodeElement member in cn.Members)
                    {
                        if (ShouldProcess(member))
                            ProcessElement(member, list, underProcess);
                    }
                }
                else if (ShouldProcess(element))
                    ProcessElement(element, list, underProcess);
            }

            return new HashSet<IntellisenseObject>(list);
        }
开发者ID:hanskishore,项目名称:WebEssentials2013,代码行数:28,代码来源:IntellisenseParser.cs

示例11: VSProjectItemManager

        internal VSProjectItemManager(DTE2 dte, ProjectItem projectItem, string fileNamePrefix)
        {
            this.dte = dte;
            this.projectItem = projectItem;

            this.filesAdded = new Dictionary<string, object>();
            this.filesCreated = new List<string>();

            if (this.projectItem != null)
            {
                if (string.IsNullOrEmpty(fileNamePrefix))
                {
                    fileNamePrefix = this.GetFileNamePrefix(projectItem.Name);
                }

                if (projectItem.FileCount > 0)
                {
                    try
                    {
                        this.fullFileNamePrefix = Path.GetDirectoryName(projectItem.get_FileNames(0)) + @"\" + fileNamePrefix;
                    }
                    catch (System.ArgumentException)
                    {
                        //vs.Php raise exception
                    }

                }
            }
        }
开发者ID:Malediction,项目名称:Spartan,代码行数:29,代码来源:VSProjectItemManager.cs

示例12: InternalExecute

		public static void InternalExecute(ProjectItem projectItem)
		{
			var ctors = new List<CodeFunction>();

			foreach (CodeFunction constructor in projectItem.FindContructors().Where(m => m.Parameters.Count > 0))
			{
				var codeElement = constructor.As<CodeElement>();
				string ctorText = codeElement.InnerText();
				var editPoint = codeElement.AtTheFirstLineAfterTheOpeningBrakect();

				bool lineAdded = false;
				foreach (var param in constructor.Parameters().Reverse())
				{
					if (param.Type.CodeType.Kind != vsCMElement.vsCMElementStruct && !ctorText.Contains($"ArgumentNullException(\"{param.Name}\")"))
					{
						lineAdded = true;
						projectItem.AddLine(editPoint, param.Name.ToCtorNullCheck());
					}
				}

				if (lineAdded)
				{
					ctors.Add(constructor);
				}
			}

			if (ctors.Any())
			{
				if (!projectItem.Contains("using System;"))
				{
					projectItem.AddLine(projectItem.FindNameSpace().As<CodeElement>().AtTheFirstLineAfterTheOpeningBrakect(), "using System;");
				}
			}

			foreach (CodeFunction constructor in projectItem.FindContructors().Where(m => m.Parameters.Count > 0))
			{
				if (string.IsNullOrWhiteSpace(constructor.DocComment))
				{
					AddCommentsToCodeElements.AddDocCommentToCtor(constructor);
				}

				var docComment = constructor.DocComment;
				var codeElement = constructor.As<CodeElement>();
				if ((codeElement.Contains("throw new ArgumentNullException") || codeElement.Contains("throw new System.ArgumentNullException"))
					&& (!docComment.Contains(exceptionMessage1) && !docComment.Contains(exceptionMessage2)))
				{
					codeElement.AppendToDocComment(exceptionMessage1);
				}
			}

			if (ctors.Any())
			{
				var dte = (DTE)Package.GetGlobalService(typeof(SDTE));
				try
				{
					dte.ExecuteCommand("Edit.FormatDocument");
				}
				catch { }
			}
		}
开发者ID:mmahulea,项目名称:FactonExtensionPackage,代码行数:60,代码来源:AddArgumentNullChecksToContructors.cs

示例13: AddCustomToolItemBeforeQueryStatus

        private void AddCustomToolItemBeforeQueryStatus(object sender, EventArgs e)
        {
            OleMenuCommand button = (OleMenuCommand) sender;
            button.Visible = false;

            UIHierarchyItem uiItem = GetSelectedItem();

            if (uiItem == null)
                return;

            _item = uiItem.Object as ProjectItem;
            if (_item == null)
                return;

            if (_item.ContainingProject.Kind != PrjKind.prjKindCSharpProject && _item.ContainingProject.Kind != PrjKind.prjKindVBProject)
                return;

            string fullPath = _item.Properties.Item("FullPath").Value.ToString();
            string ext = Path.GetExtension(fullPath);

            if (!ext.Equals(".vsct", StringComparison.OrdinalIgnoreCase))
                return;

            button.Checked = _item.Properties.Item("CustomTool").Value.ToString() == CUSTOM_TOOL_NAME;
            button.Visible = true;
        }
开发者ID:modulexcite,项目名称:ExtensibilityTools,代码行数:26,代码来源:AddCustomToolCommand.cs

示例14: GetSelfAndChildProjectItems

        public static IEnumerable<ProjectItem> GetSelfAndChildProjectItems(ProjectItem projectItem)
        {
            yield return projectItem;
            for (int i = 1; i <= projectItem.ProjectItems.Count; i++)
            {
                ProjectItem item = null;
                try
                {
                    item = projectItem.ProjectItems.Item(i);
                }
                catch (Exception ex)
                {
                    // sometimes we get System.ArgumentException: The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG)) 
                    // when we open some file in the text editor
                    LogService.LogError(new Exception("Cannot evaluate items in the project!", ex));
                }

                if (item != null)
                {
                    foreach (var childItem in GetSelfAndChildProjectItems(item))
                    {
                        yield return childItem;
                    }
                }
            }
        }
开发者ID:ElboNet,项目名称:dotvvm,代码行数:26,代码来源:DTEHelper.cs

示例15: ProcessConfigFile

        /// <summary>
        /// Loads XML from the .config file, manipulates it to possibly add an "defaultConnectionFactory" entry
        /// and then attempts to save the file.
        /// </summary>
        /// <remarks>
        /// If the file cannot be saved then it is not saved and an exception is thrown. Under normal use this should not happen
        /// because NuGet will have ensured that the file is writable. It would be possible to try to do things like try check out
        /// the file from source control, but it doesn't seem like this is valuable enough to implement given it will not normally be used.
        /// </remarks>
        public virtual void ProcessConfigFile(ProjectItem configItem, IEnumerable<Func<XDocument, bool>> manipulators)
        {
            Contract.Requires(configItem != null);

            var fileName = configItem.FileNames[0];
            var config = XDocument.Load(fileName);

            var fileModified = false;
            foreach (var manipulator in manipulators)
            {
                fileModified = manipulator(config) || fileModified;
            }

            if (fileModified)
            {
                try
                {
                    config.Save(fileName);
                }
                catch (Exception ex)
                {
                    throw new IOException(Strings.SaveConnectionFactoryInConfigFailed(fileName), ex);
                }
            }
        }
开发者ID:jimmy00784,项目名称:entityframework,代码行数:34,代码来源:ConfigFileProcessor.cs


注:本文中的ProjectItem类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。