protected void update_onclick(p5.Void btn, EventArgs e) { var liter = (p5.Literal)List.FindControl(CurrentEdit); liter.innerValue = Txt["value"]; CurrentEdit = null; }
protected void insert_at_random_onclick(p5.Void btn, EventArgs e) { CurrentEdit = null; var widget = List.CreatePersistentControl <p5.Literal> ("x" + (_next++), new Random().Next(0, List.Controls.Count)); widget.Element = "li"; widget["onclick"] = "item_onclick"; widget.innerValue = Txt["value"]; }
protected void insert_top_onclick(p5.Void btn, EventArgs e) { CurrentEdit = null; var widget = List.CreatePersistentControl <p5.Literal> ("x" + (_next++), 0); widget.Element = "li"; widget["onclick"] = "item_onclick"; widget.innerValue = Txt["value"]; }
protected void append_onclick(p5.Void btn, EventArgs e) { CurrentEdit = null; var widget = List.CreatePersistentControl <p5.Literal> ("x" + (_next++), List.Controls.Count); widget.Element = "li"; widget.RenderType = p5.Widget.RenderingType.open; widget["onclick"] = "item_onclick"; widget.innerValue = Txt["value"]; }
protected void harvest_love_onclick(p5.Void btn, EventArgs e) { CurrentEdit = null; var toRemove = List.ControlsOfType <p5.Literal> ().Where(idx => idx.innerValue.Contains("turtles")).Cast <Control> ().ToList(); foreach (var idx in toRemove) { List.RemoveControlPersistent(idx); } }
protected void love_bomb_onclick(p5.Void btn, EventArgs e) { CurrentEdit = null; var rnd = new Random(); foreach (var idx in List.ControlsOfType <p5.Literal> ()) { if (rnd.Next(0, 3) == 1) { idx.innerValue = "I like turtles!"; idx["class"] = "turtles"; } } }
protected void replace_random_onclick(p5.Void btn, EventArgs e) { CurrentEdit = null; if (List.Controls.Count == 0) { Txt["value"] = "Nothing to replace!!"; } else { var which = new Random().Next(0, List.Controls.Count); List.RemoveControlPersistentAt(which); var widget = List.CreatePersistentControl <p5.Literal> ("x" + (_next++), which); widget.Element = "li"; widget["onclick"] = "item_onclick"; widget.innerValue = Txt["value"]; } }