public void UpdateNodes(NodeView[] nodeList) { Dispatcher.Invoke( new Action(() => { List<NodeView> tobeRemoved = new List<NodeView>(); foreach (System.Windows.UIElement ele in this.Children) { NodeView nv = ele as NodeView; if (nv.Ranking == 0) { tobeRemoved.Add(nv); } } foreach (NodeView nv in tobeRemoved) { this.Children.Remove(nv); } foreach (NodeView node in nodeList) { if (node.Ranking > 0) { if (!this.Children.Contains(node)) { this.Children.Add(node); } } } }),System.Windows.Threading.DispatcherPriority.Render); }
internal void Initialize() { Graph.Initialize(STATICS.FILE_LOC, STATICS.WORD_COUNT); nodeList = new NodeList(); glowList = new GlowList(); string[] wholeKeyword = Graph.GetAllKeywords(); for (int i = 0; i < wholeKeyword.Length; i++) { NodeView node = new NodeView(wholeKeyword[i]); nodeList.AddNodeView(wholeKeyword[i], node); GlowView glow = new GlowView(wholeKeyword[i]); glowList.AddGlowView(wholeKeyword[i], glow); } }
Dictionary<string, NodeView> nodeViewList = new Dictionary<string, NodeView>(); //Include all 1000 keywords #endregion Fields #region Methods public void AddNodeView(string identifier, NodeView nodeView) { if (!nodeViewList.ContainsKey(identifier)) { nodeViewList.Add(identifier, nodeView); } }