void Submit() { var submitMap = new Dictionary <string, string>(); foreach (var element in FieldGetterMap) { submitMap.Add(element.Key, element.Value.Get()); } OnSubmit.Invoke(submitMap); }
public override bool HandleKeyEvent(ConsoleController.KeyEvent info, bool inFocus, bool triggered) { bool b = (triggered || (inFocus && info.ValidEvent)) && info.Event.Key == ConsoleKey.Enter; base.HandleKeyEvent(info, inFocus, triggered); if (b) { evt?.Invoke(this); } return(b); }
private ListView GenerateList(string[] data, SubmissionEvent onclick, bool exitOnSubmit = false, bool hideOnBack = true) { //var list = GetView<ListView>("account_show"); var list = new ListView(new ViewData("ListView").SetAttribute("padding_left", 2).SetAttribute("padding_right", 2).SetAttribute("border", 8), LangManager.NO_LANG); //if (data.Length == 1 && data[0].Length == 0) data = new string[0]; Tuple <string, View>[] listData = new Tuple <string, View> [data.Length - ((data.Length == 1 && data[0].Length == 0) ? 1: 0)]; for (int i = 0; i < listData.Length; ++i) { ButtonView t = new ButtonView(new ViewData("ButtonView").AddNestedSimple("Text", data[i]), LangManager.NO_LANG); // Don't do translations t.SetEvent(v => { onclick?.Invoke(v); if (exitOnSubmit) { Hide(list); } }); listData[i] = new Tuple <string, View>(t.Text, t); } if (listData.Length > 0) { list.AddViews(0, listData); } else { ButtonView close = new ButtonView(new ViewData("ButtonView").AddNestedSimple("Text", GetIntlString("GENERIC_dismiss")), LangManager.NO_LANG); close.SetEvent(_ => Hide(list)); list.AddView(close, "close"); } if (hideOnBack) { list.OnBackEvent = v => Hide(v); } return(list); }
public void Submit() { onSubmit.Invoke(Input); }