Merge pull request #1047 from GaborApatiNagy/master_batch_new2

Merge master
This commit is contained in:
Gabor Apati-Nagy 2016-06-29 18:00:50 +01:00 committed by GitHub
commit de66c4403a
171 changed files with 1748 additions and 841 deletions

View File

@ -228,14 +228,15 @@ namespace XenAdmin.Actions
{
Program.Invoke(Program.MainWindow, delegate
{
ThreeButtonDialog d = new ThreeButtonDialog(
using (var d = new ThreeButtonDialog(
new ThreeButtonDialog.Details(System.Drawing.SystemIcons.Warning, string.Format(Messages.FORCE_CLOSE_PLUGIN_PROMPT, _menuItemFeature.ToString())),
"ProcessForceClosePrompt",
new ThreeButtonDialog.TBDButton(Messages.FORCE_CLOSE, DialogResult.Yes),
new ThreeButtonDialog.TBDButton(Messages.ALLOW_TO_CONTINUE, DialogResult.No));
new ThreeButtonDialog.TBDButton(Messages.ALLOW_TO_CONTINUE, DialogResult.No)))
{
if (d.ShowDialog(Program.MainWindow) == DialogResult.Yes && !_extAppProcess.HasExited)
_extAppProcess.Kill();
}
});
}

View File

@ -254,11 +254,14 @@ namespace XenAdmin.Actions.Wlb
// Tell the user the VM will be started without HA protection.
Program.Invoke(Program.MainWindow, delegate()
{
new ThreeButtonDialog(
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Warning,
String.Format(Messages.HA_INVALID_CONFIG_RESUME, Helpers.GetName(vm).Ellipsise(500)),
Messages.HIGH_AVAILABILITY)).ShowDialog(Program.MainWindow);
Messages.HIGH_AVAILABILITY)))
{
dlg.ShowDialog(Program.MainWindow);
}
});
// Set the VM to 'Do not restart'.
@ -334,11 +337,14 @@ namespace XenAdmin.Actions.Wlb
Helpers.GetName(vm).Ellipsise(100));
Program.Invoke(Program.MainWindow, delegate()
{
new ThreeButtonDialog(
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Warning,
msg,
Messages.HIGH_AVAILABILITY)).ShowDialog(Program.MainWindow);
Messages.HIGH_AVAILABILITY)))
{
dlg.ShowDialog(Program.MainWindow);
}
});
}
else
@ -350,18 +356,20 @@ namespace XenAdmin.Actions.Wlb
Program.Invoke(Program.MainWindow, delegate()
{
DialogResult r = new ThreeButtonDialog(
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Warning,
msg,
Messages.HIGH_AVAILABILITY),
ThreeButtonDialog.ButtonYes,
new ThreeButtonDialog.TBDButton(Messages.NO_BUTTON_CAPTION, DialogResult.No, ThreeButtonDialog.ButtonType.CANCEL, true)).ShowDialog(Program.MainWindow);
new ThreeButtonDialog.TBDButton(Messages.NO_BUTTON_CAPTION, DialogResult.No, ThreeButtonDialog.ButtonType.CANCEL, true)))
{
DialogResult r = dlg.ShowDialog(Program.MainWindow);
if (r != DialogResult.Yes)
{
error = true;
}
}
});
}
}

View File

@ -96,11 +96,16 @@ namespace XenAdmin.Commands
return (DialogResult)Program.Invoke(Program.MainWindow,
(DialogInvoker)delegate()
{
return new ThreeButtonDialog(
DialogResult dialogResult;
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(SystemIcons.Error, string.Format(Messages.ACTIVATION_FAILED_MESSAGE, InvisibleMessages.ACTIVATION_SERVER)),
"ActivationServerUnavailable",
new ThreeButtonDialog.TBDButton(Messages.ACTIVATION_SAVE, DialogResult.Yes),
ThreeButtonDialog.ButtonCancel).ShowDialog(Program.MainWindow);
ThreeButtonDialog.ButtonCancel))
{
dialogResult = dlg.ShowDialog(Program.MainWindow);
}
return dialogResult;
});
}

View File

@ -100,8 +100,11 @@ namespace XenAdmin.Commands
: string.Format(Messages.ADD_HOST_TO_POOL_DISCONNECTED_POOL_MULTIPLE,
Helpers.GetName(_pool).Ellipsise(500));
new ThreeButtonDialog(
new ThreeButtonDialog.Details(SystemIcons.Error, message, Messages.XENCENTER)).ShowDialog(Parent);
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(SystemIcons.Error, message, Messages.XENCENTER)))
{
dlg.ShowDialog(Parent);
}
return;
}
@ -121,8 +124,8 @@ namespace XenAdmin.Commands
Helpers.FeatureForbidden(host, Host.RestrictCpuMasking) &&
!PoolJoinRules.FreeHostPaidMaster(host, master, false))) // in this case we can upgrade the license and then mask the CPU
{
UpsellDialog dlg = new UpsellDialog(HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_CPUMASKING : Messages.UPSELL_BLURB_CPUMASKING + Messages.UPSELL_BLURB_CPUMASKING_MORE,
InvisibleMessages.UPSELL_LEARNMOREURL_CPUMASKING);
using (var dlg = new UpsellDialog(HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_CPUMASKING : Messages.UPSELL_BLURB_CPUMASKING + Messages.UPSELL_BLURB_CPUMASKING_MORE,
InvisibleMessages.UPSELL_LEARNMOREURL_CPUMASKING))
dlg.ShowDialog(Parent);
return;
}
@ -221,14 +224,16 @@ namespace XenAdmin.Commands
string poolName = Helpers.GetName(pool).Ellipsise(500);
string hostName = Helpers.GetName(host).Ellipsise(500);
string msg = string.Format(Messages.HA_HOST_ENABLE_NTOL_RAISE_QUERY, poolName, hostName, currentNtol, max);
if (new ThreeButtonDialog(
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(null, msg, Messages.HIGH_AVAILABILITY),
ThreeButtonDialog.ButtonYes,
new ThreeButtonDialog.TBDButton(Messages.NO_BUTTON_CAPTION, DialogResult.No, ThreeButtonDialog.ButtonType.CANCEL, true)).ShowDialog(Program.MainWindow)
== DialogResult.Yes)
new ThreeButtonDialog.TBDButton(Messages.NO_BUTTON_CAPTION, DialogResult.No, ThreeButtonDialog.ButtonType.CANCEL, true)))
{
if (dlg.ShowDialog(Program.MainWindow) == DialogResult.Yes)
{
doit = true;
}
}
});
return doit;
}
@ -279,14 +284,17 @@ namespace XenAdmin.Commands
msg = string.Format(f, poolName, currentNtol, hostName, targetNtol);
}
if (new ThreeButtonDialog(
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(SystemIcons.Warning, msg, Messages.HIGH_AVAILABILITY),
ThreeButtonDialog.ButtonYes,
new ThreeButtonDialog.TBDButton(Messages.NO_BUTTON_CAPTION, DialogResult.No, ThreeButtonDialog.ButtonType.CANCEL, true)
).ShowDialog(Program.MainWindow) == DialogResult.No)
))
{
if (dlg.ShowDialog(Program.MainWindow) == DialogResult.No)
{
cancel = true;
}
}
});
return cancel;

View File

@ -106,7 +106,10 @@ namespace XenAdmin.Commands
string text = String.Format(Messages.HOST_ALREADY_IN_POOL, hostToAdd.Name, _pool.Name, hostPool.Name);
string caption = Messages.POOL_JOIN_IMPOSSIBLE;
new ThreeButtonDialog(new ThreeButtonDialog.Details(SystemIcons.Exclamation, text, caption)).ShowDialog(Program.MainWindow);
using (var dlg = new ThreeButtonDialog(new ThreeButtonDialog.Details(SystemIcons.Exclamation, text, caption)))
{
dlg.ShowDialog(Program.MainWindow);
}
}
else
{

View File

@ -80,11 +80,14 @@ namespace XenAdmin.Commands
}
else
{
new ThreeButtonDialog(
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Error,
FriendlyErrorNames.VBDS_MAX_ALLOWED,
Messages.DISK_ADD)).ShowDialog(Program.MainWindow);
Messages.DISK_ADD)))
{
dlg.ShowDialog(Program.MainWindow);
}
}
}
else

View File

@ -72,8 +72,9 @@ namespace XenAdmin.Commands
protected override void ExecuteCore(SelectedItemCollection selection)
{
ApplyLicenseEditionAction action = new ApplyLicenseEditionAction(xos, _edition, _licenseServerAddress, _licenseServerPort, null);
ActionProgressDialog actionProgress = new ActionProgressDialog(action, ProgressBarStyle.Marquee);
using (var actionProgress = new ActionProgressDialog(action, ProgressBarStyle.Marquee))
{
//ActionProgressDialog closureDialog = actionProgress;
// close dialog even when there's an error as this action shows its own error dialog box.
action.Completed += s =>
{
@ -82,6 +83,7 @@ namespace XenAdmin.Commands
Failure f = action.Exception as Failure;
if (f != null && f.ErrorDescription[0] == Failure.RBAC_PERMISSION_DENIED_FRIENDLY)
return;
actionProgress.Close();
});
@ -98,6 +100,7 @@ namespace XenAdmin.Commands
InvokeSuccedded(null);
}
}
}
public static void ShowLicensingFailureDialog(List<LicenseFailure> licenseFailures, string exceptionMessage)
{
@ -111,10 +114,15 @@ namespace XenAdmin.Commands
if (licenseFailures.Count == 1)
{
Program.Invoke(Program.MainWindow, () => new ThreeButtonDialog(
new ThreeButtonDialog.Details(SystemIcons.Error, licenseFailures[0].AlertText,
Program.Invoke(Program.MainWindow, () =>
{
using (var dlg = new ThreeButtonDialog(new ThreeButtonDialog.Details(SystemIcons.Error, licenseFailures[0].AlertText,
Messages.LICENSE_ERROR_TITLE),
ThreeButtonDialog.ButtonOK).ShowDialog(parent));
ThreeButtonDialog.ButtonOK))
{
dlg.ShowDialog(parent);
}
});
}
else
{
@ -125,9 +133,13 @@ namespace XenAdmin.Commands
failureDic.Add(new SelectedItem(f.Host), f.AlertText);
}
Program.Invoke(Program.MainWindow, () => new CommandErrorDialog(
Messages.LICENSE_ERROR_TITLE, exceptionMessage,
failureDic).ShowDialog(parent));
Program.Invoke(Program.MainWindow, () =>
{
using (var dlg = new CommandErrorDialog(Messages.LICENSE_ERROR_TITLE, exceptionMessage, failureDic))
{
dlg.ShowDialog(parent);
}
});
}
}
}

View File

@ -69,11 +69,14 @@ namespace XenAdmin.Commands
if (vm.VBDs.Count >= vm.MaxVBDsAllowed)
{
new ThreeButtonDialog(
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Error,
FriendlyErrorNames.VBDS_MAX_ALLOWED,
Messages.DISK_ATTACH)).ShowDialog(Program.MainWindow);
Messages.DISK_ATTACH)))
{
dlg.ShowDialog(Program.MainWindow);
}
}
else
{

View File

@ -51,11 +51,16 @@ namespace XenAdmin.Commands
var action = (AsyncAction)sender;
if (action.Result == false.ToString())
MainWindowCommandInterface.Invoke(() =>
new ThreeButtonDialog(
{
using (var dlg =new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Information,
Messages.VIF_HOTPLUG_FAILED_MESSAGE,
Messages.VIF_HOTPLUG_FAILED_TITLE)).ShowDialog(Program.MainWindow));
Messages.VIF_HOTPLUG_FAILED_TITLE)))
{
dlg.ShowDialog(Program.MainWindow);
}
});
}
}
}

