Merge pull request #595 from agimofcarmen/CP-13519

CP-13519: If more options are selected in Updates Options, refresh th…
This commit is contained in:
Gabor Apati-Nagy 2015-08-04 17:34:11 +01:00
commit 41fa9a5eab

View File

@ -37,6 +37,7 @@ using System.Data;
using System.Text;
using System.Windows.Forms;
using XenAdmin.Properties;
using XenAdmin.Core;
namespace XenAdmin.Dialogs.OptionsPages
@ -76,6 +77,8 @@ namespace XenAdmin.Dialogs.OptionsPages
public void Save()
{
bool refreshUpdatesTab = IsCheckForUpdatesRequired();
// XenCenter updates
if (AllowXenCenterUpdatesCheckBox.Checked != Properties.Settings.Default.AllowXenCenterUpdates)
Properties.Settings.Default.AllowXenCenterUpdates = AllowXenCenterUpdatesCheckBox.Checked;
@ -85,6 +88,22 @@ namespace XenAdmin.Dialogs.OptionsPages
Properties.Settings.Default.AllowPatchesUpdates = AllowXenServerPatchesCheckBox.Checked;
if (AllowXenServerUpdatesCheckBox.Checked != Properties.Settings.Default.AllowXenServerUpdates)
Properties.Settings.Default.AllowXenServerUpdates = AllowXenServerUpdatesCheckBox.Checked;
if(refreshUpdatesTab)
{
Updates.CheckForUpdates(false);
}
}
/// <summary>
/// Returns true if at least one other box has been checked in Updates Options. Otherwise returns false.
/// </summary>
/// <returns></returns>
private bool IsCheckForUpdatesRequired()
{
return (AllowXenCenterUpdatesCheckBox.Checked && !Properties.Settings.Default.AllowXenCenterUpdates) ||
(AllowXenServerPatchesCheckBox.Checked && !Properties.Settings.Default.AllowPatchesUpdates) ||
(AllowXenServerUpdatesCheckBox.Checked && !Properties.Settings.Default.AllowXenServerUpdates);
}
#endregion