diff --git a/XenAdmin/TabPages/PvsPage.cs b/XenAdmin/TabPages/PvsPage.cs index 7ec33b30e..780662ffc 100644 --- a/XenAdmin/TabPages/PvsPage.cs +++ b/XenAdmin/TabPages/PvsPage.cs @@ -49,6 +49,8 @@ namespace XenAdmin.TabPages private SelectionManager disableSelectionManager; private DataGridViewVms_DefaultSort vmDefaultSort; + + private readonly CollectionChangeEventHandler PvsProxy_CollectionChangedWithInvoke; public PvsPage() { @@ -61,7 +63,9 @@ namespace XenAdmin.TabPages disableSelectionManager = new SelectionManager(); vmDefaultSort = new DataGridViewVms_DefaultSort(); - + + PvsProxy_CollectionChangedWithInvoke = Program.ProgramInvokeHandler(PvsProxyCollectionChanged); + base.Text = Messages.PVS_TAB_TITLE; } @@ -75,16 +79,16 @@ namespace XenAdmin.TabPages { if (connection != null) { - connection.Cache.DeregisterCollectionChanged(PvsProxyCollectionChanged); - connection.Cache.DeregisterCollectionChanged(PvsProxyCollectionChanged); + connection.Cache.DeregisterCollectionChanged(PvsProxy_CollectionChangedWithInvoke); + connection.Cache.DeregisterCollectionChanged(PvsProxy_CollectionChangedWithInvoke); } connection = value; if (connection != null) { - connection.Cache.RegisterCollectionChanged(PvsProxyCollectionChanged); - connection.Cache.RegisterCollectionChanged(PvsProxyCollectionChanged); + connection.Cache.RegisterCollectionChanged(PvsProxy_CollectionChangedWithInvoke); + connection.Cache.RegisterCollectionChanged(PvsProxy_CollectionChangedWithInvoke); } LoadVMs(); @@ -283,7 +287,7 @@ namespace XenAdmin.TabPages private void PvsProxyCollectionChanged(object sender, CollectionChangeEventArgs e) { - Program.Invoke(this, LoadVMs); + LoadVMs(); } private void VmPropertyChanged(object sender, PropertyChangedEventArgs e)