コード例 #1
0
        private bool RetrieveConfiguration(VM selectedVM)
        {
            bool result = false;

            if (selectedVM.Connection != null)
            {
                if (selectedVM.other_config.ContainsKey("halsign_br_enabled"))
                {
                    if (selectedVM.other_config["halsign_br_enabled"].Equals("True"))
                    {
                        result = true;
                    }
                    else
                    {
                        result       = false;
                        this.noSetVM = selectedVM;
                    }
                }
                else
                {
                    Pool pool = HalsignHelpers.GetPoolOfOne(selectedVM.Connection);
                    if (pool != null && pool.other_config.ContainsKey("halsign_br_enabled") && pool.other_config["halsign_br_enabled"].Equals("True"))
                    {
                        result = true;
                    }
                    else
                    {
                        this.noSetVM = selectedVM;
                    }
                }
            }
            return(result);
        }
コード例 #2
0
        private void RefreshTreeViewCore()
        {
            int index = 0;
            List <IXenConnection> xenConnectionsCopy = ConnectionsManager.XenConnectionsCopy;

            xenConnectionsCopy.Sort();
            foreach (IXenConnection connection in xenConnectionsCopy)
            {
                VM[] vMs = connection.Cache.VMs.Where(vm => vm.uuid != null).ToArray();
                Array.Sort <VM>(vMs);
                XenAPI.SR[] sRs = connection.Cache.SRs;
                Array.Sort <XenAPI.SR>(sRs);
                Pool pool = HalsignHelpers.GetPool(connection);
                if (pool != null)
                {
                    bool     flag2;
                    TreeNode parent = this.AddNode(this.BackupTreeView.Nodes[0], index, HalsignHelpers.GetName(pool), Images.GetIconFor(pool), false, pool, out flag2);
                    index++;
                    Host[] hosts = connection.Cache.Hosts;
                    Array.Sort <Host>(hosts);
                    int num2 = 0;
                    foreach (Host obj3 in hosts)
                    {
                        this.AddHostAndChildren(parent, num2, connection, vMs, sRs, obj3, false, true);
                        num2++;
                    }
                    this.AddVMsToTree(parent, ref num2, connection, vMs, null, true);
                    this.PurgeFromHere(parent, num2);
                    if (flag2)
                    {
                        parent.Expand();
                    }
                    continue;
                }
                Pool poolOfOne = HalsignHelpers.GetPoolOfOne(connection);
                Host theHost   = (poolOfOne == null) ? null : poolOfOne.Connection.Resolve <Host>(poolOfOne.master);
                if (theHost == null)
                {
                    this.AddDisconnectedNode(this.BackupTreeView.Nodes[0], index, connection);
                }
                else
                {
                    this.AddHostAndChildren(this.BackupTreeView.Nodes[0], index, connection, vMs, sRs, theHost, true, false);
                }
                index++;
            }
            this.PurgeFromHere(this.BackupTreeView.Nodes[0], index);
            if (this.BackupTreeView.Nodes[0].Nodes.Count <= 0)
            {
                this.BackupTreeView.Enabled = false;
            }
            else
            {
                this.BackupTreeView.Nodes[0].Expand();
            }
        }