예제 #1
0
        /// <summary>
        /// Loads all controls in the page.
        /// </summary>
        void InitControls()
        {
            try
            {
                stStatus.Text = "加载控件... ";

                List <IComponent> controls = this.GetControls();
                foreach (IComponent control in controls)
                {
                    if (MemberHelper.CheckCommonControl(control, this.rbAll.Checked))
                    {
                        cbControl.Items.Add(new ControlEntry(control, _reference.GetName(control)));
                    }
                }

                if (cbControl.Items.Count > 0)
                {
                    cbControl.SelectedIndex = 0;
                }

                if (this.DataUIMapper.Type == null)
                {
                    this.tbModelProperty.Visible = true;
                    this.cbModelProperty.Visible = false;
                }
                else
                {
                    this.tbModelProperty.Visible = false;
                    this.cbModelProperty.Visible = true;

                    this.cbModelProperty.DropDownStyle = ComboBoxStyle.DropDownList;
                    List <string> propertys = MemberHelper.GetDataPropertys(this.DataUIMapper.Type);
                    foreach (string text in propertys)
                    {
                        cbModelProperty.Items.Add(text);
                    }

                    if (cbModelProperty.Items.Count > 0)
                    {
                        cbModelProperty.SelectedIndex = 0;
                    }
                }

                stStatus.Text = " 就绪";
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(
                    "初始化出错: " + ex.ToString());
            }
        }