Пример #1
0
        public void RefreshDataConfigTree( )
        {
            this.DataConfigTreeCtrl.Columns.Clear();

            TreeListColumn colNo = new TreeListColumn();

            colNo.Name         = "Name";
            colNo.FieldName    = "Name";
            colNo.Caption      = "Config Name";
            colNo.Visible      = true;
            colNo.VisibleIndex = 0;

            TreeListColumn colTableName = new TreeListColumn();

            colTableName.Name         = "TableName";
            colTableName.FieldName    = "TableName";
            colTableName.Caption      = "TableName";
            colTableName.Visible      = true;
            colTableName.VisibleIndex = 0;
            colTableName.ColumnEdit   = this.repoTableNameChooser;

            TreeListColumn[] lstCols = new TreeListColumn[ColumnList.Count + 2];
            lstCols[0] = colNo;
            lstCols[1] = colTableName;
            int iCount = 1;

            foreach (ABCTreeListColumn.ColumnConfig col in ColumnList)
            {
                TreeListColumn configCol = new TreeListColumn();
                configCol.Caption      = col.Caption;
                configCol.Tag          = col;
                configCol.Visible      = col.Visible;
                configCol.VisibleIndex = col.VisibleIndex;
                configCol.Width        = col.Width;
                configCol.ColumnEdit   = this.repoFieldNameChooser;
                iCount++;
                lstCols[iCount] = configCol;
            }

            this.DataConfigTreeCtrl.Columns.AddRange(lstCols);

            this.DataConfigTreeCtrl.DataSource = Manager.RootConfig;
            this.DataConfigTreeCtrl.RefreshDataSource();
            this.DataConfigTreeCtrl.ExpandAll();

            DisplayTreeListCtrl.RefreshDataSource();
            DataConfigTreeCtrl.BestFitColumns();
        }
Пример #2
0
        void repoFieldNameChooser_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            String strTableName = this.TableName;

            TreeConfigNode obj = (TreeConfigNode)DataConfigTreeCtrl.GetDataRecordByNode(DataConfigTreeCtrl.FocusedNode);

            if (obj == null || (TreeConfigData)obj.InnerData == null)
            {
                return;
            }

            TreeConfigData configData = (TreeConfigData)obj.InnerData;

            strTableName = configData.TableName;

            if (String.IsNullOrWhiteSpace(strTableName) == false)
            {
                String strOldFieldName = String.Empty;
                if (configData.ColumnFieldNames.ContainsKey(this.DataConfigTreeCtrl.FocusedColumn.Caption))
                {
                    strOldFieldName = configData.ColumnFieldNames[this.DataConfigTreeCtrl.FocusedColumn.Caption];
                }

                FieldChooserEx chooser = new FieldChooserEx(strTableName, strOldFieldName);
                if (chooser.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    if (configData.ColumnFieldNames.ContainsKey(this.DataConfigTreeCtrl.FocusedColumn.Caption))
                    {
                        configData.ColumnFieldNames[this.DataConfigTreeCtrl.FocusedColumn.Caption] = chooser.Result;
                    }
                    else
                    {
                        configData.ColumnFieldNames.Add(this.DataConfigTreeCtrl.FocusedColumn.Caption, chooser.Result);
                    }
                }


                DataConfigTreeCtrl.RefreshNode(DataConfigTreeCtrl.FocusedNode);
                DataConfigTreeCtrl.RefreshDataSource();
                UpdateDataConfigs();
                DisplayTreeListCtrl.RefreshDataSource();
            }
        }
Пример #3
0
 void DataConfigTreeCtrl_CellValueChanged(object sender, CellValueChangedEventArgs e)
 {
     UpdateDataConfigs();
     DisplayTreeListCtrl.RefreshDataSource();
 }