本文整理汇总了C#中CMSNode.IsMedia方法的典型用法代码示例。如果您正苦于以下问题:C# CMSNode.IsMedia方法的具体用法?C# CMSNode.IsMedia怎么用?C# CMSNode.IsMedia使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMSNode
的用法示例。
在下文中一共展示了CMSNode.IsMedia方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Run
public override void Run(IWorkflowInstance workflowInstance, IWorkflowRuntime runtime)
{
base.Run(workflowInstance, runtime);
var body = Helper.Instance.RenderTemplate(RenderTemplate);
IList<string> files = new List<string>();
foreach(var nodeId in ((UmbracoWorkflowInstance) workflowInstance).CmsNodes)
{
var node = new CMSNode(nodeId);
if(node.IsMedia())
{
files.Add(IOHelper.MapPath((string) new Media(nodeId).getProperty("umbracoFile").Value));
}
}
var f = new User(From).Email;
foreach(var r in GetRecipients())
{
var mail = new MailMessage(f, r) {Subject = Subject, IsBodyHtml = true, Body = body};
foreach(var file in files)
{
var attach = new Attachment(file);
mail.Attachments.Add(attach);
}
var smtpClient = new SmtpClient();
smtpClient.Send(mail);
}
runtime.Transition(workflowInstance, this, "done");
}
示例2: Run
public void Run(IWorkflowInstance workflowInstance, IWorkflowRuntime runtime)
{
// Cast to Umbraco worklow instance.
var umbracoWorkflowInstance = (UmbracoWorkflowInstance) workflowInstance;
var count = 0;
var newCmsNodes = new List<int>();
foreach(var nodeId in umbracoWorkflowInstance.CmsNodes)
{
var n = new CMSNode(nodeId);
if(!n.IsMedia()) continue;
var d = new Media(nodeId);
if (!MediaTypes.Contains(d.ContentType.Id)) continue;
newCmsNodes.Add(nodeId);
count++;
}
umbracoWorkflowInstance.CmsNodes = newCmsNodes;
var transition = (count > 0) ? "contains_media" : "does_not_contain_media";
runtime.Transition(workflowInstance, this, transition);
}
示例3: GetAttachmentLinks
public virtual string GetAttachmentLinks(IEnumerable<int> attachedNodes)
{
var s = new StringBuilder();
s.Append("<br/><br/>");
var host = HttpContext.Current.Request.Url.Host;
if (HttpContext.Current.Request.Url.Port != 80) host += ":" + HttpContext.Current.Request.Url.Port;
foreach(var nodeId in attachedNodes)
{
var node = new CMSNode(nodeId);
if(node.IsDocument())
{
s.Append(string.Format("{2} ({1}): <a href='http://{0}/umbraco/dialogs/preview.aspx?id={1}'>[" + GlobalisationService.Instance.GetString("preview") + "]</a> ", host, nodeId, node.Text) + Environment.NewLine);
s.Append(string.Format("<a href='http://{0}/umbraco/actions/editContent.aspx?id={1}'>[" + GlobalisationService.Instance.GetString("edit") + "]</a><br/>", host, nodeId) + Environment.NewLine);
} else if(node.IsMedia())
{
s.Append(string.Format("{2} ({1}): <a href='http://{0}/umbraco/dialogs/preview.aspx?id={1}'>{2}</a> ", host, nodeId, node.Text) + Environment.NewLine);
} else
{
s.Append(node.Text + "<br/>" + Environment.NewLine);
}
}
return s.ToString();
}