[CP-16936] Implement GUI for viewing the PVS farms and PVS servers (read-only)

Added event handlers for changes made to PVS server; it may end up calling Rebuild() twice but that's not a problem.

Signed-off-by: Frezzle <frederico.mazzone@citrix.com>
This commit is contained in:
Frezzle 2016-07-26 11:31:00 +01:00
parent 6c7df810f3
commit e6dfddb98c

View File

@ -64,11 +64,13 @@ namespace XenAdmin.Dialogs
{ {
UnregisterEventHandlers(); UnregisterEventHandlers();
connection.Cache.RegisterBatchCollectionChanged<PVS_farm>(PvsFarmBatchCollectionChanged); connection.Cache.RegisterBatchCollectionChanged<PVS_farm>(PvsFarmBatchCollectionChanged);
connection.Cache.RegisterBatchCollectionChanged<PVS_server>(PvsServerBatchCollectionChanged);
} }
private void UnregisterEventHandlers() private void UnregisterEventHandlers()
{ {
connection.Cache.DeregisterBatchCollectionChanged<PVS_farm>(PvsFarmBatchCollectionChanged); connection.Cache.DeregisterBatchCollectionChanged<PVS_farm>(PvsFarmBatchCollectionChanged);
connection.Cache.DeregisterBatchCollectionChanged<PVS_server>(PvsServerBatchCollectionChanged);
} }
private void PvsFarmBatchCollectionChanged(object sender, EventArgs e) private void PvsFarmBatchCollectionChanged(object sender, EventArgs e)
@ -76,6 +78,11 @@ namespace XenAdmin.Dialogs
Program.Invoke(this, Rebuild); Program.Invoke(this, Rebuild);
} }
private void PvsServerBatchCollectionChanged(object sender, EventArgs e)
{
Program.Invoke(this, Rebuild);
}
protected override void OnClosing(CancelEventArgs e) protected override void OnClosing(CancelEventArgs e)
{ {
UnregisterEventHandlers(); UnregisterEventHandlers();