CP-21174: Multiple dismissed XenCenterVersion alerts

- Limit the size of the list where we keep the dismissed XenCenter version alerts

Signed-off-by: Mihaela Stoica <mihaela.stoica@citrix.com>
This commit is contained in:
Mihaela Stoica 2017-03-15 11:26:00 +00:00
parent c5dfd7fccf
commit ca5cf5037e

View File

@ -101,11 +101,15 @@ namespace XenAdmin.Alerts
}
}
static int DISMISSED_XC_VERSIONS_LIMIT = 5;
public override void Dismiss()
{
List<string> current = new List<string>(Properties.Settings.Default.LatestXenCenterSeen.Split(','));
if (current.Contains(NewVersion.VersionAndLang))
return;
if (current.Count >= DISMISSED_XC_VERSIONS_LIMIT)
current.RemoveRange(0, current.Count - DISMISSED_XC_VERSIONS_LIMIT + 1);
current.Add(NewVersion.VersionAndLang);
Properties.Settings.Default.LatestXenCenterSeen = string.Join(",", current.ToArray());
Settings.TrySaveSettings();