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 }); }
protected override bool RunNextPagePrecheck(XenTabPage senderPage) { if (senderPage is Page_SetStorage) { if (!this.page_SetStorage.UserName.ToLower().Equals("root")) { if (string.IsNullOrEmpty(this.page_SetStorage.CheckAuthValidate())) { if (this.InitRestoreTree(ref restoreListInfo)) { this.set_storage_ip = this.page_SetStorage.StorageIP; this.set_storage_username = this.page_SetStorage.UserName; this.set_storage_password = this.page_SetStorage.Password; this.page_SelectVM.RestoreList = this.restoreListInfo; //this.page_SelectVM.BuildTree(); this.page_SelectVM.BuildRestoreTree(); } else { return(false); } } else { MessageBox.Show(this.page_SetStorage.CheckAuthValidate()); return(false); } } else { MessageBox.Show(Messages.RESTORE_ROOT_PROMPT); this.page_SetStorage.UserName = string.Empty; this.page_SetStorage.Password = string.Empty; return(false); } } else if (senderPage is Page_SelectVM) { this.page_SelectVM.CheckTreeViewStatus(); this.backup_info_list = this.page_SelectVM.Backup_info_list; this.vmCheckedList = this.page_SelectVM.vmCheckedList; this.page_JobSettings.PopulateData(); } else if (senderPage is Page_JobSettings) { this.restoreDataModel = this.page_JobSettings.restoreDataModel; this.restore_job_name = this.page_JobSettings.job_Name; this.restore_vm_name = this.page_JobSettings.vm_Name; this.restore_network_name = this.page_JobSettings.network_Name; this.restore_network_uuid = this.page_JobSettings.network_UUID; this._isBackupNetworkSettingChecked = this.page_JobSettings.isBackupNetworkSettingChecked; this._isNewMacAddressChecked = this.page_JobSettings.isNewMacAddressChecked; this.page_JobSchedule.UpdateServerTime(this._xenModelObject); if (!Regex.IsMatch(this.page_JobSettings.job_Name, @"^[\w\-\s\(\)]*$")) { MessageBox.Show(Messages.BR_JOB_NAME_CHECK); return(false); } } else if (senderPage is Page_JobSchedule) { this._isOnceScheduleChecked = this.page_JobSchedule.isOnceScheduleChecked; this.scheduleDate = this.page_JobSchedule.scheduleDate; this.scheduleTime = this.page_JobSchedule.scheduleTime; this.restore_vdi_info_list = this.page_SelectVM._restore_vdi_info_list; this.page_VMSettings.BuildRestoreInfoList(vmCheckedList, backup_info_list, restore_vm_name, restore_network_name, restoreDataModel, restore_vdi_info_list); } else if (senderPage is Page_VMSettings) { this.ScheduleRestoreJob(); } return(true); }