private void track_PropertyChanged(object sender, PropertyChangedEventArgs e) { Track track = sender as Track; TreeNode treeNode = this.trackDictionary[track]; string trackText = TrackTreeView.GetTrackText(track); if (treeNode.Text != trackText) { // NOTE: Supposedly a redundant condition check before assignment, // but without it, the TrackTreeView flickers (gets invalidated) // even when the text is the same as before. treeNode.Text = trackText; } }
private void UpdateTrackNames() { this.trackGroupDictionary.Clear(); this.trackDictionary.Clear(); for (int i = 0; i < Context.Game.TrackGroups.Count; i++) { TrackGroup trackGroup = Context.Game.TrackGroups[i]; TreeNode trackGroupNode = this.treeView.Nodes[i]; this.trackGroupDictionary.Add(trackGroup, trackGroupNode); TreeNodeCollection trackNodes = trackGroupNode.Nodes; for (int j = 0; j < trackGroup.Count; j++) { Track track = trackGroup[j]; TreeNode trackNode = trackNodes[j]; this.trackDictionary.Add(track, trackNode); trackNode.Text = TrackTreeView.GetTrackText(track); } } }