public void SetChildrenListening(bool listening, PerformanceItem item, bool withChildChildren) { foreach (var c in item.Childrens) { c.Listening = listening; if (withChildChildren) { SetChildrenListening(listening, c, withChildChildren); } } }
private void ExpandItem(PerformanceItem item, bool expand) { if (item == null) { return; } item.IsExpanded = expand; foreach (var child in item.Childrens) { ExpandItem(child as PerformanceItem, expand); } }
private void TreeView_Items_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e) { var item = TreeView_Items.SelectedItem as PerformanceItem; if (mCurrentSelected != null) { mCurrentSelected.Selected = false; mCurrentSelected = null; } mCurrentSelected = item; if (mCurrentSelected != null) { mCurrentSelected.Selected = true; } }
bool UpdateVisibleWithSearchText(PerformanceItem item, string searchText) { bool contains = false; foreach (var childItem in item.Childrens) { var value = UpdateVisibleWithSearchText(childItem, searchText); contains = contains || value; } if (string.IsNullOrEmpty(searchText)) { item.Visibility = Visibility.Visible; item.HighLightString = ""; return(true); } else { if (contains) { item.IsExpanded = true; } if (item.ItemName.ToLower().Contains(searchText)) { item.Visibility = Visibility.Visible; item.HighLightString = searchText; contains = true; } else if (!contains) { item.Visibility = Visibility.Collapsed; item.HighLightString = ""; } else { item.HighLightString = ""; } } return(contains); }
public ValueData(PerformanceItem hostItem) { HostPerformanceItem = hostItem; }
void LoadPerformanceTree(EngineNS.IO.XmlNode parentNode, PerformanceItem parent, string inheritName) { foreach (var node in parentNode.GetNodes()) { PerformanceItem item = new PerformanceItem_Parent(); if (node.GetAttribs().Count > 0) { string desc = ""; var att = node.FindAttrib("Desc"); if (att != null) { desc = att.Value; } att = node.FindAttrib("Value"); if (att != null) { var pf = new PerformanceItem_PerfCount(); pf.KeyName = att.Value; pf.ToolTip = desc; //item.onav item = pf; } att = node.FindAttrib("Variable"); if (att != null) { var nor = new PerformanceItem_Data(); nor.KeyName = att.Value; var viewer = EngineNS.CEngine.Instance.Stat.PViewer.CreateViewer(nor.KeyName); if (viewer == null) { continue; } Func <string[]> getValueAction = viewer.GetValueAction; Func <string[]> getNameAction = viewer.GetValueNameAction; if (getValueAction == null) { nor.ListeningVisible = Visibility.Collapsed; } nor.ToolTip = desc; item = nor; } } item.Plotter = plotter_Graph; item.OnListeningChanged = (listening) => { if (listening) { if (!mListenedItems.Contains(item)) { mListenedItems.Add(item); } } else { mListenedItems.Remove(item); } }; item.ItemName = node.Name; item.InheritName = inheritName; if (parent == null) { mItems.Add(item); } else { parent.Childrens.Add(item); item.Parent = parent; } LoadPerformanceTree(node, item, inheritName + "|" + node.Name); } }