private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
{
Settings.SaveDefaultSettings();
ToolStripManager.SaveSettings(this, RegistryBaseKey);
this.panelVideo.DockPanel = null;
this.dockPanel.SaveAsXml(FileUtils.WorkingDirectory + "\\" + AssemblyName + ".Settings.UI.xml");
FileStream fileStream = null;
//try
//{
// fileStream = new FileStream(Settings.SettingsFilePath, FileMode.Create, FileAccess.Write);
// Settings.Serialize(fileStream);
// this.dockPanel.SaveAsXml(fileStream, Encoding.UTF8, true);
//}
//catch (Exception ex)
//{
// MessageBox.Show(ex.ToString());
//}
//finally
//{
// if (fileStream != null)
// fileStream.Close();
//}
try
{
fileStream = new FileStream(FileUtils.WorkingDirectory + "\\" + AssemblyName + ".Channels.xml", FileMode.Create, FileAccess.Write);
this.panelChannel.SaveChannels(fileStream);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
finally
{
if (fileStream != null)
fileStream.Close();
}
ClearGraph();
// Sets the previous screensaver state
if (this.screenSaverWasEnabled)
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, true, IntPtr.Zero, 0);
// Sets the previous power saving state
SetThreadExecutionState(this.powerSavingPreviousState);
}