本文整理汇总了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);
}
}
示例2: FromProject
public static GtkDesignInfo FromProject (Project project)
{
var ext = project.GetService<GtkProjectServiceExtension> ();
if (ext != null)
return ext.DesignInfo;
return new GtkDesignInfo ();
}
示例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);
}