View File

@ -187,11 +187,15 @@ namespace XenAdmin.Commands
text = string.Format(VMGroup<T>.ChangeMultipleWarningString, groupName.Ellipsise(250));
}
return new ThreeButtonDialog(
DialogResult dialogResult;
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(SystemIcons.Warning, text, VMGroup<T>.ChangeVMsGroupString),
ThreeButtonDialog.ButtonYes,
ThreeButtonDialog.ButtonNo).
ShowDialog() == DialogResult.Yes;
ThreeButtonDialog.ButtonNo))
{
dialogResult = dlg.ShowDialog();
}
return dialogResult == DialogResult.Yes;
}
protected override void ExecuteCore(SelectedItemCollection selection)

View File

@ -65,11 +65,14 @@ namespace XenAdmin.Commands
if (failedConnections.Count > 0)
{
if (!Program.RunInAutomatedTestMode)
new ThreeButtonDialog(
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Error,
MessageBoxMessage(failedConnections),
Messages.PERMISSION_DENIED)).ShowDialog(Program.MainWindow);
Messages.PERMISSION_DENIED)))
{
dlg.ShowDialog(Program.MainWindow);
}
return false; // returning false stops the command from proceeding
}

View File

@ -93,8 +93,8 @@ namespace XenAdmin.Commands
public static void ShowUpsellDialog(IWin32Window parent)
{
UpsellDialog dlg = new UpsellDialog(HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_CPM : Messages.UPSELL_BLURB_CPM + Messages.UPSELL_BLURB_CPM_MORE,
InvisibleMessages.UPSELL_LEARNMOREURL_CPM);
using (var dlg = new UpsellDialog(HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_CPM : Messages.UPSELL_BLURB_CPM + Messages.UPSELL_BLURB_CPM_MORE,
InvisibleMessages.UPSELL_LEARNMOREURL_CPM))
dlg.ShowDialog(parent);
}

View File

@ -118,8 +118,8 @@ namespace XenAdmin.Commands
private static void ShowUpsellDialog(IWin32Window parent)
{
// Show upsell dialog
UpsellDialog dlg = new UpsellDialog(HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_DR : Messages.UPSELL_BLURB_DR + Messages.UPSELL_BLURB_DR_MORE,
InvisibleMessages.UPSELL_LEARNMOREURL_DR);
using (var dlg = new UpsellDialog(HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_DR : Messages.UPSELL_BLURB_DR + Messages.UPSELL_BLURB_DR_MORE,
InvisibleMessages.UPSELL_LEARNMOREURL_DR))
dlg.ShowDialog(parent);
}

View File

@ -94,8 +94,8 @@ namespace XenAdmin.Commands
public static void ShowUpsellDialog(IWin32Window parent)
{
// Show upsell dialog
UpsellDialog dlg = new UpsellDialog(HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_DR : Messages.UPSELL_BLURB_DR + Messages.UPSELL_BLURB_DR_MORE,
InvisibleMessages.UPSELL_LEARNMOREURL_DR);
using (var dlg = new UpsellDialog(HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_DR : Messages.UPSELL_BLURB_DR + Messages.UPSELL_BLURB_DR_MORE,
InvisibleMessages.UPSELL_LEARNMOREURL_DR))
dlg.ShowDialog(parent);
}

View File

@ -97,8 +97,8 @@ namespace XenAdmin.Commands
public static void ShowUpsellDialog(IWin32Window parent)
{
// Show upsell dialog
UpsellDialog dlg = new UpsellDialog(HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_DR : Messages.UPSELL_BLURB_DR + Messages.UPSELL_BLURB_DR_MORE,
InvisibleMessages.UPSELL_LEARNMOREURL_DR);
using (var dlg = new UpsellDialog(HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_DR : Messages.UPSELL_BLURB_DR + Messages.UPSELL_BLURB_DR_MORE,
InvisibleMessages.UPSELL_LEARNMOREURL_DR))
dlg.ShowDialog(parent);
}

View File

@ -94,8 +94,8 @@ namespace XenAdmin.Commands
public static void ShowUpsellDialog(IWin32Window parent)
{
// Show upsell dialog
UpsellDialog dlg = new UpsellDialog(HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_DR : Messages.UPSELL_BLURB_DR + Messages.UPSELL_BLURB_DR_MORE,
InvisibleMessages.UPSELL_LEARNMOREURL_DR);
using (var dlg = new UpsellDialog(HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_DR : Messages.UPSELL_BLURB_DR + Messages.UPSELL_BLURB_DR_MORE,
InvisibleMessages.UPSELL_LEARNMOREURL_DR))
dlg.ShowDialog(parent);
}

View File

@ -70,7 +70,10 @@ namespace XenAdmin.Commands
if (conn.Cache.HostCount > 1)
{
new ThreeButtonDialog(new ThreeButtonDialog.Details(SystemIcons.Exclamation, Messages.MESSAGEBOX_SLAVES_EJECT, Messages.XENCENTER)).ShowDialog(Program.MainWindow);
using (var dlg = new ThreeButtonDialog(new ThreeButtonDialog.Details(SystemIcons.Exclamation, Messages.MESSAGEBOX_SLAVES_EJECT, Messages.XENCENTER)))
{
dlg.ShowDialog(Program.MainWindow);
}
return;
}

View File

@ -92,41 +92,55 @@ namespace XenAdmin.Commands
Pool pool = Helpers.GetPool(network.Connection);
if (pool != null && pool.ha_enabled)
{
new ThreeButtonDialog(
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Error,
string.Format(Messages.BOND_DELETE_HA_ENABLED, pif.Name, pool.Name),
Messages.DELETE_BOND)).ShowDialog(Parent);
Messages.DELETE_BOND)))
{
dlg.ShowDialog(Parent);
}
return;
}
string message = string.Format(will_disturb_secondary ? Messages.BOND_DELETE_WILL_DISTURB_BOTH : Messages.BOND_DELETE_WILL_DISTURB_PRIMARY, msg);
if (DialogResult.OK !=
new ThreeButtonDialog(
DialogResult result;
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(SystemIcons.Warning, message, Messages.DELETE_BOND),
"NetworkingConfigWarning",
new ThreeButtonDialog.TBDButton(Messages.BOND_DELETE_CONTINUE, DialogResult.OK),
ThreeButtonDialog.ButtonCancel).ShowDialog(Parent))
ThreeButtonDialog.ButtonCancel))
{
return;
result = dlg.ShowDialog(Parent);
}
if (DialogResult.OK != result)
return;
}
else if (will_disturb_secondary)
{
if (DialogResult.OK !=
new ThreeButtonDialog(
DialogResult dialogResult;
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(SystemIcons.Warning, string.Format(Messages.BOND_DELETE_WILL_DISTURB_SECONDARY, msg), Messages.XENCENTER),
ThreeButtonDialog.ButtonOK,
ThreeButtonDialog.ButtonCancel).ShowDialog(Parent))
ThreeButtonDialog.ButtonCancel))
{
dialogResult = dlg.ShowDialog(Parent);
}
if (DialogResult.OK != dialogResult)
return;
}
else
{
if (DialogResult.OK !=
new ThreeButtonDialog(
DialogResult dialogResult;
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(SystemIcons.Warning, msg, Messages.XENCENTER),
new ThreeButtonDialog.TBDButton(Messages.OK, DialogResult.OK, ThreeButtonDialog.ButtonType.ACCEPT, true),
ThreeButtonDialog.ButtonCancel).ShowDialog(Program.MainWindow))
ThreeButtonDialog.ButtonCancel))
{
dialogResult = dlg.ShowDialog(Parent);
}
if (DialogResult.OK != dialogResult)
return;
}

View File

@ -91,8 +91,8 @@ namespace XenAdmin.Commands
public static void ShowUpsellDialog(IWin32Window parent)
{
// Show upsell dialog
UpsellDialog dlg = new UpsellDialog(HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_DR : Messages.UPSELL_BLURB_DR + Messages.UPSELL_BLURB_DR_MORE,
InvisibleMessages.UPSELL_LEARNMOREURL_DR);
using (var dlg = new UpsellDialog(HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_DR : Messages.UPSELL_BLURB_DR + Messages.UPSELL_BLURB_DR_MORE,
InvisibleMessages.UPSELL_LEARNMOREURL_DR))
dlg.ShowDialog(parent);
}

View File

@ -129,9 +129,11 @@ namespace XenAdmin.Commands
}
});
ActionProgressDialog pd = new ActionProgressDialog(waitForCancelAction, ProgressBarStyle.Marquee);
using (var pd = new ActionProgressDialog(waitForCancelAction, ProgressBarStyle.Marquee))
{
pd.ShowDialog(Parent);
}
}
else
{
return false;

View File

@ -63,8 +63,8 @@ namespace XenAdmin.Commands
if (Helpers.FeatureForbidden(selection[0].XenObject, Host.RestrictWLB))
{
// Show upsell dialog
UpsellDialog dlg = new UpsellDialog(HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_WLB : Messages.UPSELL_BLURB_WLB + Messages.UPSELL_BLURB_WLB_MORE,
InvisibleMessages.UPSELL_LEARNMOREURL_WLB);
using (var dlg = new UpsellDialog(HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_WLB : Messages.UPSELL_BLURB_WLB + Messages.UPSELL_BLURB_WLB_MORE,
InvisibleMessages.UPSELL_LEARNMOREURL_WLB))
dlg.ShowDialog(Parent);
return;
}

View File

@ -163,10 +163,12 @@ namespace XenAdmin.Commands
SR sr = cd.Connection.Resolve<SR>(vdi.SR);
if (sr != null && !sr.shared)
{
new ThreeButtonDialog(new ThreeButtonDialog.Details(SystemIcons.Exclamation,
using (var dlg = new ThreeButtonDialog(new ThreeButtonDialog.Details(SystemIcons.Exclamation,
Messages.DRAG_DROP_LOCAL_CD_LOADED,
Messages.DRAG_DROP_LOCAL_CD_LOADED_TITLE))
.ShowDialog(MainWindowCommandInterface.Form);
Messages.DRAG_DROP_LOCAL_CD_LOADED_TITLE)))
{
dlg.ShowDialog(MainWindowCommandInterface.Form);
}
return;
}
}

View File

@ -216,10 +216,12 @@ namespace XenAdmin.Commands
SR sr = cd.Connection.Resolve<SR>(vdi.SR);
if (sr != null && !sr.shared)
{
new ThreeButtonDialog(new ThreeButtonDialog.Details(SystemIcons.Exclamation,
using (var dlg = new ThreeButtonDialog(new ThreeButtonDialog.Details(SystemIcons.Exclamation,
Messages.DRAG_DROP_LOCAL_CD_LOADED,
Messages.DRAG_DROP_LOCAL_CD_LOADED_TITLE))
.ShowDialog(MainWindowCommandInterface.Form);
Messages.DRAG_DROP_LOCAL_CD_LOADED_TITLE)))
{
dlg.ShowDialog(MainWindowCommandInterface.Form);
}
return;
}
}

