private void OpenFile(string FileName) { bool saveSettings = false; Enabled = false; if (Recent.Contains(FileName)) { if (Recent.IndexOf(FileName) > 0) { Recent.RemoveAt(Recent.IndexOf(FileName)); Recent.Insert(0, FileName); saveSettings = true; } } else { Recent.Insert(0, FileName); saveSettings = true; } if (saveSettings) { Properties.Settings.Default.recent = String.Join(";", Recent); Properties.Settings.Default.Save(); } ShowNewForm(null, null); XmlTools.LoadXML(FileName); XmlTools.FillMissingDataOnXML(); UpdateData(); }
private void ShowNewForm(object sender, EventArgs e) { bool messageshow = false; foreach (var k in mustSave) { if (k) { messageshow = true; if (MessageBox.Show("There are still nodes not saved. Do you really want dismiss your changes?", "save", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) != DialogResult.Yes) { return; } for (var j = 0; j < mustSave.Count; j++) { mustSave[j] = false; } break; } } if (!messageshow && xmlModified) { if (MessageBox.Show("Current project is not saved, do you want close without saving the changes?", "save", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) != DialogResult.Yes) { return; } } toolStripButton1.Enabled = true; toolStripButton2.Enabled = true; if (formProject != null) { formProject.Hide(); editWindows.Hide(); log.Hide(); formProject.Close(); editWindows.Close(); log.Close(); } richTextBox1.Hide(); formChat.Hide(); editWindows = new EditWindows(); editWindows.MdiParent = this; editWindows.Parent = splitContainer2.Panel1; editWindows.Dock = DockStyle.Fill; editWindows.Show(); log = new Log(); log.MdiParent = this; log.Parent = splitContainer2.Panel2; log.Dock = DockStyle.Fill; log.Show(); formProject = new ProjectStructure(); formProject.MdiParent = this; formProject.Parent = splitContainer1.Panel1; formProject.Dock = DockStyle.Fill; formProject.Show(); xmlViewer = new Tools(); xmlViewer.MdiParent = this; xmlViewer.Parent = splitContainer2.Panel1; xmlViewer.Dock = DockStyle.Fill; Program.LogForm = log; XmlTools.LoadXML(""); XmlTools.FillMissingDataOnXML(); UpdateData(); if (e != null) { UpdateData(); } for (var k = 0; k < 8; k++) { mustSave[k] = false; } XmlModified(true); }