CA-293092: Enhanced the logic of the SuccessfulDescription in the defining

class so the caller won't have to worry about it.

Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
Konstantina Chremmou 2018-06-29 19:33:57 +01:00 committed by Mihaela Stoica
parent 7ea811e942
commit 741bfaa864
4 changed files with 31 additions and 14 deletions

View File

@ -49,11 +49,16 @@ namespace XenAdmin.Diagnostics.Checks
return list;
}
public abstract string Description{ get;}
public abstract string Description { get; }
public virtual string SuccessfulCheckDescription
public virtual string SuccessfulCheckDescription
{
get { return string.Empty; }
get
{
return string.IsNullOrEmpty(Description)
? string.Empty
: string.Format(Messages.PATCHING_WIZARD_CHECK_OK, Description);
}
}
}
}

View File

@ -48,5 +48,15 @@ namespace XenAdmin.Diagnostics.Checks
{
get { return _host; }
}
public override string SuccessfulCheckDescription
{
get
{
return string.IsNullOrEmpty(Description)
? string.Empty
: string.Format(Messages.PATCHING_WIZARD_HOST_CHECK_OK, Host.Name(), Description);
}
}
}
}

View File

@ -32,6 +32,7 @@
using XenAdmin.Core;
using XenAPI;
namespace XenAdmin.Diagnostics.Checks
{
public abstract class PoolCheck : Check
@ -46,5 +47,15 @@ namespace XenAdmin.Diagnostics.Checks
{
get { return _pool; }
}
public override string SuccessfulCheckDescription
{
get
{
return string.IsNullOrEmpty(Description)
? string.Empty
: string.Format(Messages.PATCHING_WIZARD_HOST_CHECK_OK, Helpers.GetPoolOfOne(_pool.Connection), Description);
}
}
}
}

View File

@ -723,23 +723,14 @@ namespace XenAdmin.Wizards.PatchingWizard
? Images.GetImage16For(Icons.Ok)
: Problem.Image;
string description = string.Empty;
string description = null;
if (Problem != null)
description = Problem.Description;
else if (_check != null)
{
description = _check.SuccessfulCheckDescription;
if (string.IsNullOrEmpty(description))
{
var hostCheck = _check as HostCheck;
description = hostCheck != null
? String.Format(Messages.PATCHING_WIZARD_HOST_CHECK_OK, hostCheck.Host.Name(), _check.Description)
: String.Format(Messages.PATCHING_WIZARD_CHECK_OK, _check.Description);
}
}
if (description != string.Empty)
if (!string.IsNullOrEmpty(description))
_descriptionCell.Value = String.Format(Messages.PATCHING_WIZARD_DESC_CELL_INDENT, null, description);
_solutionCell.Value = Problem == null ? string.Empty : Problem.HelpMessage;