Exemplo n.º 1
0
        private object GetValue(FormItem val)
        {
            switch (val.controlItem.GetType().Name)
            {
            case "TextBoxX":
                return(val.controlItem.Text);

            case "ComboBoxEx":
                return(((DevComponents.DotNetBar.Controls.ComboBoxEx)val.controlItem).SelectedValue);

            case "CheckBoxX":
                object ckval = ((DevComponents.DotNetBar.Controls.CheckBoxX)val.controlItem).CheckValue;
                if (ckval.ToString() == "Y")
                {
                    ckval = "1";
                }
                else if (ckval.ToString() == "N")
                {
                    ckval = "0";
                }
                return(ckval);

            case "IntegerInput":
                return(((DevComponents.Editors.IntegerInput)val.controlItem).Value);

            case "DoubleInput":
                return(((DevComponents.Editors.DoubleInput)val.controlItem).Value);

            case "DateTimeInput":
                return(((DevComponents.Editors.DateTimeAdv.DateTimeInput)val.controlItem).Value);


            case "TextBox":
                return(val.controlItem.Text);

            case "ComboBox":
                return(((ComboBox)val.controlItem).SelectedValue);

            case "CheckBox":
                return(((CheckBox)val.controlItem).Checked);

            case "DateTimePicker":
                return(((DateTimePicker)val.controlItem).Value);


            case "NumericUpDown":
                return(((NumericUpDown)val.controlItem).Value);

            case "RadioButton":
                return(((RadioButton)val.controlItem).Checked);

            case "TextBoxCard":
                return(((TextBoxCard)val.controlItem).MemberValue);

            default:
                return(val.controlItem.Text);
            }
        }
Exemplo n.º 2
0
        void _control_Enter(object sender, EventArgs e)
        {
            Control       ctl             = (Control)sender;
            FormItem      item            = itemlist.Find(x => x.controlItem.Equals(ctl));
            int           index           = CustomConfigManager.GetInputMethod(item.inputMethod);
            InputLanguage currentLanguage = InputLanguage.InstalledInputLanguages[index];

            InputLanguage.CurrentInputLanguage = currentLanguage;
        }
Exemplo n.º 3
0
        void _control_Enter(object sender, EventArgs e)
        {
            Control       ctl             = (Control)sender;
            FormItem      item            = itemlist.Find(x => x.controlItem.Equals(ctl));
            int           index           = 0;//?
            InputLanguage currentLanguage = InputLanguage.InstalledInputLanguages[index];

            InputLanguage.CurrentInputLanguage = currentLanguage;
        }
Exemplo n.º 4
0
        public void AddItem(Control _control, string _name, bool _required, string _invalidMessage, InvalidType _invalidType, string _invalidRules, EN_CH _inputMethod, object _defaultValue)
        {
            FormItem item = new FormItem();

            item.controlItem    = _control;
            item.controlName    = _name;
            item.required       = _required;
            item.invalidMessage = _invalidMessage;
            item.invalidType    = _invalidType;
            item.InvalidRules   = _invalidRules;
            item.inputMethod    = _inputMethod;
            item.defaultValue   = _defaultValue;

            _control.Enter += new EventHandler(_control_Enter);
            _control.KeyUp += new KeyEventHandler(_control_KeyUp);
            itemlist.Add(item);
        }
