public void SelectHosts(List <IXenObject> selectedObjects) { if (selectedObjects.Count == 0 || HostListTreeView.Items.Count == 0) { return; } HostListTreeView.BeginUpdate(); HostListTreeView.ClearSelected(); for (int index = 0; index < HostListTreeView.Items.Count; index++) { var node = HostListTreeView.Items[index] as HostCustomTreeNode; if (node == null) { continue; } IXenConnection con = node.Tag as IXenConnection; if (con != null) { var pool = Helpers.GetPool(con); if (pool == null) { Host master = Helpers.GetMaster(con); if (master != null && selectedObjects.Contains(master)) { node.State = CheckState.Checked; } } else { if (selectedObjects.Contains(pool)) { foreach (var subnode in node.ChildNodes) { subnode.State = CheckState.Checked; } } } continue; } var host = node.Tag as Host; if (host != null && selectedObjects.Contains(host)) { node.State = CheckState.Checked; } } //focus on first checked item so the user can find it in a long list foreach (var node in HostListTreeView.CheckedItems()) { HostListTreeView.SelectedItems.Add(node); break; } HostListTreeView.EndUpdate(); }
private void EnableDisableButtons() { if (!Visible) { return; // CA-28387 } OnPageUpdated(); SelectAllButton.Enabled = HostListTreeView.CheckableItems().Count != 0; SelectNoneButton.Enabled = HostListTreeView.CheckedItems().Count > 0; }
public override bool EnableNext() { return(HostListTreeView.CheckedItems().Count > 0); }