void OnItemChange(ProtoTreeViewItem selectItem) { tmpOutput = selectItem.ToString() + "\n"; if (selectItem.Type == ProtoTreeViewItem.eType.message) { List <sMessage> commonMsgList = new List <sMessage> (); m_TreeView.CollectMsgDependent(selectItem._message, commonMsgList); if (commonMsgList.Count > 0) { tmpOutput += "====================================================\n"; tmpOutput += "相关依赖Msg\n"; for (int i = 0; i < commonMsgList.Count; i++) { tmpOutput += commonMsgList[i].ToString() + "\n\n"; } } } }
protected override TreeViewItem BuildRoot() { selected = -1; Clear(); LoadProto(); TreeViewItem root = new TreeViewItem() { depth = -1 }; SetupDepthsFromParentsAndChildren(root); for (int i = 0; i < modelList.Count; i++) { sModel model = modelList [i]; ProtoTreeViewItem modelItem = new ProtoTreeViewItem(model); for (int j = 0; j < model.cmdList.Count; j++) { sCommand command = model.cmdList [j]; ProtoTreeViewItem commonItem = new ProtoTreeViewItem(model, command); if (command.msg_c2s != null) { ProtoTreeViewItem c2sItem = new ProtoTreeViewItem(model, command, command.msg_c2s); commonItem.AddChild(c2sItem); itemDic [c2sItem.id] = c2sItem; } if (command.msg_s2c != null) { ProtoTreeViewItem s2cItem = new ProtoTreeViewItem(model, command, command.msg_s2c); commonItem.AddChild(s2cItem); itemDic [s2cItem.id] = s2cItem; } modelItem.AddChild(commonItem); itemDic [commonItem.id] = commonItem; } root.AddChild(modelItem); itemDic [modelItem.id] = modelItem; } SetupDepthsFromParentsAndChildren(root); return(root); }