private void FormMain_FormClosing(object sender, FormClosingEventArgs e) { try { this.SaveLayout(); RegistryLoader.SaveValue(Name, "play", soundPlayerBar1.Playing); RegistryLoader.SaveValue(Name, "granularity", menuSizeSetting.Text); RegistryLoader.SaveValue(Name, "time", soundPlayerBar1.Position); RegistryLoader.SaveValue(Name, "showFPS", menuFps.Checked); RegistryLoader.SaveValue(Name, "compact", menuCompact.Checked); multiGraph.SaveLayout(); log.SaveLayout(); camera.SaveLayout(); // rename old DefaultFiles.RenameAutoSaveDemoFile(); // save new DemoLoader.SaveToFile(demo, DefaultFiles.GetAutoSaveDemoFilePath()); demo.Dispose(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void FormMain_Load(object sender, EventArgs e) { try { this.LoadLayout(); string granularity = Convert.ToString(RegistryLoader.LoadValue(Name, "granularity", menuSizeSetting.Text)); menuSizeSetting.SelectedIndex = menuSizeSetting.FindString(granularity); menuFps.Checked = Convert.ToBoolean(RegistryLoader.LoadValue(Name, "showFPS", false)); menuCompact.Checked = Convert.ToBoolean(RegistryLoader.LoadValue(Name, "compact", false)); menuOnTop.Checked = TopMost; String[] arguments = Environment.GetCommandLineArgs(); if (arguments.Length > 1) { AddShader(arguments[1]); } else { //no cmd arguments LoadDemo(DefaultFiles.GetAutoSaveDemoFilePath()); soundPlayerBar1.Position = (float)Convert.ToDouble(RegistryLoader.LoadValue(Name, "time", 0.0)); } soundPlayerBar1.Playing = Convert.ToBoolean(RegistryLoader.LoadValue(Name, "play", false)); } catch (Exception ex) { log.Append(ex.Message); } }