private void OpenFile(object sender, EventArgs e) { if (this.openFile.ShowDialog() != DialogResult.OK) { return; } using (var fs = this.openFile.OpenFile()) { this.root = BaseGenerator.Load(fs); this.treeView.BeginUpdate(); this.treeView.Nodes.Clear(); for (int i = 0; i < this.root.Generators.Count; i++) { BaseGenerator generator = (BaseGenerator)this.root.Generators[i]; AddToTree(generator); } this.treeView.EndUpdate(); } }