本文整理汇总了C#中IPluginManager.CreateViewSnippetForm方法的典型用法代码示例。如果您正苦于以下问题:C# IPluginManager.CreateViewSnippetForm方法的具体用法?C# IPluginManager.CreateViewSnippetForm怎么用?C# IPluginManager.CreateViewSnippetForm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPluginManager
的用法示例。
在下文中一共展示了IPluginManager.CreateViewSnippetForm方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PrepareViewSnippetForm
/// <summary>
/// Creates a new ViewSnippet Form and precompiles this form with the content of the given snippet
/// </summary>
/// <param name="pluginManager"></param>
/// <param name="snippetId">ID of the snppet to display</param>
public static IManageSnippetForm PrepareViewSnippetForm(IPluginManager pluginManager, long snippetId)
{
if (pluginManager == null)
return null;
if (snippetId <= 0)
return null;
// read snippets and populate the List
SnippetsWS snippetRepo = new SnippetsWS();
log.DebugFormat("Reading snippet {0}", snippetId);
Snippet snip = snippetRepo.GetSnippetByID(snippetId);
if (snip == null)
{
log.WarnFormat("Snippet {0} is null", snippetId);
return null;
}
//CG: Add +1 to the view stats
System.Threading.Tasks.Task.Factory.StartNew(() => snippetRepo.StoreHit(snip));
// Open "Add Snippet" Window
log.DebugFormat("Loading snippet {0}", snippetId);
pluginManager.ClosePublishSnippetWindow();
IManageSnippetForm viewSnipForm = pluginManager.CreateViewSnippetForm();
viewSnipForm.PrepareViewSnippet(snip);
return viewSnipForm;
}