private void CreateKeywordItems() { try { mRootItem.Children.Clear(); //所有关键词 ObjectItemTask allItem = new ObjectItemTask(); allItem.ObjID = 0; allItem.Name = string.Format("All Keyword"); allItem.Description = string.Format("All Keyword"); mRootItem.AddChild(allItem); var keywords = mListKeywordInfos.GroupBy(k => k.SerialNo); foreach (var keyword in keywords) { ObjectItemTask item = new ObjectItemTask(); long serialNo = 0; string strName = string.Empty; string strDesc = string.Empty; foreach (var content in keyword) { serialNo = content.SerialNo; strName = content.Name; strDesc += string.Format("{0};", content.Content); item.ListKeywordInfos.Add(content); } item.ObjID = serialNo; item.Name = string.Format("{0} ({1}) ", strName, strDesc); item.Description = strName; allItem.AddChild(item); } } catch (Exception ex) { ShowException(ex.Message); } }
private void AddChildObject(ObjectItemTask parentItem, ObjectItemTask item) { Dispatcher.Invoke(new Action(() => parentItem.AddChild(item))); }