View File

@ -134,12 +134,16 @@ namespace XenAdmin.Commands
string msg = string.Format(Messages.CONFIRM_EXPORT_NOT_ENOUGH_MEMORY, Util.DiskSizeString((long)neededSpace),
Util.DiskSizeString((long)freeSpace), vm.Name);
DialogResult dr = new ThreeButtonDialog(
DialogResult dr;
using (var d = new ThreeButtonDialog(
new ThreeButtonDialog.Details(SystemIcons.Warning, msg),
"ExportVmDialogInsufficientDiskSpace",
new ThreeButtonDialog.TBDButton(Messages.CONTINUE_WITH_EXPORT, DialogResult.OK),
new ThreeButtonDialog.TBDButton(Messages.CHOOSE_ANOTHER_DESTINATION, DialogResult.Retry),
ThreeButtonDialog.ButtonCancel).ShowDialog(Parent);
ThreeButtonDialog.ButtonCancel))
{
dr = d.ShowDialog(Parent);
}
if (dr == DialogResult.Retry)
{
@ -155,12 +159,16 @@ namespace XenAdmin.Commands
string msg = string.Format(Messages.CONFIRM_EXPORT_FAT, Util.DiskSizeString((long)neededSpace),
Util.DiskSizeString(4 * Util.BINARY_GIGA), vm.Name);
DialogResult dr = new ThreeButtonDialog(
DialogResult dr;
using (var d = new ThreeButtonDialog(
new ThreeButtonDialog.Details(SystemIcons.Warning, msg),
"ExportVmDialogFSLimitExceeded",
new ThreeButtonDialog.TBDButton(Messages.CONTINUE_WITH_EXPORT, DialogResult.OK),
new ThreeButtonDialog.TBDButton(Messages.CHOOSE_ANOTHER_DESTINATION, DialogResult.Retry),
ThreeButtonDialog.ButtonCancel).ShowDialog(Parent);
ThreeButtonDialog.ButtonCancel))
{
dr = d.ShowDialog(Parent);
}
if (dr == DialogResult.Retry)
{

View File

@ -82,8 +82,8 @@ namespace XenAdmin.Commands
if (Helpers.FeatureForbidden(pool, Host.RestrictHA))
{
// Show upsell dialog
UpsellDialog dlg = new UpsellDialog(HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_HA : Messages.UPSELL_BLURB_HA + Messages.UPSELL_BLURB_HA_MORE,
InvisibleMessages.UPSELL_LEARNMOREURL_HA);
using (var dlg = new UpsellDialog(HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_HA : Messages.UPSELL_BLURB_HA + Messages.UPSELL_BLURB_HA_MORE,
InvisibleMessages.UPSELL_LEARNMOREURL_HA))
dlg.ShowDialog(Parent);
}
else if (pool.ha_enabled)

View File

@ -79,12 +79,15 @@ namespace XenAdmin.Commands
if (pool != null && pool.ha_enabled && host.IsMaster())
{
new ThreeButtonDialog(
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Error,
String.Format(Messages.HA_CANNOT_EVACUATE_MASTER,
Helpers.GetName(host).Ellipsise(Helpers.DEFAULT_NAME_TRIM_LENGTH)),
Messages.XENCENTER)).ShowDialog(Parent);
Messages.XENCENTER)))
{
dlg.ShowDialog(Parent);
}
}
else
{

View File

@ -116,11 +116,14 @@ namespace XenAdmin.Commands
{
log.ErrorFormat("Failed to import search from '{0}'", filename);
new ThreeButtonDialog(
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Error,
String.Format(Messages.UNABLE_TO_IMPORT_SEARCH, filename, Branding.Search),
Messages.XENCENTER)).ShowDialog(Parent);
Messages.XENCENTER)))
{
dlg.ShowDialog(Parent);
}
}
}
}

View File

@ -119,16 +119,24 @@ namespace XenAdmin.Commands
{
if (vm.FindVMCDROM() == null)
{
if (new ThreeButtonDialog(
DialogResult dialogResult;
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
null,
Messages.NEW_DVD_DRIVE_REQUIRED,
Messages.XENCENTER),
ThreeButtonDialog.ButtonYes,
ThreeButtonDialog.ButtonNo).ShowDialog(Parent) == DialogResult.Yes)
ThreeButtonDialog.ButtonNo))
{
dialogResult = dlg.ShowDialog(Parent);
}
if (dialogResult == DialogResult.Yes)
{
CreateCdDriveAction createDriveAction = new CreateCdDriveAction(vm, true,NewDiskDialog.ShowMustRebootBoxCD,NewDiskDialog.ShowVBDWarningBox);
new ActionProgressDialog(createDriveAction, ProgressBarStyle.Marquee).ShowDialog(Parent);
using (var dlg = new ActionProgressDialog(createDriveAction, ProgressBarStyle.Marquee))
{
dlg.ShowDialog(Parent);
}
if (createDriveAction.Succeeded)
{
@ -156,8 +164,11 @@ namespace XenAdmin.Commands
{
Program.Invoke(Program.MainWindow, delegate
{
new ThreeButtonDialog(
new ThreeButtonDialog.Details(SystemIcons.Error, Messages.XS_TOOLS_SR_NOT_FOUND, Messages.XENCENTER)).ShowDialog(Program.MainWindow);
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(SystemIcons.Error, Messages.XS_TOOLS_SR_NOT_FOUND, Messages.XENCENTER)))
{
dlg.ShowDialog(Program.MainWindow);
}
});
}
@ -180,16 +191,24 @@ namespace XenAdmin.Commands
if (newDvdDrivesRequired)
{
if (new ThreeButtonDialog(new ThreeButtonDialog.Details(SystemIcons.Warning, Messages.NEW_DVD_DRIVES_REQUIRED, Messages.XENCENTER),
DialogResult dialogResult;
using (var dlg = new ThreeButtonDialog(new ThreeButtonDialog.Details(SystemIcons.Warning, Messages.NEW_DVD_DRIVES_REQUIRED, Messages.XENCENTER),
ThreeButtonDialog.ButtonYes,
ThreeButtonDialog.ButtonNo).ShowDialog(Parent) == DialogResult.Yes)
ThreeButtonDialog.ButtonNo))
{
dialogResult = dlg.ShowDialog(Parent);
}
if (dialogResult == DialogResult.Yes)
{
foreach (VM vm in vms)
{
if (CanExecute(vm) && vm.FindVMCDROM() == null)
{
CreateCdDriveAction createDriveAction = new CreateCdDriveAction(vm, true,NewDiskDialog.ShowMustRebootBoxCD,NewDiskDialog.ShowVBDWarningBox);
new ActionProgressDialog(createDriveAction, ProgressBarStyle.Marquee).ShowDialog(Parent);
using (var dlg = new ActionProgressDialog(createDriveAction, ProgressBarStyle.Marquee))
{
dlg.ShowDialog(Parent);
}
}
}
ShowMustRebootBox();
@ -255,11 +274,14 @@ namespace XenAdmin.Commands
{
if (!MainWindowCommandInterface.RunInAutomatedTestMode)
{
new ThreeButtonDialog(
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Information,
Messages.NEW_DVD_DRIVE_REBOOT_TOOLS,
Messages.NEW_DVD_DRIVE_CREATED)).ShowDialog(Parent);
Messages.NEW_DVD_DRIVE_CREATED)))
{
dlg.ShowDialog(Parent);
}
}
}

View File

@ -85,8 +85,8 @@ namespace XenAdmin.Commands
public static void ShowUpsellDialog(IWin32Window parent)
{
UpsellDialog dlg = new UpsellDialog(HiddenFeatures.LinkLabelHidden ? Messages.MIGRATE_VDI_UPSELL_BLURB : Messages.MIGRATE_VDI_UPSELL_BLURB + Messages.MIGRATE_VDI_UPSELL_BLURB_MORE,
InvisibleMessages.UPSELL_LEARNMOREURL_CPM);
using (var dlg = new UpsellDialog(HiddenFeatures.LinkLabelHidden ? Messages.MIGRATE_VDI_UPSELL_BLURB : Messages.MIGRATE_VDI_UPSELL_BLURB + Messages.MIGRATE_VDI_UPSELL_BLURB_MORE,
InvisibleMessages.UPSELL_LEARNMOREURL_CPM))
dlg.ShowDialog(parent);
}

View File

@ -85,11 +85,14 @@ namespace XenAdmin.Commands
if (selection.Count == 1 && pool.master == host.opaque_ref)
{
// Trying to remove the master from a pool.
new ThreeButtonDialog(
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Error,
Messages.MESSAGEBOX_POOL_MASTER_REMOVE,
Messages.XENCENTER)).ShowDialog(MainWindowCommandInterface.Form);
Messages.XENCENTER)))
{
dlg.ShowDialog(MainWindowCommandInterface.Form);
}
return;
}
@ -175,11 +178,14 @@ namespace XenAdmin.Commands
{
MainWindowCommandInterface.Invoke(delegate
{
new ThreeButtonDialog(
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Exclamation,
string.Format(Messages.MESSAGEBOX_RECONNECT_FAIL, connection.Hostname),
Messages.MESSAGEBOX_RECONNECT_FAIL_TITLE)).ShowDialog(Parent);
Messages.MESSAGEBOX_RECONNECT_FAIL_TITLE)))
{
dlg.ShowDialog(Parent);
}
});
return;
}

View File

@ -77,11 +77,14 @@ namespace XenAdmin.Commands
if (srList.Find(s => !s.MultipathAOK) != null)
{
new ThreeButtonDialog(
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Warning,
Messages.MULTIPATH_FAILED,
Messages.MULTIPATHING)).ShowDialog(Parent);
Messages.MULTIPATHING)))
{
dlg.ShowDialog(Parent);
}
}
new RepairSRDialog(srList).Show(Parent);

View File

@ -153,11 +153,14 @@ namespace XenAdmin.Commands
MainWindowCommandInterface.Invoke(delegate
{
new ThreeButtonDialog(
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Information,
string.Format(Messages.RESTORE_FROM_BACKUP_FINALIZE, Helpers.GetName(action.Host)),
Messages.XENCENTER)).ShowDialog(Parent);
Messages.XENCENTER)))
{
dlg.ShowDialog(Parent);
}
});
}
}

View File

@ -101,11 +101,15 @@ namespace XenAdmin.Commands
}
if (brokenCDs.Count > 0)
{
DialogResult d = new ThreeButtonDialog(
DialogResult d;
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(null, Messages.EJECT_BEFORE_VM_START_MESSAGE_BOX, vms.Count > 1 ? Messages.STARTING_VMS_MESSAGEBOX_TITLE : Messages.STARTING_VM_MESSAGEBOX_TITLE),
new ThreeButtonDialog.TBDButton(Messages.EJECT_BUTTON_LABEL, DialogResult.OK, ThreeButtonDialog.ButtonType.ACCEPT, true),
new ThreeButtonDialog.TBDButton(Messages.IGNORE_BUTTON_LABEL, DialogResult.Ignore),
ThreeButtonDialog.ButtonCancel).ShowDialog(MainWindowCommandInterface.Form);
ThreeButtonDialog.ButtonCancel))
{
d = dlg.ShowDialog(MainWindowCommandInterface.Form);
}
if (d == DialogResult.Cancel)
return;
if (d == DialogResult.Ignore)

View File

