mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-23 12:30:50 +01:00
Collapse type checks in WlbOptimizePool
Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com>
This commit is contained in:
parent
59ff422d9d
commit
113a427e6a
@ -594,39 +594,36 @@ namespace XenAdmin.Controls.Wlb
|
||||
/// </summary>
|
||||
protected void OptRecRetrieveAction_Completed(ActionBase sender)
|
||||
{
|
||||
if (!(sender is AsyncAction asyncAction) || !action.IsCompleted)
|
||||
if (!(sender is WlbRetrieveRecommendationsAction asyncAction) || !action.IsCompleted)
|
||||
return;
|
||||
|
||||
asyncAction.Completed -= OptRecRetrieveAction_Completed;
|
||||
|
||||
if (asyncAction is WlbRetrieveRecommendationsAction thisAction)
|
||||
{
|
||||
_recommendations = thisAction.Recommendations;
|
||||
|
||||
if (_recommendations != null && IsGoodRecommendation(_recommendations) && _xenObject.Connection == asyncAction.Connection)
|
||||
{
|
||||
Program.Invoke(this, delegate()
|
||||
{
|
||||
PopulateData(_recommendations);
|
||||
_recommendations = asyncAction.Recommendations;
|
||||
|
||||
// In case optimizePoolListView is empty
|
||||
if (optimizePoolListView.Items.Count == 0)
|
||||
{
|
||||
statusLabel.Text = Messages.WLB_OPT_POOL_NO_RECOMMENDATION;
|
||||
EnableControls(true, false);
|
||||
}
|
||||
else
|
||||
EnableControls(false, true);
|
||||
});
|
||||
}
|
||||
else
|
||||
if (_recommendations != null && IsGoodRecommendation(_recommendations) && _xenObject.Connection == asyncAction.Connection)
|
||||
{
|
||||
Program.Invoke(this, delegate ()
|
||||
{
|
||||
Program.Invoke(this, delegate()
|
||||
PopulateData(_recommendations);
|
||||
|
||||
// In case optimizePoolListView is empty
|
||||
if (optimizePoolListView.Items.Count == 0)
|
||||
{
|
||||
statusLabel.Text = Messages.WLB_OPT_POOL_NO_RECOMMENDATION;
|
||||
EnableControls(true, false);
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
EnableControls(false, true);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
Program.Invoke(this, delegate ()
|
||||
{
|
||||
statusLabel.Text = Messages.WLB_OPT_POOL_NO_RECOMMENDATION;
|
||||
EnableControls(true, false);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user