Removed some repetitive code

This commit is contained in:
yankejustin 2015-05-24 00:27:29 -04:00
parent 4d8a28cdcc
commit f5d671d93a
1 changed files with 14 additions and 15 deletions

View File

@ -24,6 +24,18 @@ namespace xServer.Forms
_changed = true; _changed = true;
} }
private void UpdateControlStates()
{
txtInstallname.Enabled = chkInstall.Checked;
rbAppdata.Enabled = chkInstall.Checked;
rbProgramFiles.Enabled = chkInstall.Checked;
rbSystem.Enabled = chkInstall.Checked;
txtInstallsub.Enabled = chkInstall.Checked;
chkHide.Enabled = chkInstall.Checked;
chkStartup.Enabled = chkInstall.Checked;
txtRegistryKeyName.Enabled = (chkInstall.Checked && chkStartup.Checked);
}
private void LoadProfile(string profilename) private void LoadProfile(string profilename)
{ {
ProfileManager pm = new ProfileManager(profilename + ".xml"); ProfileManager pm = new ProfileManager(profilename + ".xml");
@ -95,13 +107,7 @@ namespace xServer.Forms
txtMutex.Text = Helper.GetRandomName(32); txtMutex.Text = Helper.GetRandomName(32);
} }
txtInstallname.Enabled = chkInstall.Checked; UpdateControlStates();
rbAppdata.Enabled = chkInstall.Checked;
rbProgramFiles.Enabled = chkInstall.Checked;
rbSystem.Enabled = chkInstall.Checked;
txtInstallsub.Enabled = chkInstall.Checked;
chkHide.Enabled = chkInstall.Checked;
chkStartup.Enabled = chkInstall.Checked;
txtRegistryKeyName.Enabled = (chkInstall.Checked && chkStartup.Checked); txtRegistryKeyName.Enabled = (chkInstall.Checked && chkStartup.Checked);
@ -195,14 +201,7 @@ namespace xServer.Forms
{ {
HasChanged(); HasChanged();
txtInstallname.Enabled = chkInstall.Checked; UpdateControlStates();
rbAppdata.Enabled = chkInstall.Checked;
rbProgramFiles.Enabled = chkInstall.Checked;
rbSystem.Enabled = chkInstall.Checked;
txtInstallsub.Enabled = chkInstall.Checked;
chkHide.Enabled = chkInstall.Checked;
chkStartup.Enabled = chkInstall.Checked;
txtRegistryKeyName.Enabled = (chkInstall.Checked && chkStartup.Checked);
} }
private void chkStartup_CheckedChanged(object sender, EventArgs e) private void chkStartup_CheckedChanged(object sender, EventArgs e)