@ -99,10 +99,12 @@ namespace XenAdmin.Commands
}
else
{
new ThreeButtonDialog(
new ThreeButtonDialog.Details(SystemIcons.Warning, Messages.TAKE_SNAPSHOT_ERROR, Messages.XENCENTER))
.ShowDialog(MainWindowCommandInterface.Form);
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(SystemIcons.Warning, Messages.TAKE_SNAPSHOT_ERROR,
Messages.XENCENTER)))
{
dlg.ShowDialog(MainWindowCommandInterface.Form);
}
}
}
return null;

View File

@ -84,7 +84,7 @@ namespace XenAdmin.Commands
public static void ShowUpsellDialog(IWin32Window parent)
{
UpsellDialog dlg = new UpsellDialog(VMGroup<T>.UpsellBlurb, VMGroup<T>.UpsellLearnMoreUrl);
using (var dlg = new UpsellDialog(VMGroup<T>.UpsellBlurb, VMGroup<T>.UpsellLearnMoreUrl))
dlg.ShowDialog(parent);
}

View File

@ -203,20 +203,18 @@ namespace XenAdmin.Commands
{
Program.Invoke(Program.MainWindow, () =>
{
if (
new ThreeButtonDialog(
DialogResult dialogResult;
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(SystemIcons.Warning,
String.Format(
isStart
? Messages.
HA_INVALID_CONFIG_START
: Messages.
HA_INVALID_CONFIG_RESUME,
String.Format(isStart ? Messages.HA_INVALID_CONFIG_START : Messages.HA_INVALID_CONFIG_RESUME,
Helpers.GetName(vm).Ellipsise(500)),
Messages.HIGH_AVAILABILITY),
ThreeButtonDialog.ButtonOK,
ThreeButtonDialog.ButtonCancel).ShowDialog(
Program.MainWindow) == DialogResult.Cancel)
ThreeButtonDialog.ButtonCancel))
{
dialogResult = dlg.ShowDialog(Program.MainWindow);
}
if (dialogResult == DialogResult.Cancel)
{
throw new CancelledException();
}
@ -304,7 +302,10 @@ namespace XenAdmin.Commands
Helpers.GetName(VMStartAction.VM).Ellipsise(100));
Program.Invoke(Program.MainWindow, delegate()
{
new ThreeButtonDialog(new ThreeButtonDialog.Details(SystemIcons.Warning, msg, Messages.HIGH_AVAILABILITY)).ShowDialog(Program.MainWindow);
using (var dlg = new ThreeButtonDialog(new ThreeButtonDialog.Details(SystemIcons.Warning, msg, Messages.HIGH_AVAILABILITY)))
{
dlg.ShowDialog(Program.MainWindow);
}
});
}
else
@ -316,10 +317,14 @@ namespace XenAdmin.Commands
Program.Invoke(Program.MainWindow, delegate()
{
DialogResult r = new ThreeButtonDialog(
DialogResult r;
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(SystemIcons.Warning, msg, Messages.HIGH_AVAILABILITY),
ThreeButtonDialog.ButtonYes,
new ThreeButtonDialog.TBDButton(Messages.NO_BUTTON_CAPTION, DialogResult.No, ThreeButtonDialog.ButtonType.CANCEL, true)).ShowDialog(Program.MainWindow);
new ThreeButtonDialog.TBDButton(Messages.NO_BUTTON_CAPTION, DialogResult.No, ThreeButtonDialog.ButtonType.CANCEL, true)))
{
r = dlg.ShowDialog(Program.MainWindow);
}
if (r == DialogResult.Yes)
{

View File

@ -186,7 +186,14 @@ namespace XenAdmin.Commands
public static bool VmCpuFeaturesIncompatibleWithHost(Host targetHost, VM vm)
{
// check the CPU feature compatibility for Dundee and higher hosts
if (!Helpers.DundeeOrGreater(targetHost) || !Helpers.DundeeOrGreater(vm.Connection))
if (!Helpers.DundeeOrGreater(targetHost))
return false;
Host home = vm.Home();
if (home != null && !Helpers.DundeeOrGreater(home))
return false;
if (home == null && !Helpers.DundeeOrGreater(vm.Connection))
return false;
// only for running or suspended VMs

View File

@ -84,8 +84,8 @@ namespace XenAdmin.Commands
if (Helpers.FeatureForbidden(selection[0].XenObject, Host.RestrictWLB))
{
// Show upsell dialog
UpsellDialog dlg = new UpsellDialog(HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_WLB : Messages.UPSELL_BLURB_WLB + Messages.UPSELL_BLURB_WLB_MORE,
InvisibleMessages.UPSELL_LEARNMOREURL_WLB);
using (var dlg = new UpsellDialog(HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_WLB : Messages.UPSELL_BLURB_WLB + Messages.UPSELL_BLURB_WLB_MORE,
InvisibleMessages.UPSELL_LEARNMOREURL_WLB))
dlg.ShowDialog(Parent);
return;
}

View File

@ -1200,12 +1200,16 @@ namespace XenAdmin.ConsoleView
if (CanEnableRDPOnCreamOrGreater(source.Connection))
{
ThreeButtonDialog d = new ThreeButtonDialog(
DialogResult dialogResult;
using (ThreeButtonDialog dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(System.Drawing.SystemIcons.Question, Messages.FORCE_ENABLE_RDP),
"EnableRDPonVM",
new ThreeButtonDialog.TBDButton(Messages.YES, DialogResult.Yes),
new ThreeButtonDialog.TBDButton(Messages.NO, DialogResult.No));
if (d.ShowDialog(Program.MainWindow) == DialogResult.Yes)
new ThreeButtonDialog.TBDButton(Messages.NO, DialogResult.No)))
{
dialogResult = dlg.ShowDialog(Program.MainWindow);
}
if (dialogResult == DialogResult.Yes)
{
Session session = source.Connection.DuplicateSession();
Dictionary<string, string> _arguments = new Dictionary<string, string>();
@ -1544,7 +1548,10 @@ namespace XenAdmin.ConsoleView
{
log.Error("Error starting PuTTY.", ex);
new ThreeButtonDialog(new ThreeButtonDialog.Details(SystemIcons.Error, Messages.ERROR_PUTTY_LAUNCHING, Messages.XENCENTER)).ShowDialog(Parent);
using (var dlg = new ThreeButtonDialog(new ThreeButtonDialog.Details(SystemIcons.Error, Messages.ERROR_PUTTY_LAUNCHING, Messages.XENCENTER)))
{
dlg.ShowDialog(Parent);
}
}
}
}

View File

@ -239,11 +239,14 @@ namespace XenAdmin.Controls
if (will_disturb_primary && will_disturb_secondary)
{
new ThreeButtonDialog(
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Error,
Messages.BOND_CREATE_WILL_DISTURB_BOTH,
Messages.BOND_CREATE)).ShowDialog(this);
Messages.BOND_CREATE)))
{
dlg.ShowDialog(this);
}
return DialogResult.Cancel;
}
@ -253,31 +256,44 @@ namespace XenAdmin.Controls
Pool pool = Helpers.GetPool(Connection);
if (pool != null && pool.ha_enabled)
{
new ThreeButtonDialog(
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Error,
string.Format(Messages.BOND_CREATE_HA_ENABLED, pool.Name),
Messages.BOND_CREATE)).ShowDialog(this);
Messages.BOND_CREATE)))
{
dlg.ShowDialog(this);
}
return DialogResult.Cancel;
}
return new ThreeButtonDialog(
DialogResult dialogResult;
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(SystemIcons.Warning, Messages.BOND_CREATE_WILL_DISTURB_PRIMARY, Messages.BOND_CREATE),
"BondConfigError",
new ThreeButtonDialog.TBDButton(Messages.BOND_CREATE_CONTINUE, DialogResult.OK),
ThreeButtonDialog.ButtonCancel).ShowDialog(this);
ThreeButtonDialog.ButtonCancel))
{
dialogResult = dlg.ShowDialog(this);
}
return dialogResult;
}
if (will_disturb_secondary)
{
return new ThreeButtonDialog(
DialogResult dialogResult;
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Warning,
Messages.BOND_CREATE_WILL_DISTURB_SECONDARY,
Messages.BOND_CREATE),
ThreeButtonDialog.ButtonOK,
ThreeButtonDialog.ButtonCancel).ShowDialog(this);
ThreeButtonDialog.ButtonCancel))
{
dialogResult = dlg.ShowDialog(this);
}
return dialogResult;
}
return DialogResult.OK;

View File

@ -74,12 +74,15 @@ namespace XenAdmin.Controls
}
catch (Exception)
{
new ThreeButtonDialog(
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Error,
string.Format(Messages.COULD_NOT_OPEN_URL,
LinkUri.AbsoluteUri),
Messages.XENCENTER)).ShowDialog(Program.MainWindow);
Messages.XENCENTER)))
{
dlg.ShowDialog(Program.MainWindow);
}
}
}

View File

@ -116,8 +116,8 @@ namespace XenAdmin.Controls.GPU
if (checkBox != null)
{
shinyBarsContainerPanel.Controls.Add(checkBox, 0, index);
checkBox.Dock = DockStyle.Fill;
checkBox.Margin = new Padding(3, 14, 0, 0);
checkBox.Dock = DockStyle.Top;
checkBox.Margin = new Padding(6, 32, 0, 0);
checkBox.CheckedChanged += CheckedChanged;
checkBox.Checked = true;
}

View File

@ -231,7 +231,8 @@ namespace XenAdmin.Controls
if (VM != null)
{
CreateCdDriveAction createDriveAction = new CreateCdDriveAction(VM, false,NewDiskDialog.ShowMustRebootBoxCD,NewDiskDialog.ShowVBDWarningBox);
new ActionProgressDialog(createDriveAction, ProgressBarStyle.Marquee).ShowDialog(this);
using (var dlg = new ActionProgressDialog(createDriveAction, ProgressBarStyle.Marquee))
dlg.ShowDialog(this);
}
}

View File

@ -478,11 +478,14 @@ namespace XenAdmin.Controls.NetworkingTab
if (NetworksGridView.Rows.Count >= vm.MaxVIFsAllowed)
{
new ThreeButtonDialog(
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Error,
FriendlyErrorNames.VIFS_MAX_ALLOWED,
FriendlyErrorNames.VIFS_MAX_ALLOWED_TITLE)).ShowDialog(Program.MainWindow);
FriendlyErrorNames.VIFS_MAX_ALLOWED_TITLE)))
{
dlg.ShowDialog(Program.MainWindow);
}
return;
}
@ -574,17 +577,23 @@ namespace XenAdmin.Controls.NetworkingTab
else if (XenObject is VM)
{
// Deleting a VIF, not a Network.
result = new ThreeButtonDialog(
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(SystemIcons.Warning, Messages.MESSAGEBOX_VIF_DELETE, Messages.MESSAGEBOX_VIF_DELETE_TITLE),
ThreeButtonDialog.ButtonYes,
ThreeButtonDialog.ButtonNo).ShowDialog(Program.MainWindow);
ThreeButtonDialog.ButtonNo))
{
result = dlg.ShowDialog(Program.MainWindow);
}
}
else
{
result = new ThreeButtonDialog(
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(SystemIcons.Warning, Messages.MESSAGEBOX_NETWORK_DELETE, Messages.MESSAGEBOX_NETWORK_DELETE_TITLE),
ThreeButtonDialog.ButtonYes,
ThreeButtonDialog.ButtonNo).ShowDialog(Program.MainWindow);
ThreeButtonDialog.ButtonNo))
{
result = dlg.ShowDialog(Program.MainWindow);
}
}
if (result == DialogResult.Yes)

