private async void UpdateViewModel() { var nodes = new List <PresentationNode>(); if (!AppState.Data.DefinitionsLoaded) { return; } var rootNode = await Definitions.GetPresentationNode(rootTriumphsNodeHash); async Task OnEachSecondLevelNode(DestinyPresentationNodeChildEntry secondLevelChild, PresentationNode topLevelNode, bool skipSecondLevel = false) { var secondLevelNode = await PresentationNode.FromHash(secondLevelChild.PresentationNodeHash, AppState.Data.Profile, topLevelNode); secondLevelNode.SkipSecondLevel = skipSecondLevel; nodes.Add(secondLevelNode); } foreach (var topLevelChild in rootNode.Children.PresentationNodes) { var topLevelNode = new PresentationNode { PresentationNodeHash = topLevelChild.PresentationNodeHash, Definition = await Definitions.GetPresentationNode(topLevelChild.PresentationNodeHash) }; foreach (var secondLevelChild in topLevelNode.Definition.Children.PresentationNodes) { await OnEachSecondLevelNode(secondLevelChild, topLevelNode); } } var sealsNode = new PresentationNode { PresentationNodeHash = rootSealsNodeHash, Definition = await Definitions.GetPresentationNode(rootSealsNodeHash) }; if (sealsNode.Definition != null) { foreach (var secondLevelChild in sealsNode.Definition.Children.PresentationNodes) { await OnEachSecondLevelNode(secondLevelChild, sealsNode, true); } } NodesCollection.Source = from t in nodes group t by t.ParentNode into g select g; }
private async void UpdateViewModel() { var nodes = new List <PresentationNode>(); if (!AppState.Data.DefinitionsLoaded) { return; } var rootNodeDef = await Definitions.GetPresentationNode(RootTriumphsNodeHash); async Task <PresentationNode> OnEachSecondLevelNode(DestinyPresentationNodeChildEntry secondLevelChild, PresentationNode topLevelNode, bool skipSecondLevel = false) { var secondLevelNode = await PresentationNode.FromHash(secondLevelChild.PresentationNodeHash, AppState.Data.Profile, topLevelNode); secondLevelNode.SkipSecondLevel = skipSecondLevel; nodes.Add(secondLevelNode); return(secondLevelNode); } if (rootNodeDef != null) { foreach (var topLevelChild in rootNodeDef.Children.PresentationNodes) { var topLevelNode = new PresentationNode { PresentationNodeHash = topLevelChild.PresentationNodeHash, Definition = await Definitions.GetPresentationNode(topLevelChild.PresentationNodeHash) }; if (topLevelNode.Definition == null) { continue; } foreach (var secondLevelChild in topLevelNode.Definition.Children.PresentationNodes) { await OnEachSecondLevelNode(secondLevelChild, topLevelNode); } } } // // Catalysts // var catalystsNode = new PresentationNode { PresentationNodeHash = RootCatalystsNodeHash, Definition = await Definitions.GetPresentationNode(RootCatalystsNodeHash) }; if (catalystsNode.Definition != null) { foreach (var secondLevelChild in catalystsNode.Definition.Children.PresentationNodes) { var node = await OnEachSecondLevelNode(secondLevelChild, catalystsNode, true); node.Definition.DisplayProperties.HasIcon = true; node.Definition.DisplayProperties.Icon = catalystsNode.Definition.DisplayProperties.Icon; } } // // Lore // var loreNode = new PresentationNode { PresentationNodeHash = RootLoreNodeHash, Definition = await Definitions.GetPresentationNode(RootLoreNodeHash) }; if (loreNode.Definition != null) { foreach (var secondLevelChild in loreNode.Definition.Children.PresentationNodes) { await OnEachSecondLevelNode(secondLevelChild, loreNode); } } // // Seals // var sealsNode = new PresentationNode { PresentationNodeHash = RootSealsNodeHash, Definition = await Definitions.GetPresentationNode(RootSealsNodeHash) }; if (sealsNode.Definition != null) { foreach (var secondLevelChild in sealsNode.Definition.Children.PresentationNodes) { await OnEachSecondLevelNode(secondLevelChild, sealsNode, true); } } NodesCollection.Source = from t in nodes group t by t.ParentNode into g select g; }