コード例 #1
0
ファイル: SchemaUIController.cs プロジェクト: shruggr/Bitflow
    void Submit()
    {
        var submitMap = new Dictionary <string, string>();

        foreach (var element in FieldGetterMap)
        {
            submitMap.Add(element.Key, element.Value.Get());
        }

        OnSubmit.Invoke(submitMap);
    }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
 public void Submit()
 {
     onSubmit.Invoke(Input);
 }