public BackupWizard(IXenObject XenObject) { this._xenModelObject = XenObject; InitializeComponent(); base.Text = string.Format(Messages.BACKUP_VM_TITLE, HalsignHelpers.GetName(this._xenModelObject.Connection)); this.xenChoseVmBackupPage = new BackupChoseVmPage(XenObject); this.scheduleBackupPage = new BackupSchedulePage(); this.summaryBackupPage = new BackupSummaryPage(); this.optionsBackupPage = new BackupOptionsPage(); this.completeBackupPage = new BackupCompletePage(); this.page_RbacWarning = new RBACWarningPage(); #region RBAC Warning Page Checks if (this._xenModelObject.Connection.Session.IsLocalSuperuser || Helpers.GetMaster(this._xenModelObject.Connection).external_auth_type == Auth.AUTH_TYPE_NONE) { //page_RbacWarning.DisableStep = true; } else { // Check to see if they can even create a VM RBACWarningPage.WizardPermissionCheck createCheck = new RBACWarningPage.WizardPermissionCheck(Messages.RBAC_WARNING_VM_WIZARD_BACKUP); foreach (RbacMethod method in StaticRBACDependencies) { createCheck.AddApiCheck(method); } createCheck.Blocking = true; page_RbacWarning.AddPermissionChecks(this._xenModelObject.Connection, createCheck); AddPage(page_RbacWarning, 0); } #endregion base.AddPage(this.xenChoseVmBackupPage); base.AddPage(this.scheduleBackupPage); base.AddPage(this.optionsBackupPage); base.AddPage(this.summaryBackupPage); base.AddPage(this.completeBackupPage); }
private void AddDisconnectedNode(TreeNode parent, int index, IXenConnection connection) { bool flag; this.AddNode(parent, index, HalsignHelpers.GetName(connection), Images.GetIconFor(connection), true, connection, out flag); }
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(); } }