public void AddOption(string text, string action) { ContextMenuItem item = new ContextMenuItem(); item.Action = action; item.Text = text; this.BackingDoodad.AddFile(text, item); }
public static ContextMenuItem FromNode(Node itemNode) { ContextMenuItem ret = new ContextMenuItem(); ret.DataID = itemNode.ID.ToString(); ret.Text = itemNode.Text; ret.Action = itemNode.Value; return ret; }
public static ContextMenuItem FromNode(Node itemNode) { ContextMenuItem ret = new ContextMenuItem(); ret.DataID = itemNode.ID.ToString(); ret.Text = itemNode.Text; ret.Action = itemNode.Value; return(ret); }
private static HtmlGenericControl CreateContextMenuItem(ContextMenuItem item) { HtmlGenericControl li = ControlHelper.CreateControl("li", ""); HtmlGenericControl a = ControlHelper.CreateControl("a", item.Text); a.Attributes.Add("href", "#" + item.Action); li.Controls.Add(a); return(li); }
private static ContextMenuItem[] ToContextMenuItems(string value) { return(value.Split <ContextMenuItem>(";", (item) => { ContextMenuItem ctxItem = item.ToObject <ContextMenuItem>((c) => { string[] values = c.Split(':'); Expect.IsTrue(values.Length == 2, "Invalid ContextMenuItem string specified."); return new ContextMenuItem(values[1], values[0]); }); return ctxItem; })); }
public override void WireScriptsAndValidate() { this.controlToRender.TagName = "div"; this.controlToRender.Attributes.Add("class", "contextMenu"); this.controlToRender.Style.Add("display", "none"); this.controlToRender.Attributes.Add("jsonid", this.jsonId); this.controlToRender.Attributes.Add("id", this.DomId); this.controlToRender.Controls.Add(new LiteralControl("This control is not complete. It still needs client side wiring and the jQuery contextMenu plugin isn't quite approprate here.")); WriteDefaultTemplateToDisk(typeof(ContextMenuItem)); foreach (Node file in this.BackingDoodad.Files) { ContextMenuItem item = ContextMenuItem.FromNode(file); this.controlToRender.Controls.Add(new LiteralControl(BoxServer.GetTemplatedString(item, this.TemplateName))); } }
private static HtmlGenericControl CreateContextMenuItem(ContextMenuItem item) { HtmlGenericControl li = ControlHelper.CreateControl("li", ""); HtmlGenericControl a = ControlHelper.CreateControl("a", item.Text); a.Attributes.Add("href", "#" + item.Action); li.Controls.Add(a); return li; }