public RestoreWizard(IXenObject xenModelObject) { this.InitializeComponent(); this._Message = base.Text = string.Format(Messages.RESTORE_VM_TITLE, Helpers.GetName(xenModelObject.Connection)); this.page_SetStorage = new Page_SetStorage(xenModelObject); this.page_SelectVM = new Page_SelectVM(); this.page_JobSettings = new Page_JobSettings(xenModelObject); this.page_JobSchedule = new Page_JobSchedule(); this.page_VMSettings = new Page_VMSettings(); this.page_Complete = new Page_Complete(); this.page_RbacWarning = new RBACWarningPage(); this._xenModelObject = xenModelObject; this.backup_info_list = new Dictionary <string, string>(); this.vmCheckedList = new List <AgentParamDataModel>(); this.restoreDataModel = new RestoreDataModel(); this.restore_info_list = new List <BackupRestoreConfig.ResultInfo>(); this.restoreListInfo = new BackupRestoreConfig.RestoreListInfo(); this.restore_vdi_list = new Dictionary <string, string>(); #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_RESTORE); foreach (RbacMethod method in StaticRBACDependencies) { createCheck.AddApiCheck(method); } createCheck.Blocking = true; page_RbacWarning.AddPermissionChecks(this._xenModelObject.Connection, createCheck); AddPage(page_RbacWarning, 0); } #endregion base.AddPages(new XenTabPage[] { this.page_SetStorage, this.page_SelectVM, this.page_JobSettings, this.page_JobSchedule, this.page_VMSettings, this.page_Complete }); }
/// <summary> /// Get machine backups list /// </summary> /// <returns></returns> private bool InitRestoreTree(ref BackupRestoreConfig.RestoreListInfo restoreList) { bool isActionSucceed = false; Dictionary <string, string> dconf = new Dictionary <string, string> { { "ip", this.page_SetStorage.StorageIP }, { "username", this.page_SetStorage.UserName }, { "password", this.page_SetStorage.Password } }; BackupAction action = new BackupAction(Messages.GET_RESTORE_LIST, BackupRestoreConfig.BackupActionKind.RestoreFileList, this._xenModelObject, dconf); const ProgressBarStyle progressBarStyle = ProgressBarStyle.Marquee; ActionProgressDialog dialog = new ActionProgressDialog(action, progressBarStyle); dialog.ShowCancel = true; dialog.ShowDialog(this); try { if (!(action.Succeeded || ((action.Exception == null) || (action.Exception.Message.Equals(""))))) { Program.MainWindow.BringToFront(); } else { restoreList = action.RestoreList; isActionSucceed = true; } } catch { Program.MainWindow.BringToFront(); } return(isActionSucceed); }