Пример #1
0
 private void ToolStripFileSave(object sender, EventArgs e)
 {
     if (currentSavePath != null)
     {
         var hppConfig = ProjectConfig.FromCurrentInstance(this);
         ProjectConfig.Save(hppConfig, currentSavePath);
     }
     else
     {
         ToolStripFileSaveAs(null, null);
     }
 }
Пример #2
0
        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);
            }
        }
Пример #3
0
        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!
        }