private async Task Main() { ImFormsMgr mgr = new ImFormsMgr(ImWpfPanelLeft.Children); IList <int> list = new List <int> { 1, 2, 3 }; int x = 0; bool displayList = false; bool reverseList = false; while (true) { mgr.Text("This ImForms panel refreshes only when there is user interaction"); mgr.Space(CompileTime.ID()); mgr.Text("ImForms makes it easy to display and modify one value with multiple controls"); mgr.Text("x ="); mgr.RadioButton("0", ref x, 0); mgr.RadioButton("1", ref x, 1); int valueToAssignX = (x == 1) ? 0 : 1; if (mgr.Button("x <- " + valueToAssignX, CompileTime.ID())) { x = valueToAssignX; } bool xIs1 = (x == 1); mgr.Checkbox("X == 1", ref xIs1); x = xIs1 ? 1 : 0; mgr.Space(CompileTime.ID()); mgr.Text("Just like with other ImGui implementations, if a function isn't called for it," + " a control isn't displayed."); mgr.Checkbox("Show list", ref displayList); if (displayList) { var seq = reverseList ? list.Reverse() : list; if (mgr.Button("Add to end")) { list.Add(list.LastOrDefault() + 1); } if (list.Any() && mgr.Button("Remove from front")) { list.RemoveAt(0); } mgr.Checkbox("Display reversed", ref reverseList); foreach (var n in seq) { mgr.Text("[" + n + "]"); } } mgr.Space(CompileTime.ID()); mgr.Text("Values from other threads can be displayed when a panel refreshes."); mgr.LinkText("Try it!"); mgr.Text("y = " + y, CompileTime.ID()); await mgr.NextFrame(); } }
public async Task Main(Panel panel) { ImFormsMgr mgr = new ImFormsMgr(panel); IList <int> list = new List <int> { 1, 2, 3 }; int x = 0; bool displayList = false; bool reverseList = false; float f = 0; string teststr = ""; while (true) { mgr.Label("This ImForms panel refreshes only when there is user interaction"); mgr.Space(CompileTime.ID()); mgr.Label("ImForms makes it easy to display and modify one value with multiple controls"); mgr.Label("x =" + x); mgr.Label("f =" + f, "f ="); mgr.TreeView(new string[] { "bdfihdf", "dshsdiusdh" }); string res = ""; if (mgr.ComboBox("text box", ref res, new string[] { "t", "f", "c" })) { mgr.Label(res); } mgr.InputMultilineText("Text box:", ref teststr); mgr.Label(teststr); mgr.RadioButton("0", ref x, 0); mgr.RadioButton("1", ref x, 1); mgr.SliderFloat("slider flt val:", ref f); mgr.ProgressFloat("progress:", ref f); int valueToAssignX = (x == 1) ? 0 : 1; if (mgr.Button("x <- " + valueToAssignX)) { x = valueToAssignX; } bool xIs1 = (x == 1); mgr.Checkbox("X == 1", ref xIs1); mgr.Space(CompileTime.ID()); mgr.Label("Just like with other ImGui implementations, if a function isn't called for it," + " a control isn't displayed."); mgr.Checkbox("Show list", ref displayList); if (displayList) { var seq = reverseList ? list.Reverse() : list; if (mgr.Button("Add to end")) { list.Add(list.LastOrDefault() + 1); } if (list.Any() && mgr.Button("Remove from front")) { list.RemoveAt(0); } mgr.Checkbox("Display reversed", ref reverseList); foreach (var n in seq) { mgr.Label("[" + n + "]"); } } mgr.Space(CompileTime.ID()); mgr.Label("Values from other threads can be displayed when a panel refreshes."); mgr.LinkLabel("Try it!"); mgr.Label("y = " + y, CompileTime.ID()); await mgr.NextFrame(); } }