示例#1
0
 public static T Cast <T>(UIInfo info) where T : UIInfo
 {
     return(info.Cast <T>());
 }
示例#2
0
        public string GetValue(bool strict)
        {
            string value = null;

            switch (Type)
            {
            case UIControlType.TextLabel:
                // Text
                if (strict)
                {
                    value = StringEscaper.Unescape(Text);
                }
                break;

            case UIControlType.TextBox:
            {         // Value
                UIInfo_TextBox info = Info.Cast <UIInfo_TextBox>();
                value = StringEscaper.Unescape(info.Value);
            }
            break;

            case UIControlType.NumberBox:
            {         // Value
                UIInfo_NumberBox info = Info.Cast <UIInfo_NumberBox>();
                value = info.Value.ToString();
            }
            break;

            case UIControlType.CheckBox:
            {         // Value
                UIInfo_CheckBox info = Info.Cast <UIInfo_CheckBox>();
                value = info.Value ? "True" : "False";
            }
            break;

            case UIControlType.ComboBox:
                // Text
                value = StringEscaper.Unescape(Text);
                break;

            case UIControlType.RadioButton:
            {         // Selected
                UIInfo_RadioButton info = Info.Cast <UIInfo_RadioButton>();
                value = info.Selected ? "True" : "False";
            }
            break;

            case UIControlType.FileBox:
                // Text
                value = StringEscaper.Unescape(Text);
                break;

            case UIControlType.RadioGroup:
            {         // Selected
                UIInfo_RadioGroup info = Info.Cast <UIInfo_RadioGroup>();
                value = info.Selected.ToString();
            }
            break;
            }

            return(value);
        }