public string GetText(SortInfoQueue sortList) { string values = null; if (sortList == null || sortList.Count <= 0) { values = Text; } else { foreach (SortInfo item in sortList) { object objValue = PublicMethods.GetPropertyValue(this, item.Type.ToString()); if (objValue == null) { continue; } string strValue = objValue.ToString().Trim(); if (string.IsNullOrEmpty(strValue)) { continue; } if (!string.IsNullOrEmpty(values)) { values += " " + sortList.Separator + " "; } values += strValue; } } return(values); }
private void checkedListBox1_ItemCheck(object sender, ItemCheckEventArgs e) { if (ItemChecked != null) { SortInfoQueue lstSortInfo = GetSortInfoQueue(this.checkedListBox1, e.Index); ItemChecked(lstSortInfo, e); } }
void uctSort1_ItemChecked(object sender, ItemCheckEventArgs e) { SortInfoQueue siQueue = sender as SortInfoQueue; if (siQueue != null) { lblContent.Text = GetExampleString(siQueue); } }
//获取标题名称 private string GetText(IEntityData entity, SortInfoQueue SortList) { IAssetsData assetsData = entity as IAssetsData; if (assetsData == null) { return(entity.Text); } return(assetsData.GetText(SortList)); }
private void btnSure_Click(object sender, EventArgs e) { sortInfoQueue = uctSort1.GetLstSortInfo <SortInfo, SortInfoQueue>(); if (sortInfoQueue.Count <= 0) { PublicMethods.WarnMessageBox(this, "当前选择显示内容不能为空!"); return; } sortInfoQueue.Separator = comboBox1.Text; this.DialogResult = System.Windows.Forms.DialogResult.OK; }
public void UpdateItems(SortInfoQueue sortInfoQueue) { Dictionary <string, string> dictPropertyName = sortInfoQueue.GetDictPropertyName(); this.SuspendLayout(); foreach (KeyValuePair <string, TreeListViewItem> item in dictItems) { UpdateTreeListViewItem(item.Value, dictPropertyName); } this.ResumeLayout(); }
private void SubUpdateItems(TreeNode treeNode, SortInfoQueue sortInfoQueue) { IAssetsData assetsData = treeNode.Tag as IAssetsData; if (assetsData != null) { treeNode.Text = assetsData.GetText(sortInfoQueue); } foreach (TreeNode item in treeNode.Nodes) { SubUpdateItems(item, sortInfoQueue); } }
private string GetExampleString(SortInfoQueue sortInfoQueue) { string result = null; foreach (SortInfo item in sortInfoQueue) { if (!string.IsNullOrEmpty(result)) { result += " " + comboBox1.Text + " "; } result += EnumAttrDict <SortType, SortAttribute> .Instance.GetAttribute(item.Type).Description; } return(result); }
public void UpdateItems(SortInfoQueue sortInfoQueue) { this.BeginUpdate(); this.SuspendLayout(); //方式一:遍历字典,缺点:界面闪烁 //foreach (KeyValuePair<string, TreeNode> item in dictNodes) //{ // TreeNode treeNode = item.Value; // IAssetsData assetsData = treeNode.Tag as IAssetsData; // if (assetsData != null) // treeNode.Text = assetsData.GetText(sortInfoQueue); //} //方式二:遍历节点 foreach (TreeNode item in this.Nodes) { SubUpdateItems(item, sortInfoQueue); } this.ResumeLayout(); this.EndUpdate(); }
//因为checkedListBox1仅有选中前发生事件(ItemCheck)没有选中后发生事件,所以要针对当前选中的Item进行反向处理 private SortInfoQueue GetSortInfoQueue(CheckedListBox checkedListBox1, int curIndex) { SortInfoQueue lstSortCategory = new SortInfoQueue(); for (int i = 0; i < checkedListBox1.Items.Count; i++) { bool bolChecked = checkedListBox1.GetItemChecked(i); //如果是 if (i == curIndex) { bolChecked = !bolChecked; } //如果没有选中 if (bolChecked == false) { continue; } lstSortCategory.Add(checkedListBox1.Items[i] as SortInfo); } return(lstSortCategory); }
private string GetExampleString() { sortInfoQueue = uctSort1.GetLstSortInfo <SortInfo, SortInfoQueue>(); return(GetExampleString(sortInfoQueue)); }
public FrmAssetsSort(SortInfoQueue sortInfoQueue) { InitializeComponent(); this.sortInfoQueue = sortInfoQueue; }
private void SubUpdateItems(TreeListViewItem tlvi, SortInfoQueue sortInfoQueue) { }