public void BindToQueueTreeView(QueueTreeView treeView) { StartProjectMonitoring(); treeView.BeginUpdate(); treeView.Nodes.Clear(); foreach (ISingleServerMonitor monitor in serverMonitors) { IntegrationQueueTreeNodeAdaptor adaptor = new IntegrationQueueTreeNodeAdaptor(monitor); TreeNode serverTreeNode = adaptor.Create(); treeView.Nodes.Add(serverTreeNode); monitor.ServerSnapshotChanged += HandleServerSnapshotChange; } treeView.EndUpdate(); if (treeView.Nodes.Count > 0) { treeView.SelectedNode = treeView.Nodes[0]; } }
public void UnbindToQueueTreeView(QueueTreeView treeView) { treeView.BeginUpdate(); foreach (TreeNode node in treeView.Nodes) { IntegrationQueueTreeNodeAdaptor adaptor = node.Tag as IntegrationQueueTreeNodeAdaptor; if (adaptor != null) { adaptor.Detach(); } } treeView.Nodes.Clear(); treeView.EndUpdate(); foreach (ISingleServerMonitor monitor in serverMonitors) { monitor.ServerSnapshotChanged -= HandleServerSnapshotChange; } }