Example #1
0
        private bool ValidConfig()
        {
            ViewTableDesign asDesign = new ViewTableDesign();

            try
            {
                if (txtColTitle.Text == "")
                {
                    MsgBox.ShowInf("请输入列标题后,重新添加。");
                    txtColTitle.Focus();
                    return(false);
                }

                //判断是否有同名的控件
                foreach (ListViewItem lvi in lstColList.Items)
                {
                    asDesign.ViewTableCfg.Add(lvi.Tag as ViewTableItemConfig);
                    if (asDesign.ViewTableCfg[asDesign.ViewTableCfg.Count - 1].列名称 == cbxColName.Text)
                    {
                        MsgBox.ShowInf("控件“" + cbxColName.Text + "”已存在,请不要重复添加。");
                        return(false);
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                MsgBox.ShowException(ex, this);
                return(false);
            }
        }
Example #2
0
        public bool ShowDesign(ViewTableDesign viewTableDesign, IWin32Window owner)
        {
            _viewTableDesign = viewTableDesign;

            this.ShowDialog(owner);

            return(_isOk);
        }
Example #3
0
        protected override void ReloadCustomDesign(string customContext)
        {
            if (string.IsNullOrEmpty(customContext))
            {
                return;
            }

            _viewTableDesign = JsonHelper.DeserializeObject <ViewTableDesign>(customContext);

            if (_viewTableDesign.ViewTableCfg != null)
            {
                InitUserApplySearch(_viewTableDesign);
            }

            SyncDesignEventsByButtons();
        }
Example #4
0
        protected void InitUserApplySearch(ViewTableDesign viewTableDesign)
        {
            DataTable dt = new DataTable();

            try
            {
                //根据条件,创建一个空的datatable
                for (int i = 0; i < _viewTableDesign.ViewTableCfg.Count; i++)
                {
                    dt.Columns.Add(_viewTableDesign.ViewTableCfg[i].列标题);
                }
                RefreshTable(dt);
            }
            catch (Exception ex)
            {
                MsgBox.ShowException(ex, this);
            }
        }
Example #5
0
 public ViewTableControl()
 {
     InitializeComponent();
     _viewTableDesign = new ViewTableDesign();
 }