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


C# Project.GetService方法代码示例

本文整理汇总了C#中MonoDevelop.Projects.Project.GetService方法的典型用法代码示例。如果您正苦于以下问题:C# Project.GetService方法的具体用法?C# Project.GetService怎么用?C# Project.GetService使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MonoDevelop.Projects.Project的用法示例。


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

示例1: ModifyTags

		public override void ModifyTags (SolutionFolderItem policyParent, Project project, string language, string identifier, string fileName, ref Dictionary<string,string> tags)
		{
			base.ModifyTags (policyParent, project, language, identifier, fileName, ref tags);
			if (fileName == null)
				return;
			
			tags ["AspNetMaster"] = "";
			tags ["AspNetMasterContent"] = "";
			
			var aspProj = project.GetService<AspNetAppProjectFlavor> ();
			if (aspProj == null)
				throw new InvalidOperationException ("MasterContentFileDescriptionTemplate is only valid for ASP.NET projects");
			
			ProjectFile masterPage = null;
			
			var dialog = new MonoDevelop.Ide.Projects.ProjectFileSelectorDialog (project, null, "*.master");
			try {
				dialog.Title = GettextCatalog.GetString ("Select a Master Page...");
				int response = MonoDevelop.Ide.MessageService.RunCustomDialog (dialog);
				if (response == (int)Gtk.ResponseType.Ok)
					masterPage = dialog.SelectedFile;
			} finally {
				dialog.Destroy ();
				dialog.Dispose ();
			}
			if (masterPage == null)
				return;
			
			tags ["AspNetMaster"] = aspProj.LocalToVirtualPath (masterPage);
			
			try {
				var pd = TypeSystemService.ParseFile (project, masterPage.FilePath).Result
						as WebFormsParsedDocument;
				if (pd == null)
					return;
				
				var sb = new System.Text.StringBuilder ();
				foreach (string id in pd.XDocument.GetAllPlaceholderIds ()) {
					sb.Append ("<asp:Content ContentPlaceHolderID=\"");
					sb.Append (id);
					sb.Append ("\" ID=\"");
					sb.Append (id);
					sb.Append ("Content\" runat=\"server\">\n</asp:Content>\n");
				}
				
				tags["AspNetMasterContent"] = sb.ToString ();
			}
			catch (Exception ex) {
				//no big loss if we just insert blank space
				//it's just a template for the user to start editing
				LoggingService.LogWarning ("Error generating AspNetMasterContent for template", ex);
			}
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:53,代码来源:MasterContentFileDescriptionTemplate.cs

示例2: FromProject

		public static GtkDesignInfo FromProject (Project project)
		{
			var ext = project.GetService<GtkProjectServiceExtension> ();
			if (ext != null)
				return ext.DesignInfo;
			return new GtkDesignInfo ();
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:7,代码来源:GtkDesignInfo.cs

示例3: DisableProject

		public static void DisableProject (Project project)
		{
			if (HasDesignedObjects (project))
				return;

			GtkDesignInfo info = FromProject (project);
			StringCollection saveFiles = new StringCollection ();
			saveFiles.AddRange (new string[] {info.ObjectsFile, info.SteticFile});
			info.CleanGtkFolder (saveFiles);
			project.Files.Remove (info.ObjectsFile);
			project.Files.Remove (info.SteticFile);

			var ext = project.GetService<GtkProjectServiceExtension> ();
			if (ext != null)
				ext.DesignInfo = null;
			info.Dispose ();

			ProjectNodeBuilder.OnSupportChanged (project);
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:19,代码来源:GtkDesignInfo.cs


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