private void ToolStripFileSave(object sender, EventArgs e) { if (currentSavePath != null) { var hppConfig = ProjectConfig.FromCurrentInstance(this); ProjectConfig.Save(hppConfig, currentSavePath); } else { ToolStripFileSaveAs(null, null); } }
private void ToolStripFileSaveAs(object sender, EventArgs e) { SaveFileDialog openFile = new SaveFileDialog() { Filter = "Power Plant Config File|*.json" }; if (openFile.ShowDialog() == DialogResult.OK) { currentSavePath = openFile.FileName; var hppConfig = ProjectConfig.FromCurrentInstance(this); ProjectConfig.Save(hppConfig, currentSavePath); } }
private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { HPPConfig.GetInstance().Save(); if (HPPConfig.GetInstance().AutomaticallySaveConfig) { if (currentSavePath != null) { var hppConfig = ProjectConfig.FromCurrentInstance(this); ProjectConfig.Save(hppConfig, currentSavePath); } } //Environment.Exit(0); // Ensure background threads close too! }