View File

@ -51,8 +51,8 @@ namespace XenAdmin.Controls
private Host affinity;
private SrPickerItem LastSelectedItem;
public event EventHandler ItemSelectionNull;
public event EventHandler ItemSelectionNotNull;
public event Action ItemSelectionNull;
public event Action ItemSelectionNotNull;
public event EventHandler DoubleClickOnRow;
public long DiskSize = 0;
public long? OverridenInitialAllocationRate = null;
@ -167,13 +167,12 @@ namespace XenAdmin.Controls
if (item == null || !item.Enabled)
{
if (ItemSelectionNull != null)
ItemSelectionNull(null, null);
ItemSelectionNull();
return;
}
else if (ItemSelectionNotNull != null)
{
ItemSelectionNotNull(null, null);
}
if (ItemSelectionNotNull != null)
ItemSelectionNotNull();
if (!item.Enabled && LastSelectedItem != null && LastSelectedItem.TheSR.opaque_ref != item.TheSR.opaque_ref)
srListBox.SelectedItem = LastSelectedItem;
@ -369,7 +368,7 @@ namespace XenAdmin.Controls
}
if (ItemSelectionNull != null)
ItemSelectionNull(null, null);
ItemSelectionNull();
}
internal void selectDefaultSROrAny()
@ -387,7 +386,7 @@ namespace XenAdmin.Controls
}
}
if (ItemSelectionNull != null)
ItemSelectionNull(null, null);
ItemSelectionNull();
}
public void selectSRorDefaultorAny(SR sr)

View File

@ -282,11 +282,14 @@ namespace XenAdmin.Controls.Wlb
WlbScheduledTask checkTask = CheckForDuplicateTask(newTask);
if (null != checkTask)
{
new ThreeButtonDialog(
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Warning,
Messages.WLB_TASK_SCHEDULE_CONFLICT_BLURB,
Messages.WLB_TASK_SCHEDULE_CONFLICT_TITLE)).ShowDialog(this);
Messages.WLB_TASK_SCHEDULE_CONFLICT_TITLE)))
{
dlg.ShowDialog(this);
}
SelectTask(checkTask.TaskId);
}
else
@ -308,11 +311,14 @@ namespace XenAdmin.Controls.Wlb
WlbScheduledTask checkTask = CheckForDuplicateTask(editTask);
if (null != checkTask)
{
new ThreeButtonDialog(
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Warning,
Messages.WLB_TASK_SCHEDULE_CONFLICT_BLURB,
Messages.WLB_TASK_SCHEDULE_CONFLICT_TITLE)).ShowDialog(this);
Messages.WLB_TASK_SCHEDULE_CONFLICT_TITLE)))
{
dlg.ShowDialog(this);
}
SelectTask(checkTask.TaskId);
}
else
@ -375,11 +381,14 @@ namespace XenAdmin.Controls.Wlb
//if it's a duplicate task, display warning and return
if (null != checkTask)
{
new ThreeButtonDialog(
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Warning,
Messages.WLB_TASK_SCHEDULE_CONFLICT_BLURB,
Messages.WLB_TASK_SCHEDULE_CONFLICT_TITLE)).ShowDialog(this);
Messages.WLB_TASK_SCHEDULE_CONFLICT_TITLE)))
{
dlg.ShowDialog(this);
}
SelectTask(checkTask.TaskId);
return;
}
@ -645,12 +654,26 @@ namespace XenAdmin.Controls.Wlb
private void buttonDelete_Click(object sender, EventArgs e)
{
if (lvTaskList.SelectedItems.Count > 0)
{
DialogResult confirmResult;
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(SystemIcons.Warning,
Messages.DELETE_WLB_OPTIMIZATION_SCHEDULE_WARNING,
Messages.DELETE_WLB_OPTIMIZATION_SCHEDULE_CAPTION),
ThreeButtonDialog.ButtonYes,
ThreeButtonDialog.ButtonNo))
{
confirmResult = dlg.ShowDialog(this);
}
if (confirmResult == DialogResult.Yes)
{
WlbScheduledTask task = TaskFromItem(lvTaskList.SelectedItems[0]);
DeleteTask(task);
}
weekView1.Refresh();
}
}
}
private void lvTaskList_SelectedIndexChanged(object sender, EventArgs e)
{

View File

@ -199,9 +199,11 @@ namespace XenAdmin.Controls.Wlb
private void DeleteReportSubscription(object sender, EventArgs e)
{
SendWlbConfigurationAction action = new SendWlbConfigurationAction(_pool, this._subscription.ToDictionary(), SendWlbConfigurationKind.DeleteReportSubscription);
ActionProgressDialog dialog = new ActionProgressDialog(action, ProgressBarStyle.Blocks);
using (var dialog = new ActionProgressDialog(action, ProgressBarStyle.Blocks))
{
dialog.ShowCancel = true;
dialog.ShowDialog(this);
}
if (action.Succeeded)
{

View File

@ -469,11 +469,14 @@ namespace XenAdmin.Controls.Wlb
}
else if (StartDatePicker.Value.CompareTo(EndDatePicker.Value) > 0)
{
new ThreeButtonDialog(
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Warning,
Messages.WLB_REPORT_DATE_ORDERING_MESSAGE,
Messages.WLB_REPORT_DATE_ORDERING_CAPTION)).ShowDialog(this);
Messages.WLB_REPORT_DATE_ORDERING_CAPTION)))
{
dlg.ShowDialog(this);
}
}
else
{
@ -499,12 +502,14 @@ namespace XenAdmin.Controls.Wlb
catch (Exception ex)
{
log.Debug(ex, ex);
new ThreeButtonDialog(
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Error,
ex.Message,
Messages.XENCENTER)).ShowDialog(this);
return;
Messages.XENCENTER)))
{
dlg.ShowDialog(this);
}
}
}
@ -985,7 +990,8 @@ namespace XenAdmin.Controls.Wlb
_reportInfo.ReportName,
false,
parms);
new ActionProgressDialog(a, ProgressBarStyle.Marquee).ShowDialog();
using (var dlg = new ActionProgressDialog(a, ProgressBarStyle.Marquee))
dlg.ShowDialog();
if (a.Succeeded)
{
@ -1463,7 +1469,8 @@ namespace XenAdmin.Controls.Wlb
//and run our own code to export
ExportReportAction action = new ExportReportAction(e.Extension.Name, ref reportViewer1);
new ActionProgressDialog(action, ProgressBarStyle.Marquee).ShowDialog();
using (var dlg = new ActionProgressDialog(action, ProgressBarStyle.Marquee))
dlg.ShowDialog();
//ReportExporterDelgate exp = new ReportExporterDelgate(RunExportReport);
@ -1504,16 +1511,22 @@ namespace XenAdmin.Controls.Wlb
catch (Exception ex)
{
log.Debug(ex, ex);
new ThreeButtonDialog(
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Error,
ex.Message,
Messages.XENCENTER)).ShowDialog(this);
Messages.XENCENTER)))
{
dlg.ShowDialog(this);
}
}
finally
{
if (fs != null)
{
fs.Close();
fs.Dispose();
}
}
}

View File

@ -112,13 +112,17 @@ namespace XenAdmin.Core
else
msg = string.Format(msg_multiple, string.Join("\n", itemsToFixup.ConvertAll(item => item.ToString()).ToArray()));
ThreeButtonDialog dlg = new ThreeButtonDialog(
DialogResult dialogResult;
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(icon ?? SystemIcons.Exclamation, msg),
helpName,
new ThreeButtonDialog.TBDButton(Messages.PROCEED, DialogResult.Yes),
new ThreeButtonDialog.TBDButton(Messages.CANCEL, DialogResult.No));
new ThreeButtonDialog.TBDButton(Messages.CANCEL, DialogResult.No)))
{
dialogResult = dlg.ShowDialog(Program.MainWindow);
}
return DialogResult.Yes == dlg.ShowDialog(Program.MainWindow);
return DialogResult.Yes == dialogResult;
}
return true;
}

View File

@ -52,20 +52,45 @@ namespace XenAdmin.Diagnostics.Checks
{
}
protected Problem CheckHost()
protected List<Problem> CheckHost()
{
var problems = new List<Problem>();
var restrictMigration = Helpers.FeatureForbidden(Host.Connection, Host.RestrictIntraPoolMigrate);
var VMsWithProblems = new List<string>();
var residentVMs = Host.Connection.ResolveAll(Host.resident_VMs);
foreach (var residentVM in residentVMs)
{
if (residentVM.AutoPowerOn)
return new AutoStartEnabled(this, residentVM);
{
problems.Add(new AutoStartEnabled(this, residentVM));
VMsWithProblems.Add(residentVM.opaque_ref);
continue;
}
SR sr = residentVM.FindVMCDROMSR();
if (sr != null && sr.IsToolsSR)
return new ToolsCD(this, residentVM);
if (sr != null && sr.content_type == SR.Content_Type_ISO)
return new LocalCD(this, residentVM);
{
problems.Add(new ToolsCD(this, residentVM));
VMsWithProblems.Add(residentVM.opaque_ref);
}
else if (sr != null && sr.content_type == SR.Content_Type_ISO)
{
problems.Add(new LocalCD(this, residentVM));
VMsWithProblems.Add(residentVM.opaque_ref);
}
if (restrictMigration && residentVM.is_a_real_vm && !VMsWithProblems.Contains(residentVM.opaque_ref))
{
problems.Add(new CannotMigrateVM(this, residentVM, true));
VMsWithProblems.Add(residentVM.opaque_ref);
}
}
// if VM migration is restricted, then we are already forcing all VMs to be shutdown/suspended, so there is not need to call get_vms_which_prevent_evacuation
if (restrictMigration)
return problems;
Session session = Host.Connection.DuplicateSession();
Dictionary<XenRef<VM>, String[]> vms =
@ -76,11 +101,14 @@ namespace XenAdmin.Diagnostics.Checks
String[] exception = kvp.Value;
XenRef<VM> vmRef = kvp.Key;
if (VMsWithProblems.Contains(vmRef))
continue;
try
{
// We can actually ignore some errors, indicated by null
return GetProblem(Host.Connection, vmRef, exception);
Problem p = GetProblem(Host.Connection, vmRef, exception);
if (p != null)
problems.Add(p);
}
catch (Exception e)
{
@ -91,10 +119,11 @@ namespace XenAdmin.Diagnostics.Checks
VM vm = Host.Connection.Resolve(kvp.Key);
if (vm != null)
return new CannotMigrateVM(this, vm);
problems.Add(new CannotMigrateVM(this, vm));
}
}
return null;
return problems;
}
private Problem GetProblem(IXenConnection connection, XenRef<VM> vmRef, string[] exception)
@ -209,7 +238,10 @@ namespace XenAdmin.Diagnostics.Checks
}
}
public override Problem RunCheck()
// This function only tests certain host-wide conditions.
// Further per-VM conditions are in CheckHost().
// See RunAllChecks() for how we combine them.
protected override Problem RunCheck()
{
if (!Host.IsLive)
return new HostNotLiveWarning(this, Host);
@ -223,6 +255,16 @@ namespace XenAdmin.Diagnostics.Checks
if (Helpers.WlbEnabled(pool.Connection))
return new WLBEnabledWarning(this, pool, Host);
}
return null;
}
public override List<Problem> RunAllChecks()
{
var list = base.RunAllChecks();
if (list.Count > 0)
return list;
else
return CheckHost();
}

