Exemple #1
0
        /// <summary>
        /// 初始化ListView
        /// </summary>
        /// <param name="pid">父节点(为空就是根节点)</param>
        private void IniliazeListView(string pid)
        {
            TDataInfoDTO[] allResult = null;
            LvDataContent.Items.Clear();
            _currentId = pid;
            //根节点
            if (string.IsNullOrWhiteSpace(pid))
            {
                allResult         = _client.TDataInGetByForginKey(_baseInfoId).Where(t => string.IsNullOrWhiteSpace(t.ParentId)).ToArray();
                tsbReturn.Enabled = false;
            }
            else
            {
                tsbReturn.Enabled = true;
                allResult         = _client.TDataInGetByParentKey(pid);
            }
            Array.ForEach(allResult, d =>
            {
                CreateViewItem(d, LvDataContent.Items.Count);
            });

            //设置菜单状态
            LvDataContent_SelectedIndexChanged(null, null);
        }