示例#1
0
        private void DGV_ConfigItems_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            string path = GetPath(sender as DataGridView, e.RowIndex, e.ColumnIndex);

            Conf[path] = DGV_ConfigItems[e.ColumnIndex, e.RowIndex].Value as string;
            DGV_ConfigItems.DataSource = UiSupport.ConvertToTable(Conf, Level);
        }
示例#2
0
        public ConfView(ConfTree conf)
        {
            InitializeComponent();
            Dock = DockStyle.Fill;

            _log.Debug("Load ConfTree");
            Conf = conf;
            DGV_ConfigItems.DataSource = UiSupport.ConvertToTable(Conf);
            DGV_ConfigItems.Columns[DGV_ConfigItems.ColumnCount - 1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
        }
示例#3
0
        public void LoadConf(ConfTree conf, string oplevel)
        {
            if (Conf == null || !Conf.Equals(conf))
            {
                _log.Debug($"Load ConfTree({conf.Name},{(oplevel != null ? "" : "null")})");

                Conf = conf;
                DGV_ConfigItems.DataSource = UiSupport.ConvertToTable(Conf, oplevel);
                DGV_ConfigItems.Columns[DGV_ConfigItems.ColumnCount - 1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            }
        }
示例#4
0
        public void Bind(ConfTree root, ConfItem item, Action onChange)
        {
            _root     = root;
            _tree     = item as ConfTree;
            _onChange = onChange;

            LBL_FileInfo.Text     = Path.GetFileNameWithoutExtension(root.XmlDoc.BaseURI);
            LBL_SelectedNode.Text = $"为{ExtractTopNode(item.SelfPath)}添加";

            var tree = item as ConfTree;

            if (tree != null)
            {
                DataTable table;

                var subtree = tree.Sons[0] as ConfTree;

                if (subtree != null)
                {
                    var emptynode = ((subtree as ConfTree).Clone() as ConfTree);
                    emptynode.Clear();
                    table = UiSupport.ConvertToTable(emptynode);
                }
                else
                {
                    table = new DataTable();
                    table.Columns.AddRange(new DataColumn[] {
                        new DataColumn("Item.Name"),
                        new DataColumn("Item.Value"),
                    });
                    var row = table.NewRow();
                    table.Rows.Add(row);

                    DGV_NewNodeInfo.ColumnHeadersVisible = true;
                }

                DGV_NewNodeInfo.DataSource = table;
            }
        }