public Keyword_UC2(SRRC_BiaoJiKeywordEntity category,IEnumerable<SRRC_BiaoJiKeywordEntity> list,bool isFilter = false) : this() { this.list = list; this.Category = category; if(isFilter) { //keyword 筛选 this.CategoryName.Text = category.Name; this.Name = category.Id.ToString(); foreach (var item in list) { item.CategoryName = category.Name; var v = new Keyword_UC4(item); v.Name = item.Id.ToString(); //v.Tag = item; this.flp_keyword.Controls.Add(v); } //多选 var add = new Keyword_UC7(); add.ParentKeyword_UC2 = this; this.flp_keyword.Controls.Add(add); } else { //keyword 设置 this.CategoryName.Text = category.Name; foreach (var item in list) { var v = new Keyword_UC1(item.Name); v.Name = item.Id.ToString(); v.Tag = item; this.flp_keyword.Controls.Add(v); } } }
public void Convert_UC1_To_UC4() { var controlsName = new List<string>(); foreach (UserControl item in this.flp_keyword.Controls) { if (!item.Visible) continue; controlsName.Add(item.Name); } this.flp_keyword.Controls.Clear(); foreach (var item in list) { item.CategoryName = Category.Name; var v = new Keyword_UC4(item); v.Name = item.Id.ToString(); //v.Tag = item; this.flp_keyword.Controls.Add(v); if (!controlsName.Contains(item.Id.ToString())) { v.Visible = false; } } //多选 var add = new Keyword_UC7(); add.ParentKeyword_UC2 = this; this.flp_keyword.Controls.Add(add); (this.ParentForm as FrmMain).reCalcKeywordPanelHeight(); }