private List <NodeItemInfo> _CreateSampleList(ItemCountType countType = ItemCountType.Standard) { List <NodeItemInfo> list = new List <NodeItemInfo>(); int rootCount = GetItemCount(countType, false); for (int r = 0; r < rootCount; r++) { bool isLazy = (Data.RandomText.Rand.Next(10) >= 5); bool addChilds = !isLazy && (Data.RandomText.Rand.Next(10) >= 3); bool isExpanded = (addChilds && (Data.RandomText.Rand.Next(10) >= 2)); string rootKey = "R." + (++_InternalNodeId).ToString(); string text = Data.RandomText.GetRandomSentence(2, 5) + (isLazy ? " ..." : ""); DW.FontStyle fontStyleDelta = DW.FontStyle.Bold; NodeItemInfo rootNode = new NodeItemInfo(rootKey, null, text, expanded: isExpanded, lazyLoadChilds: isLazy, fontStyleDelta: fontStyleDelta); _FillNode(rootNode); list.Add(rootNode); if (addChilds) { list.AddRange(_CreateSampleChilds(rootKey, countType)); } } return(list); }
private int GetItemCount(ItemCountType countType, bool forChilds) { switch (countType) { case ItemCountType.Empty: return(0); case ItemCountType.Standard: return(forChilds ? Data.RandomText.Rand.Next(1, 12) : Data.RandomText.Rand.Next(10, 30)); case ItemCountType.Big: return(forChilds ? Data.RandomText.Rand.Next(40, 120) : Data.RandomText.Rand.Next(120, 400)); } return(0); }
private List <NodeItemInfo> _CreateSampleChilds(string parentKey, ItemCountType countType = ItemCountType.Standard) { List <NodeItemInfo> list = new List <NodeItemInfo>(); int childCount = GetItemCount(countType, true); bool addEditable = (Data.RandomText.Rand.Next(20) >= 8); if (addEditable) { childCount++; } for (int c = 0; c < childCount; c++) { bool isBlankNode = (addEditable && c == (childCount - 1)); list.Add(_CreateChildNode(parentKey, isBlankNode)); } return(list); }