public GUI(String file) : this() { fileName = file; if (!file.Equals("")) { conversation = MyXml.load(fileName); this.Text = "Dialog Manager - " + conversation.npcName; treeListView.Roots = new ArrayList(conversation. getRootNodes()); treeListView.ExpandAll(); changesMade = false; } }
private void openMiClicked(Object sender, EventArgs e) { if (changesMade) { DialogResult result = discardChangesDialog(); if (result == DialogResult.No) { saveMiClicked(new object(), new EventArgs()); } else if (result == DialogResult.Cancel) { return; } } OpenFileDialog openFD = new OpenFileDialog(); openFD.Filter = "Dialog (*.xml)|*.xml"; openFD.RestoreDirectory = true; DialogResult dialogResult = openFD.ShowDialog(); if (dialogResult == DialogResult.OK) { fileName = openFD.FileName.ToString(); conversation = MyXml.load(fileName); NpcIdGenerator = new IdGenerator(); DialogNode[] nodes = conversation.getDialog(); for (int i = 0; i < nodes.Length; i++) { NpcIdGenerator.addId(nodes[i].id); } this.Text = "Dialog Manager - " + conversation.npcName; treeListView.Roots = new ArrayList(conversation. getRootNodes()); treeListView.ExpandAll(); changesMade = false; } }