private void GUI_FormClosing(object sender, FormClosingEventArgs e) { Settings settings = new Settings(idColumn.Width, linkColumn.Width, this.Size, this.Location); if (this.WindowState == FormWindowState.Minimized) { settings.windowSize = this.RestoreBounds.Size; settings.windowLocation = this.RestoreBounds.Location; } MyXml.saveSettings(settings, "settings.xml"); }
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 GUI_Load(object sender, EventArgs e) { if (!File.Exists("settings.xml")) { return; } Settings settings = MyXml.loadSettings("settings.xml"); this.Location = settings.windowLocation; this.Size = settings.windowSize; idColumn.Width = settings.idColumnWidth; linkColumn.Width = settings.linkColumnWidth; }
private void saveAsMiClicked(Object sender, EventArgs e) { SaveFileDialog saveFD = new SaveFileDialog(); saveFD.Filter = "Dialog (*.xml)|*.xml"; saveFD.RestoreDirectory = true; if (saveFD.ShowDialog() == DialogResult.OK) { fileName = saveFD.FileName.ToString(); MyXml.save(conversation, fileName); this.Text = "Dialog Editor - " + conversation.npcName; 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; } }