Fix "Sound On" checkbox always showing as checked even when sound is off.

Fix null reference exception when opening homepage from update notification.
This commit is contained in:
jdpurcell 2015-01-04 16:48:11 +00:00
parent bd6b7fcd43
commit 891998be12
2 changed files with 11 additions and 13 deletions

View File

@ -2262,7 +2262,7 @@ namespace BizHawk.Client.EmuHawk
if (result == DialogResult.Yes)
{
System.Threading.ThreadPool.QueueUserWorkItem((s) => System.Diagnostics.Process.Start(VersionInfo.HomePage).Dispose());
System.Threading.ThreadPool.QueueUserWorkItem((s) => { using (System.Diagnostics.Process.Start(VersionInfo.HomePage)) { } });
}
else if (result == DialogResult.No)
{

View File

@ -7,6 +7,8 @@ namespace BizHawk.Client.EmuHawk
{
public partial class SoundConfig : Form
{
private bool _programmaticallyChangingValue;
public SoundConfig()
{
InitializeComponent();
@ -14,6 +16,8 @@ namespace BizHawk.Client.EmuHawk
private void SoundConfig_Load(object sender, EventArgs e)
{
_programmaticallyChangingValue = true;
SoundOnCheckBox.Checked = Global.Config.SoundEnabled;
MuteFrameAdvance.Checked = Global.Config.MuteFrameAdvance;
ThrottlecheckBox.Checked = Global.Config.SoundThrottle;
@ -24,7 +28,6 @@ namespace BizHawk.Client.EmuHawk
// vestigal
ThrottlecheckBox.Visible = false;
var dd = SoundEnumeration.DeviceNames();
listBoxSoundDevices.Items.Add("<default>");
listBoxSoundDevices.SelectedIndex = 0;
@ -36,6 +39,8 @@ namespace BizHawk.Client.EmuHawk
listBoxSoundDevices.SelectedItem = d;
}
}
_programmaticallyChangingValue = false;
}
private void OK_Click(object sender, EventArgs e)
@ -66,17 +71,10 @@ namespace BizHawk.Client.EmuHawk
private void SoundVolNumeric_ValueChanged(object sender, EventArgs e)
{
SoundVolBar.Value = (int)SoundVolNumeric.Value;
//This is changed through the user or the Above Scroll Bar
//Is it Zero? Mute
if (SoundVolBar.Value == 0)
{
SoundOnCheckBox.Checked = false;
}
// Not Zero. Unmute
else
{
SoundOnCheckBox.Checked = true;
}
// If the user is changing the volume, automatically turn on/off sound accordingly
if (!_programmaticallyChangingValue)
SoundOnCheckBox.Checked = SoundVolBar.Value != 0;
}
private void SoundOnCheckBox_CheckedChanged(object sender, EventArgs e)