View File

@ -47,7 +47,7 @@ namespace XenAdmin.Diagnostics.Checks
{
}
public override Problem RunCheck()
protected override Problem RunCheck()
{
if (!Host.IsLive)
return new HostNotLiveWarning(this, Host);

View File

@ -29,6 +29,7 @@
* SUCH DAMAGE.
*/
using System.Collections.Generic;
using XenAPI;
using XenAdmin.Diagnostics.Problems;
@ -41,7 +42,18 @@ namespace XenAdmin.Diagnostics.Checks
_host = host;
}
public abstract Problem RunCheck();
protected abstract Problem RunCheck();
// By default, most Checks return zero or one Problems: but a
// Check can override this to return multiple Problems
public virtual List<Problem> RunAllChecks()
{
var list = new List<Problem>(1);
var problem = RunCheck();
if (problem != null)
list.Add(problem);
return list;
}
public abstract string Description{ get;}

View File

@ -95,7 +95,7 @@ namespace XenAdmin.Diagnostics.Checks.DR
return srDeviceConfigList;
}
public override Problem RunCheck()
protected override Problem RunCheck()
{
if (MetadataSession == null)
return null;

View File

@ -44,7 +44,7 @@ namespace XenAdmin.Diagnostics.Checks.DR
{
}
public override Problem RunCheck()
protected override Problem RunCheck()
{
if (Pool == null)
return null;

View File

@ -56,7 +56,7 @@ namespace XenAdmin.Diagnostics.Checks.DR
vmsToRecover = vms;
}
public override Problem RunCheck()
protected override Problem RunCheck()
{
if (applianceToRecover != null)
{

View File

@ -51,7 +51,7 @@ namespace XenAdmin.Diagnostics.Checks.DR
Vm = vm;
}
public override Problem RunCheck()
protected override Problem RunCheck()
{
foreach (VM existingVm in Pool.Connection.Cache.VMs)
{

View File

@ -55,7 +55,7 @@ namespace XenAdmin.Diagnostics.Checks.DR
this.vmAppliance = vmAppliance;
}
public override Problem RunCheck()
protected override Problem RunCheck()
{
if (vmAppliance != null)
{

View File

@ -55,7 +55,7 @@ namespace XenAdmin.Diagnostics.Checks.DR
Vm = vm;
}
public override Problem RunCheck()
protected override Problem RunCheck()
{
foreach (VM existingVm in Pool.Connection.Cache.VMs)
{

View File

@ -46,7 +46,7 @@ namespace XenAdmin.Diagnostics.Checks
{
}
public override Problem RunCheck()
protected override Problem RunCheck()
{
if (!Host.IsLive)
return new HostNotLiveWarning(this, Host);

View File

@ -47,7 +47,7 @@ namespace XenAdmin.Diagnostics.Checks
{
}
public override Problem RunCheck()
protected override Problem RunCheck()
{
if (!Host.IsLive)
return new HostNotLiveWarning(this, Host);

View File

@ -46,7 +46,7 @@ namespace XenAdmin.Diagnostics.Checks
{
}
public override Problem RunCheck()
protected override Problem RunCheck()
{
if (!Host.IsLive)
return new HostNotLiveWarning(this, Host);

View File

@ -43,7 +43,7 @@ namespace XenAdmin.Diagnostics.Checks
{
}
public override Problem RunCheck()
protected override Problem RunCheck()
{
bool mayHaveWssVm = Host.Connection.ResolveAll(Host.resident_VMs).Any(vm =>vm != null && vm.CouldBeWss);
bool mayHaveWssVdis = Host.Connection.Cache.VDIs.Any(vdi=>vdi != null && vdi.CouldBeWss);

View File

@ -42,7 +42,7 @@ namespace XenAdmin.Diagnostics.Checks
{
}
public override Problem RunCheck()
protected override Problem RunCheck()
{
if (!Host.IsLive)
{

View File

@ -41,7 +41,7 @@ namespace XenAdmin.Diagnostics.Checks
{
}
public override Problem RunCheck()
protected override Problem RunCheck()
{
if (!Host.IsLive)
{

View File

@ -40,15 +40,11 @@ namespace XenAdmin.Diagnostics.Checks
{
public class PBDsPluggedCheck : Check
{
public PBDsPluggedCheck(Host host):base(host)
{
}
public override Problem RunCheck()
protected override Problem RunCheck()
{
if (!Host.IsLive)
return new HostNotLiveWarning(this, Host);

View File

@ -50,7 +50,6 @@ namespace XenAdmin.Diagnostics.Checks
private static Regex PrecheckErrorRegex = new Regex("(<error).+(</error>)");
public PatchPrecheckCheck(Host host, Pool_patch patch)
: base(host)
{
@ -58,7 +57,7 @@ namespace XenAdmin.Diagnostics.Checks
}
public override Problem RunCheck()
protected override Problem RunCheck()
{
if (!Host.IsLive)
return new HostNotLiveWarning(this, Host);

View File

@ -47,7 +47,7 @@ namespace XenAdmin.Diagnostics.Checks
{
}
public override Problem RunCheck()
protected override Problem RunCheck()
{
try
{

View File

@ -43,7 +43,7 @@ namespace XenAdmin.Diagnostics.Checks
{
}
public override Problem RunCheck()
protected override Problem RunCheck()
{
bool licenseStatus = !Host.IsFreeLicense() || Host.InGrace;
return !Helpers.ClearwaterOrGreater(Host) && licenseStatus ? new UpgradingFromTampaAndOlderWarning(this, Host) : null;

View File

@ -43,7 +43,7 @@ namespace XenAdmin.Diagnostics.Checks
{
}
public override Problem RunCheck()
protected override Problem RunCheck()
{
return Host.Connection.Cache.VMPPs.Count() > 0 ? new VmprActivatedWarning(this, Host) : null;
}

View File

@ -55,9 +55,11 @@ namespace XenAdmin.Diagnostics.Problems.HostProblem
{
Program.Invoke(Program.MainWindow, delegate()
{
new ThreeButtonDialog(
new ThreeButtonDialog.Details(SystemIcons.Warning, Message))
.ShowDialog();
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(SystemIcons.Warning, Message)))
{
dlg.ShowDialog();
}
});
cancelled = true;

View File

@ -74,28 +74,30 @@ namespace XenAdmin.Diagnostics.Problems.HostProblem
{
Program.Invoke(Program.MainWindow, delegate()
{
DialogResult r = new ThreeButtonDialog(
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Warning,
diskSpaceReq.GetSpaceRequirementsMessage()),
new ThreeButtonDialog.TBDButton(Messages.YES, DialogResult.Yes, ThreeButtonDialog.ButtonType.ACCEPT, true),
ThreeButtonDialog.ButtonNo
).ShowDialog();
ThreeButtonDialog.ButtonNo))
{
DialogResult r = dlg.ShowDialog();
if (r == DialogResult.Yes)
{
action = new CleanupDiskSpaceAction(this.Server, patch, true);
}
}
});
}
else
{
Program.Invoke(Program.MainWindow, delegate()
{
new ThreeButtonDialog(
new ThreeButtonDialog.Details(SystemIcons.Warning, diskSpaceReq.GetSpaceRequirementsMessage()))
.ShowDialog();
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(SystemIcons.Warning, diskSpaceReq.GetSpaceRequirementsMessage())))
{
dlg.ShowDialog();
}
});
}
cancelled = action == null;

View File

@ -58,7 +58,8 @@ namespace XenAdmin.Diagnostics.Problems.HostProblem
protected override AsyncAction CreateAction(out bool cancelled)
{
SelectVMsToSuspendDialog dlg = new SelectVMsToSuspendDialog(Server);
using (var dlg = new SelectVMsToSuspendDialog(Server))
{
if (dlg.ShowDialog() == DialogResult.OK)
{
cancelled = false;
@ -68,6 +69,7 @@ namespace XenAdmin.Diagnostics.Problems.HostProblem
return new SuspendAndShutdownVMsAction(Server.Connection, Server, VmsToSuspend, VmsToShutdown);
}
}
cancelled = true;
return null;

View File

@ -64,12 +64,15 @@ namespace XenAdmin.Diagnostics.Problems
}
catch (Exception)
{
new ThreeButtonDialog(
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Error,
string.Format(Messages.COULD_NOT_OPEN_URL,
UriToLaunch.AbsoluteUri),
Messages.XENCENTER)).ShowDialog(Program.MainWindow);
UriToLaunch != null ? UriToLaunch.AbsoluteUri : string.Empty),
Messages.XENCENTER)))
{
dlg.ShowDialog(Program.MainWindow);
}
}
}
}

View File

@ -38,12 +38,22 @@ namespace XenAdmin.Diagnostics.Problems.VMProblem
{
public class CannotMigrateVM : VMProblem
{
public CannotMigrateVM(Check check, VM vm)
: base(check, vm) { }
private readonly bool licenseRestriction;
public CannotMigrateVM(Check check, VM vm, bool licenseRestriction = false)
: base(check, vm)
{
this.licenseRestriction = licenseRestriction;
}
public override string Description
{
get { return String.Format(Messages.UPDATES_WIZARD_CANNOT_MIGRATE_VM_UNKNOWN_REASON, VM.Name); }
get
{
return String.Format(licenseRestriction
? Messages.UPDATES_WIZARD_CANNOT_MIGRATE_VM_LICENSE_REASON
: Messages.UPDATES_WIZARD_CANNOT_MIGRATE_VM_UNKNOWN_REASON, VM.Name);
}
}
}
}

View File

@ -67,10 +67,15 @@ namespace XenAdmin.Diagnostics.Problems.VMProblem
{
Program.AssertOnEventThread();
if (new ThreeButtonDialog(
DialogResult dialogResult;
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(SystemIcons.Warning, String.Format(Messages.CONFIRM_DELETE_VM, VM.Name, VM.Connection.Name), Messages.ACTION_SHUTDOWN_AND_DESTROY_VM_TITLE),
ThreeButtonDialog.ButtonYes,
ThreeButtonDialog.ButtonNo).ShowDialog() == DialogResult.Yes)
ThreeButtonDialog.ButtonNo))
{
dialogResult = dlg.ShowDialog();
}
if (dialogResult == DialogResult.Yes)
{
cancelled = false;
List<VM> vms = new List<VM> { VM };

View File

@ -71,10 +71,15 @@ namespace XenAdmin.Diagnostics.Problems.VmApplianceProblem
Program.AssertOnEventThread();
string vmNames = string.Join(",", (from vm in vmsToDestroy select vm.Name).ToArray());
if (new ThreeButtonDialog(
DialogResult dialogResult;
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(SystemIcons.Warning, String.Format(Messages.CONFIRM_DELETE_VMS, vmNames, vmsToDestroy[0].Connection.Name), Messages.ACTION_SHUTDOWN_AND_DESTROY_VMS_TITLE),
ThreeButtonDialog.ButtonYes,
ThreeButtonDialog.ButtonNo).ShowDialog() == DialogResult.Yes)
ThreeButtonDialog.ButtonNo))
{
dialogResult = dlg.ShowDialog();
}
if (dialogResult == DialogResult.Yes)
{
cancelled = false;
return new ShutdownAndDestroyVMsAction(vmsToDestroy[0].Connection, vmsToDestroy);

View File

@ -59,12 +59,15 @@ namespace XenAdmin.Diagnostics.Problems
}
catch (Exception)
{
new ThreeButtonDialog(
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Error,
string.Format(Messages.COULD_NOT_OPEN_URL,
UriToLaunch.AbsoluteUri),
Messages.XENCENTER)).ShowDialog(Program.MainWindow);
UriToLaunch != null ? UriToLaunch.AbsoluteUri : string.Empty),
Messages.XENCENTER)))
{
dlg.ShowDialog(Program.MainWindow);
}
}
}
}

