mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-23 20:36:33 +01:00
CP-17161: Add 'using' statement around dialogs to ensure garbage collection
- fix UpsellDialog usages Signed-off-by: Mihaela Stoica <mihaela.stoica@citrix.com>
This commit is contained in:
parent
da9e99b1cb
commit
62870544c6
@ -124,9 +124,9 @@ 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);
|
||||
dlg.ShowDialog(Parent);
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -93,9 +93,9 @@ 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);
|
||||
dlg.ShowDialog(parent);
|
||||
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);
|
||||
}
|
||||
|
||||
protected override bool CanExecute(VM vm)
|
||||
|
@ -118,9 +118,9 @@ 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);
|
||||
dlg.ShowDialog(parent);
|
||||
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);
|
||||
}
|
||||
|
||||
protected override bool CanExecuteCore(SelectedItemCollection selection)
|
||||
|
@ -94,9 +94,9 @@ 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);
|
||||
dlg.ShowDialog(parent);
|
||||
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);
|
||||
}
|
||||
|
||||
protected override bool CanExecuteCore(SelectedItemCollection selection)
|
||||
|
@ -97,9 +97,9 @@ 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);
|
||||
dlg.ShowDialog(parent);
|
||||
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);
|
||||
}
|
||||
|
||||
protected override bool CanExecuteCore(SelectedItemCollection selection)
|
||||
|
@ -94,9 +94,9 @@ 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);
|
||||
dlg.ShowDialog(parent);
|
||||
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);
|
||||
}
|
||||
|
||||
protected override bool CanExecuteCore(SelectedItemCollection selection)
|
||||
|
@ -91,9 +91,9 @@ 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);
|
||||
dlg.ShowDialog(parent);
|
||||
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);
|
||||
}
|
||||
|
||||
protected override bool CanExecuteCore(SelectedItemCollection selection)
|
||||
|
@ -63,9 +63,9 @@ 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);
|
||||
dlg.ShowDialog(Parent);
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -82,9 +82,9 @@ 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);
|
||||
dlg.ShowDialog(Parent);
|
||||
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)
|
||||
{
|
||||
|
@ -85,9 +85,9 @@ 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);
|
||||
dlg.ShowDialog(parent);
|
||||
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);
|
||||
}
|
||||
|
||||
protected override bool CanExecuteCore(SelectedItemCollection selection)
|
||||
|
@ -84,8 +84,8 @@ namespace XenAdmin.Commands
|
||||
|
||||
public static void ShowUpsellDialog(IWin32Window parent)
|
||||
{
|
||||
UpsellDialog dlg = new UpsellDialog(VMGroup<T>.UpsellBlurb, VMGroup<T>.UpsellLearnMoreUrl);
|
||||
dlg.ShowDialog(parent);
|
||||
using (var dlg = new UpsellDialog(VMGroup<T>.UpsellBlurb, VMGroup<T>.UpsellLearnMoreUrl))
|
||||
dlg.ShowDialog(parent);
|
||||
}
|
||||
|
||||
protected override bool CanExecuteCore(SelectedItemCollection selection)
|
||||
|
@ -84,9 +84,9 @@ 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);
|
||||
dlg.ShowDialog(Parent);
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -58,15 +58,17 @@ namespace XenAdmin.Diagnostics.Problems.HostProblem
|
||||
|
||||
protected override AsyncAction CreateAction(out bool cancelled)
|
||||
{
|
||||
SelectVMsToSuspendDialog dlg = new SelectVMsToSuspendDialog(Server);
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
using (var dlg = new SelectVMsToSuspendDialog(Server))
|
||||
{
|
||||
cancelled = false;
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
cancelled = false;
|
||||
|
||||
VmsToSuspend = dlg.SelectedVMsToSuspend;
|
||||
VmsToShutdown = dlg.SelectedVMsToShutdown;
|
||||
VmsToSuspend = dlg.SelectedVMsToSuspend;
|
||||
VmsToShutdown = dlg.SelectedVMsToShutdown;
|
||||
|
||||
return new SuspendAndShutdownVMsAction(Server.Connection, Server, VmsToSuspend, VmsToShutdown);
|
||||
return new SuspendAndShutdownVMsAction(Server.Connection, Server, VmsToSuspend, VmsToShutdown);
|
||||
}
|
||||
}
|
||||
|
||||
cancelled = true;
|
||||
|
@ -161,9 +161,9 @@ 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);
|
||||
dlg.ShowDialog(this);
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -1035,9 +1035,9 @@ namespace XenAdmin.TabPages
|
||||
if (Helpers.FeatureForbidden(pool.Connection, Host.RestrictRBAC))
|
||||
{
|
||||
// Show upsell dialog
|
||||
UpsellDialog dlg = new UpsellDialog(HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_RBAC : Messages.UPSELL_BLURB_RBAC + Messages.UPSELL_BLURB_RBAC_MORE,
|
||||
InvisibleMessages.UPSELL_LEARNMOREURL_RBAC);
|
||||
dlg.ShowDialog(this);
|
||||
using (var dlg = new UpsellDialog(HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_RBAC : Messages.UPSELL_BLURB_RBAC + Messages.UPSELL_BLURB_RBAC_MORE,
|
||||
InvisibleMessages.UPSELL_LEARNMOREURL_RBAC))
|
||||
dlg.ShowDialog(this);
|
||||
return;
|
||||
|
||||
}
|
||||
|
@ -303,9 +303,9 @@ namespace XenAdmin.TabPages
|
||||
|
||||
private void ShowUpsell()
|
||||
{
|
||||
UpsellDialog upsellDialog = new UpsellDialog(HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_PERFORMANCE : Messages.UPSELL_BLURB_PERFORMANCE + Messages.UPSELL_BLURB_PERFORMANCE_MORE,
|
||||
InvisibleMessages.UPSELL_LEARNMOREURL_PERFORMANCE);
|
||||
upsellDialog.ShowDialog(this);
|
||||
using (var upsellDialog = new UpsellDialog(HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_PERFORMANCE : Messages.UPSELL_BLURB_PERFORMANCE + Messages.UPSELL_BLURB_PERFORMANCE_MORE,
|
||||
InvisibleMessages.UPSELL_LEARNMOREURL_PERFORMANCE))
|
||||
upsellDialog.ShowDialog(this);
|
||||
}
|
||||
|
||||
private void MoveGraphUp()
|
||||
|
Loading…
Reference in New Issue
Block a user