protected override void ExecuteCore(SelectedItemCollection selection) { ApplyLicenseEditionAction action = new ApplyLicenseEditionAction(xos, _edition, _licenseServerAddress, _licenseServerPort, null); ActionProgressDialog actionProgress = new ActionProgressDialog(action, ProgressBarStyle.Marquee); // close dialog even when there's an error as this action shows its own error dialog box. action.Completed += s => { Program.Invoke(Program.MainWindow, () => { Failure f = action.Exception as Failure; if (f != null && f.ErrorDescription[0] == Failure.RBAC_PERMISSION_DENIED_FRIENDLY) return; actionProgress.Close(); }); if (action.Exception != null) { ShowLicensingFailureDialog(action.LicenseFailures, action.Exception.Message, Parent); } }; actionProgress.ShowDialog(Parent); if (actionProgress.action.Succeeded) { InvokeSuccedded(null); } }
protected static void FixLicensing(Pool pool, List<Host> hostsToRelicense, Action<List<LicenseFailure>, string> doOnLicensingFailure) { if (hostsToRelicense.Count == 0) return; Host poolMaster = Helpers.GetMaster(pool); AsyncAction action = new ApplyLicenseEditionAction(hostsToRelicense.ConvertAll(h=>h as IXenObject), Host.GetEdition(poolMaster.edition), poolMaster.license_server["address"], poolMaster.license_server["port"], doOnLicensingFailure); action.RunExternal(null); }
protected static void FixLicensing(Pool pool, List <Host> hostsToRelicense, Action <List <LicenseFailure>, string> doOnLicensingFailure) { if (hostsToRelicense.Count == 0) { return; } Host poolMaster = Helpers.GetMaster(pool); AsyncAction action = new ApplyLicenseEditionAction(hostsToRelicense.ConvertAll(h => h as IXenObject), Host.GetEdition(poolMaster.edition), poolMaster.license_server["address"], poolMaster.license_server["port"], doOnLicensingFailure); action.RunExternal(null); }