View File

@ -463,7 +463,7 @@
<value>GrowAndShrink</value>
</data>
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>423, 216</value>
<value>423, 321</value>
</data>
<data name="$this.Font" type="System.Drawing.Font, System.Drawing">
<value>Tahoma, 8pt</value>

View File

@ -463,7 +463,7 @@
<value>GrowAndShrink</value>
</data>
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>423, 216</value>
<value>423, 321</value>
</data>
<data name="$this.Font" type="System.Drawing.Font, System.Drawing">
<value>Tahoma, 8pt</value>

View File

@ -220,10 +220,13 @@ namespace XenAdmin.Dialogs
{
Program.Invoke(Program.MainWindow, delegate()
{
new ThreeButtonDialog(
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Error,
FriendlyErrorNames.VBDS_MAX_ALLOWED, Messages.DISK_ATTACH)).ShowDialog(Program.MainWindow);
FriendlyErrorNames.VBDS_MAX_ALLOWED, Messages.DISK_ATTACH)))
{
dlg.ShowDialog(Program.MainWindow);
}
});
// Give up
return;

View File

@ -118,10 +118,16 @@ namespace XenAdmin.Dialogs
msg = (VMs.Count == 1 ? Messages.CONFIRM_CHANGE_MEMORY_MAX_SINGULAR : Messages.CONFIRM_CHANGE_MEMORY_MAX_PLURAL);
else
msg = (VMs.Count == 1 ? Messages.CONFIRM_CHANGE_MEMORY_SINGULAR : Messages.CONFIRM_CHANGE_MEMORY_PLURAL);
if (DialogResult.Yes != new ThreeButtonDialog(
DialogResult dialogResult;
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(SystemIcons.Warning, msg, Messages.XENCENTER),
ThreeButtonDialog.ButtonYes,
ThreeButtonDialog.ButtonNo).ShowDialog(parentWindow))
ThreeButtonDialog.ButtonNo))
{
dialogResult = dlg.ShowDialog(parentWindow);
}
if (DialogResult.Yes != dialogResult)
return null;
break;
}

View File

@ -90,8 +90,12 @@ namespace XenAdmin.Dialogs
{
fired = true;
Program.Invoke(Program.MainWindow, () =>
new ThreeButtonDialog( new ThreeButtonDialog.Details( SystemIcons.Error, DisplayMessage, Messages.XENCENTER),
new ThreeButtonDialog.TBDButton(Messages.OK, DialogResult.OK)).ShowDialog(Program.MainWindow));
{ using (var dlg = new ThreeButtonDialog( new ThreeButtonDialog.Details( SystemIcons.Error, DisplayMessage, Messages.XENCENTER),
new ThreeButtonDialog.TBDButton(Messages.OK, DialogResult.OK)))
{
dlg.ShowDialog(Program.MainWindow);
}
});
}
}
}

View File

@ -60,8 +60,8 @@ namespace XenAdmin.Dialogs
IsRealVm = !vm.is_a_template;
TheVM = vm;
srPicker1.Usage = SrPicker.SRPickerType.MoveOrCopy;
srPicker1.ItemSelectionNotNull += new EventHandler(srPicker1_ItemSelectionNotNull);
srPicker1.ItemSelectionNull += new EventHandler(srPicker1_ItemSelectionNull);
srPicker1.ItemSelectionNotNull += srPicker1_ItemSelectionNotNull;
srPicker1.ItemSelectionNull += srPicker1_ItemSelectionNull;
Host affinity = TheVM.Home();
srPicker1.Connection = TheVM.Connection;
srPicker1.DiskSize = vm.TotalVMSize;
@ -104,12 +104,12 @@ namespace XenAdmin.Dialogs
srPicker1.selectDefaultSROrAny();
}
private void srPicker1_ItemSelectionNull(object sender, EventArgs e)
private void srPicker1_ItemSelectionNull()
{
EnableMoveButton();
}
private void srPicker1_ItemSelectionNotNull(object sender, EventArgs e)
private void srPicker1_ItemSelectionNotNull()
{
EnableMoveButton();
}

View File

@ -157,11 +157,14 @@ namespace XenAdmin.Dialogs
{
Program.Invoke(this, delegate()
{
new ThreeButtonDialog(
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Exclamation,
String.Format(Messages.HA_WAS_DISABLED, pool.Name),
Messages.HIGH_AVAILABILITY)).ShowDialog(this);
Messages.HIGH_AVAILABILITY)))
{
dlg.ShowDialog(this);
}
this.Close();
});
}
@ -179,10 +182,15 @@ namespace XenAdmin.Dialogs
long newNtol = assignPriorities.Ntol;
// User has configured ntol to be zero. Check this is what they want (since it is practically useless).
if (newNtol == 0 && new ThreeButtonDialog(
DialogResult dialogResult;
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(SystemIcons.Warning, Messages.HA_NTOL_ZERO_QUERY, Messages.HIGH_AVAILABILITY),
ThreeButtonDialog.ButtonYes,
new ThreeButtonDialog.TBDButton(Messages.NO_BUTTON_CAPTION, DialogResult.No, ThreeButtonDialog.ButtonType.CANCEL, true)).ShowDialog(this) == DialogResult.No)
new ThreeButtonDialog.TBDButton(Messages.NO_BUTTON_CAPTION, DialogResult.No, ThreeButtonDialog.ButtonType.CANCEL, true)))
{
dialogResult = dlg.ShowDialog(this);
}
if (newNtol == 0 && dialogResult == DialogResult.No)
{
return;
}

View File

@ -320,7 +320,8 @@ namespace XenAdmin.Dialogs
SetSession(saveVMsAction);
SetSession(action);
saveVMsAction.RunAsync();
new ActionProgressDialog(action, ProgressBarStyle.Blocks).ShowDialog(this);
using (var dlg = new ActionProgressDialog(action, ProgressBarStyle.Blocks))
dlg.ShowDialog(this);
RefreshEntermaintenanceButton();
}
@ -767,11 +768,14 @@ namespace XenAdmin.Dialogs
case Failure.HOST_NOT_ENOUGH_FREE_MEMORY:
if (vmRef == null)
new ThreeButtonDialog(
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Error,
Messages.EVACUATE_HOST_NOT_ENOUGH_MEMORY,
Messages.EVACUATE_HOST_NOT_ENOUGH_MEMORY_TITLE)).ShowDialog(this);
Messages.EVACUATE_HOST_NOT_ENOUGH_MEMORY_TITLE)))
{
dlg.ShowDialog(this);
}
vmRef = ErrorDescription[1];
UpdateVMWithError(vmRef, String.Empty, CanSuspendVm(vmRef) ? Solution.Suspend : Solution.Shutdown);
@ -786,11 +790,14 @@ namespace XenAdmin.Dialogs
}
if (vmRef == null)
new ThreeButtonDialog(
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Error,
Messages.EVACUATE_HOST_NO_OTHER_HOSTS,
Messages.EVACUATE_HOST_NO_OTHER_HOSTS_TITLE)).ShowDialog(this);
Messages.EVACUATE_HOST_NO_OTHER_HOSTS_TITLE)))
{
dlg.ShowDialog(this);
}
break;

View File

@ -472,11 +472,12 @@ namespace XenAdmin.Dialogs
}
IscsiPopulateLunsAction.Completed += IscsiPopulateLunsAction_Completed;
ActionProgressDialog dialog =
new ActionProgressDialog(IscsiPopulateLunsAction, ProgressBarStyle.Marquee);
using (var dialog = new ActionProgressDialog(IscsiPopulateLunsAction, ProgressBarStyle.Marquee))
{
dialog.ShowCancel = true;
dialog.ShowDialog(this);
}
}
private void IscsiPopulateLunsAction_Completed(ActionBase sender)
{

View File

@ -156,11 +156,14 @@ namespace XenAdmin.Dialogs
private void ShowPoolHostNotConnectedError()
{
new ThreeButtonDialog(
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Error,
Messages.SELECTED_HOST_POOL_NOT_CONNECTED,
Messages.XENCENTER)).ShowDialog(View.Parent);
Messages.XENCENTER)))
{
dlg.ShowDialog(View.Parent);
}
}
private void SummariseDisconnectedRows(List<CheckableDataGridViewRow> rowsChecked)
@ -264,12 +267,14 @@ namespace XenAdmin.Dialogs
}
catch (Exception)
{
new ThreeButtonDialog(
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Error,
string.Format(Messages.LICENSE_SERVER_COULD_NOT_OPEN_LINK,
url),
Messages.XENCENTER)).ShowDialog(View.Parent);
string.Format(Messages.LICENSE_SERVER_COULD_NOT_OPEN_LINK, url),
Messages.XENCENTER)))
{
dlg.ShowDialog(View.Parent);
}
}
};
}

View File

@ -96,10 +96,12 @@ namespace XenAdmin.Dialogs
{
oldDir = Directory.GetCurrentDirectory();
ApplyLicenseAction action = new ApplyLicenseAction(host.Connection, host, Dialog.FileName, activateFreeLicense);
ActionProgressDialog actionProgress = new ActionProgressDialog(action, ProgressBarStyle.Marquee);
using (var actionProgress = new ActionProgressDialog(action, ProgressBarStyle.Marquee))
{
actionProgress.Text = title;
actionProgress.ShowDialog(parent);
}
}
finally
{
Directory.SetCurrentDirectory(oldDir);

View File

@ -85,12 +85,12 @@ namespace XenAdmin.Dialogs
get { return srPicker1; }
}
private void srPicker1_ItemSelectionNull(object sender, EventArgs e)
private void srPicker1_ItemSelectionNull()
{
updateButtons();
}
private void srPicker1_ItemSelectionNotNull(object sender, EventArgs e)
private void srPicker1_ItemSelectionNotNull()
{
updateButtons();
}

View File