Exemplo n.º 5
0
        private void SetValue(FormItem val, object value)
        {
            switch (val.controlItem.GetType().Name)
            {
            case "TextBoxX":
                if (value == null)
                {
                    val.controlItem.Text = "";
                }
                else
                {
                    val.controlItem.Text = value.ToString();
                }
                break;

            case "ComboBoxEx":
                if (value == null)
                {
                    ((DevComponents.DotNetBar.Controls.ComboBoxEx)val.controlItem).Text = "";
                }
                else
                {
                    ((DevComponents.DotNetBar.Controls.ComboBoxEx)val.controlItem).SelectedValue = value;
                }
                break;

            case "CheckBoxX":
                if (value == null)
                {
                    ((DevComponents.DotNetBar.Controls.CheckBoxX)val.controlItem).Checked = false;
                }
                else
                {
                    ((DevComponents.DotNetBar.Controls.CheckBoxX)val.controlItem).CheckValue = value;
                    if (value.ToString() == "1")
                    {
                        value = true;
                    }
                    else if (value.ToString() == "0")
                    {
                        value = false;
                    }

                    ((DevComponents.DotNetBar.Controls.CheckBoxX)val.controlItem).Checked = Convert.ToBoolean(value);
                }
                break;

            case "IntegerInput":
                if (value == null)
                {
                    ((DevComponents.Editors.IntegerInput)val.controlItem).Value = 0;
                }
                else
                {
                    ((DevComponents.Editors.IntegerInput)val.controlItem).Value = Convert.ToInt32(value);
                }
                break;

            case "DoubleInput":
                if (value == null)
                {
                    ((DevComponents.Editors.DoubleInput)val.controlItem).Value = 0.00;
                }
                else
                {
                    ((DevComponents.Editors.DoubleInput)val.controlItem).Value = Convert.ToDouble(value);
                }
                break;

            case "DateTimeInput":
                if (value == null)
                {
                    ((DevComponents.Editors.DateTimeAdv.DateTimeInput)val.controlItem).Value = DateTime.Now;
                }
                else
                {
                    ((DevComponents.Editors.DateTimeAdv.DateTimeInput)val.controlItem).Value = Convert.ToDateTime(value);
                }
                break;

            case "TextBox":
                if (value == null)
                {
                    val.controlItem.Text = "";
                }
                else
                {
                    val.controlItem.Text = value.ToString();
                }
                break;

            case "ComboBox":
                if (value == null)
                {
                    ((ComboBox)val.controlItem).Text = "";
                }
                else
                {
                    ((ComboBox)val.controlItem).SelectedValue = value;
                }
                break;

            case "CheckBox":
                if (value == null)
                {
                    ((CheckBox)val.controlItem).Checked = false;
                }
                else
                {
                    if (value.ToString() == "1")
                    {
                        value = true;
                    }
                    else if (value.ToString() == "0")
                    {
                        value = false;
                    }
                    ((CheckBox)val.controlItem).Checked = Convert.ToBoolean(value);
                }
                break;

            case "DateTimePicker":
                if (value == null)
                {
                    ((DateTimePicker)val.controlItem).Value = DateTime.Now;
                }
                else
                {
                    ((DateTimePicker)val.controlItem).Value = Convert.ToDateTime(value);
                }
                break;

            case "NumericUpDown":
                if (value == null)
                {
                    ((NumericUpDown)val.controlItem).Value = 0;
                }
                else
                {
                    ((NumericUpDown)val.controlItem).Value = Convert.ToDecimal(value);
                }
                break;

            case "RadioButton":
                if (value == null)
                {
                    ((RadioButton)val.controlItem).Checked = false;
                }
                else
                {
                    //if (value.ToString() == "1") value = true;
                    //else if (value.ToString() == "0") value = false;
                    List <FormItem> _list = itemlist.FindAll(x => x.controlName == val.controlName);
                    if (_list.FindIndex(x => x.Equals(val)) == Convert.ToInt32(value))
                    {
                        ((RadioButton)val.controlItem).Checked = true;
                    }
                    else
                    {
                        ((RadioButton)val.controlItem).Checked = false;
                    }
                }
                break;

            case "TextBoxCard":
                if (value == null)
                {
                    ((TextBoxCard)val.controlItem).MemberValue = -1;
                }
                else
                {
                    ((TextBoxCard)val.controlItem).MemberValue = value;
                }
                break;

            default:
                if (value == null)
                {
                    val.controlItem.Text = "";
                }
                else
                {
                    val.controlItem.Text = value.ToString();
                }
                break;
            }
        }