@ -456,11 +456,14 @@ namespace XenAdmin.Dialogs
}
catch (Failure)
{
new ThreeButtonDialog(
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Warning,
Messages.NETWORK_RECONFIG_CONNECTION_LOST,
Messages.XENCENTER)).ShowDialog(this);
Messages.XENCENTER)))
{
dlg.ShowDialog(this);
}
this.Close();
return;
}
@ -502,12 +505,16 @@ namespace XenAdmin.Dialogs
string title = Pool == null ? Messages.NETWORKING_PROPERTIES_WARNING_CHANGING_MANAGEMENT_HOST
: Messages.NETWORKING_PROPERTIES_WARNING_CHANGING_MANAGEMENT_POOL;
if (DialogResult.OK !=
new ThreeButtonDialog(
DialogResult dialogResult;
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(SystemIcons.Warning, title),
"NetworkingPropertiesPMIWarning",
new ThreeButtonDialog.TBDButton(Messages.NETWORKING_PROPERTIES_CHANGING_MANAGEMENT_CONTINUE, DialogResult.OK),
ThreeButtonDialog.ButtonCancel).ShowDialog(this))
ThreeButtonDialog.ButtonCancel))
{
dialogResult = dlg.ShowDialog(this);
}
if (DialogResult.OK != dialogResult)
{
DialogResult = System.Windows.Forms.DialogResult.None;
return;

View File

@ -79,8 +79,8 @@ namespace XenAdmin.Dialogs
// Add events
NameTextBox.Text = GetDefaultVDIName();
SrListBox.srListBox.SelectedIndexChanged += new EventHandler(srListBox_SelectedIndexChanged);
SrListBox.ItemSelectionNotNull += new EventHandler(SrListBox_ItemSelectionNotNull);
SrListBox.ItemSelectionNull += new EventHandler(SrListBox_ItemSelectionNull);
SrListBox.ItemSelectionNotNull += SrListBox_ItemSelectionNotNull;
SrListBox.ItemSelectionNull += SrListBox_ItemSelectionNull;
srListBox_SelectedIndexChanged(null, null);
DiskSizeNumericUpDown.TextChanged += new EventHandler(DiskSizeNumericUpDown_TextChanged);
@ -178,12 +178,12 @@ namespace XenAdmin.Dialogs
return Helpers.MakeUniqueName(Messages.DEFAULT_VDI_NAME, usedNames);
}
void SrListBox_ItemSelectionNull(object sender, EventArgs e)
void SrListBox_ItemSelectionNull()
{
SelectionNull = true;
}
void SrListBox_ItemSelectionNotNull(object sender, EventArgs e)
void SrListBox_ItemSelectionNotNull()
{
SelectionNull = false;
}
@ -234,10 +234,15 @@ namespace XenAdmin.Dialogs
XenAPI.SR sr = SrListBox.SR;
if (!sr.shared && TheVM != null && TheVM.HaPriorityIsRestart())
{
if (new ThreeButtonDialog(
DialogResult dialogResult;
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(SystemIcons.Warning, Messages.NEW_SR_DIALOG_ATTACH_NON_SHARED_DISK_HA, Messages.XENCENTER),
ThreeButtonDialog.ButtonYes,
ThreeButtonDialog.ButtonNo).ShowDialog(Program.MainWindow) != DialogResult.Yes)
ThreeButtonDialog.ButtonNo))
{
dialogResult = dlg.ShowDialog(Program.MainWindow);
}
if (dialogResult != DialogResult.Yes)
return;
new HAUnprotectVMAction(TheVM).RunExternal(TheVM.Connection.Session);
}
@ -699,13 +704,13 @@ namespace XenAdmin.Dialogs
{
if (!Program.RunInAutomatedTestMode)
{
new ThreeButtonDialog(
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(SystemIcons.Information,
Messages.
NEWDISKWIZARD_MESSAGE,
Messages.
NEWDISKWIZARD_MESSAGE_TITLE))
.ShowDialog(Program.MainWindow);
Messages.NEWDISKWIZARD_MESSAGE,
Messages.NEWDISKWIZARD_MESSAGE_TITLE)))
{
dlg.ShowDialog(Program.MainWindow);
}
}
});
}

View File

@ -161,8 +161,8 @@ namespace XenAdmin.Dialogs
Helpers.FeatureForbidden(host, Host.RestrictCpuMasking) &&
!PoolJoinRules.FreeHostPaidMaster(host, master, false))) // in this case we can upgrade the license and then mask the CPU
{
UpsellDialog dlg = new UpsellDialog(HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_CPUMASKING : Messages.UPSELL_BLURB_CPUMASKING + Messages.UPSELL_BLURB_CPUMASKING_MORE,
InvisibleMessages.UPSELL_LEARNMOREURL_CPUMASKING);
using (var dlg = new UpsellDialog(HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_CPUMASKING : Messages.UPSELL_BLURB_CPUMASKING + Messages.UPSELL_BLURB_CPUMASKING_MORE,
InvisibleMessages.UPSELL_LEARNMOREURL_CPUMASKING))
dlg.ShowDialog(this);
return;
}

View File

@ -316,12 +316,15 @@ namespace XenAdmin.Dialogs
{
string tag = tagsListView.SelectedItems[0].Text;
ThreeButtonDialog tbd = new ThreeButtonDialog(
DialogResult result;
using (var tbd = new ThreeButtonDialog(
new ThreeButtonDialog.Details(SystemIcons.Warning, String.Format(Messages.CONFIRM_DELETE_TAG, tag), Messages.CONFIRM_DELETE_TAG_TITLE),
new ThreeButtonDialog.TBDButton(Messages.OK, DialogResult.OK),
ThreeButtonDialog.ButtonCancel);
ThreeButtonDialog.ButtonCancel))
{
result = tbd.ShowDialog(this);
}
DialogResult result = tbd.ShowDialog(this);
if (result != DialogResult.OK)
return;

View File

@ -197,7 +197,7 @@ namespace XenAdmin.Dialogs
ShowTab(PoolGpuEditPage = new PoolGpuEditPage());
}
if (is_pool_or_standalone && Helpers.DundeeOrGreater(xenObject.Connection))
if (is_pool_or_standalone && !Helpers.FeatureForbidden(xenObject.Connection, Host.RestrictSslLegacySwitch))
ShowTab(SecurityEditPage = new SecurityEditPage());
if (is_network)
@ -272,7 +272,7 @@ namespace XenAdmin.Dialogs
if (vbdEditPages.Count <= 0)
return;
ActionProgressDialog dialog = new ActionProgressDialog(
using (var dialog = new ActionProgressDialog(
new DelegatedAsyncAction(vdi.Connection, Messages.DEVICE_POSITION_SCANNING,
Messages.DEVICE_POSITION_SCANNING, Messages.DEVICE_POSITION_SCANNED,
delegate(Session session)
@ -280,10 +280,12 @@ namespace XenAdmin.Dialogs
foreach (VBDEditPage page in vbdEditPages)
page.UpdateDevicePositions(session);
}),
ProgressBarStyle.Continuous);
ProgressBarStyle.Continuous))
{
dialog.ShowCancel = true;
dialog.ShowDialog(Program.MainWindow);
}
}
finally
{
ContentPanel.ResumeLayout();

View File

@ -114,7 +114,8 @@ namespace XenAdmin.Dialogs
}
});
new ActionProgressDialog(loginAction, ProgressBarStyle.Marquee, false).ShowDialog(this);
using (var dlg = new ActionProgressDialog(loginAction, ProgressBarStyle.Marquee, false))
dlg.ShowDialog(this);
// The exception would have been handled by the action progress dialog, just return the user to the sudo dialog
if (loginAction.Exception != null)
@ -139,11 +140,14 @@ namespace XenAdmin.Dialogs
catch (Exception ex)
{
log.DebugFormat("Exception when attempting to sudo action: {0} ", ex);
new ThreeButtonDialog(
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Error,
String.Format(Messages.USER_AUTHORIZATION_FAILED, TextBoxUsername.Text),
Messages.XENCENTER)).ShowDialog(Parent);
Messages.XENCENTER)))
{
dlg.ShowDialog(Parent);
}
}
finally
{
@ -177,11 +181,14 @@ namespace XenAdmin.Dialogs
private void ShowNotAuthorisedDialog()
{
new ThreeButtonDialog(
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Error,
Messages.USER_NOT_AUTHORIZED,
Messages.PERMISSION_DENIED)).ShowDialog(this);
Messages.PERMISSION_DENIED)))
{
dlg.ShowDialog(this);
}
}
private bool SessionAuthorized(Session s)

View File

@ -373,9 +373,13 @@ namespace XenAdmin.Dialogs
var vm = xenConnection.Resolve(vif.VM);
if (vif != ExistingVif && vif.MAC == SelectedMac && vm != null && vm.is_a_real_vm)
{
DialogResult result = MacAddressDuplicationWarningDialog(
DialogResult result;
using (var dlg = MacAddressDuplicationWarningDialog(
SelectedMac,
vm.NameWithLocation).ShowDialog(Program.MainWindow);
vm.NameWithLocation))
{
result = dlg.ShowDialog(Program.MainWindow);
}
return (result == DialogResult.Yes);
}
}

View File

@ -368,13 +368,15 @@ namespace XenAdmin.Dialogs.VMAppliances
text = string.Format(numberOfProtectedVMs == 0 ? Messages.CONFIRM_DELETE_VM_APPLIANCES_0 : Messages.CONFIRM_DELETE_VM_APPLIANCES, numberOfProtectedVMs);
}
if (new ThreeButtonDialog(
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(SystemIcons.Warning, text, Messages.DELETE_VM_APPLIANCE_TITLE),
ThreeButtonDialog.ButtonYes,
ThreeButtonDialog.ButtonNo).ShowDialog(this) == DialogResult.Yes)
ThreeButtonDialog.ButtonNo))
{
if (dlg.ShowDialog(this) == DialogResult.Yes)
new DestroyVMApplianceAction(Pool.Connection, selectedAppliances).RunAsync();
}
}
private void toolStripButtonEdit_Click(object sender, EventArgs e)
{

View File

@ -92,12 +92,12 @@ namespace XenAdmin.Dialogs.VMDialogs
buttonMove.Enabled = srPicker1.SR != null;
}
private void srPicker1_ItemSelectionNull(object sender, EventArgs e)
private void srPicker1_ItemSelectionNull()
{
EnableMoveButton();
}
private void srPicker1_ItemSelectionNotNull(object sender, EventArgs e)
private void srPicker1_ItemSelectionNotNull()
{
EnableMoveButton();
}

View File

@ -220,13 +220,14 @@ namespace XenAdmin.Dialogs.VMProtection_Recovery
text = string.Format(numberOfProtectedVMs == 0 ? Messages.CONFIRM_DELETE_POLICIES_0 : Messages.CONFIRM_DELETE_POLICIES, numberOfProtectedVMs);
}
if (new ThreeButtonDialog(
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(SystemIcons.Warning, text, Messages.DELETE_VM_PROTECTION_TITLE),
ThreeButtonDialog.ButtonYes,
ThreeButtonDialog.ButtonNo).ShowDialog(this) == DialogResult.Yes)
ThreeButtonDialog.ButtonNo))
{
if (dlg.ShowDialog(this) == DialogResult.Yes)
new DestroyPolicyAction(Pool.Connection, selectedPolicies).RunAsync();
}
}
private VMPP currentSelected = null;

View File

@ -88,14 +88,16 @@ namespace XenAdmin.Dialogs
if (sr.IsToolsSR && sr.IsBroken())
{
Hide();
if (new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Warning,
Messages.BROKEN_TOOLS_PROMPT,
DialogResult dialogResult;
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(SystemIcons.Warning, Messages.BROKEN_TOOLS_PROMPT,
Messages.INSTALL_XS_TOOLS),
ThreeButtonDialog.ButtonOK,
ThreeButtonDialog.ButtonCancel
).ShowDialog(this) != DialogResult.OK)
ThreeButtonDialog.ButtonCancel))
{
dialogResult = dlg.ShowDialog(this);
}
if (dialogResult != DialogResult.OK)
{
DialogResult = DialogResult.No;
Close();

Some files were not shown because too many files have changed in this diff Show More