本文整理汇总了C#中XenAdmin.Dialogs.ThreeButtonDialog.ShowDialog方法的典型用法代码示例。如果您正苦于以下问题:C# ThreeButtonDialog.ShowDialog方法的具体用法?C# ThreeButtonDialog.ShowDialog怎么用?C# ThreeButtonDialog.ShowDialog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XenAdmin.Dialogs.ThreeButtonDialog
的用法示例。
在下文中一共展示了ThreeButtonDialog.ShowDialog方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExecuteCore
protected override void ExecuteCore(SelectedItemCollection selection)
{
VM vm = (VM)selection[0].XenObject;
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Warning,
string.Format(Messages.CONVERT_TEMPLATE_DIALOG_TEXT, vm.Name.Ellipsise(25)),
Messages.CONVERT_TO_TEMPLATE),
new ThreeButtonDialog.TBDButton(Messages.CONVERT, DialogResult.OK, ThreeButtonDialog.ButtonType.ACCEPT, true),
ThreeButtonDialog.ButtonCancel))
{
if (dlg.ShowDialog() == DialogResult.OK)
{
List<AsyncAction> actions = new List<AsyncAction>();
actions.Add(new SetVMOtherConfigAction(vm.Connection, vm, "instant", "true"));
actions.Add(new VMToTemplateAction(vm));
MainWindowCommandInterface.CloseActiveWizards(vm);
RunMultipleActions(actions, string.Format(Messages.ACTION_VM_TEMPLATIZING_TITLE, vm.Name),
Messages.ACTION_VM_TEMPLATIZING, Messages.ACTION_VM_TEMPLATIZED, true);
}
}
}
示例2: action_Completed
protected virtual void action_Completed(ActionBase sender)
{
var action = (AsyncAction)sender;
if (action.Result == false.ToString())
MainWindowCommandInterface.Invoke(() =>
{
using (var dlg =new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Information,
Messages.VIF_HOTPLUG_FAILED_MESSAGE,
Messages.VIF_HOTPLUG_FAILED_TITLE)))
{
dlg.ShowDialog(Program.MainWindow);
}
});
}
示例3: EditTask
private void EditTask(WlbScheduledTask task)
{
WlbScheduledTask editTask = task.Clone();
WlbEditScheduledTask taskEditor = new WlbEditScheduledTask(editTask);
DialogResult dr = taskEditor.ShowDialog();
if (DialogResult.OK == dr)
{
WlbScheduledTask checkTask = CheckForDuplicateTask(editTask);
if (null != checkTask)
{
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Warning,
Messages.WLB_TASK_SCHEDULE_CONFLICT_BLURB,
Messages.WLB_TASK_SCHEDULE_CONFLICT_TITLE)))
{
dlg.ShowDialog(this);
}
SelectTask(checkTask.TaskId);
}
else
{
editTask.LastTouchedBy = _pool.Connection.Username;
editTask.LastTouched = DateTime.UtcNow;
_scheduledTasks.TaskList[editTask.TaskId.ToString()] = editTask;
PopulateListView();
_hasChanged = true;
}
}
}
示例4: AddTask
private void AddTask()
{
WlbEditScheduledTask addTask = new WlbEditScheduledTask(_newTaskId--, WlbScheduledTask.WlbTaskActionType.SetOptimizationMode);
DialogResult dr = addTask.ShowDialog();
if (DialogResult.OK == dr)
{
WlbScheduledTask newTask = addTask.Task;
newTask.Owner = _pool.Connection.Username;
newTask.LastTouchedBy = _pool.Connection.Username;
newTask.AddTaskParameter("PoolUUID", _pool.uuid);
WlbScheduledTask checkTask = CheckForDuplicateTask(newTask);
if (null != checkTask)
{
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Warning,
Messages.WLB_TASK_SCHEDULE_CONFLICT_BLURB,
Messages.WLB_TASK_SCHEDULE_CONFLICT_TITLE)))
{
dlg.ShowDialog(this);
}
SelectTask(checkTask.TaskId);
}
else
{
_scheduledTasks.TaskList.Add(newTask.TaskId.ToString(), newTask);
PopulateListView();
_hasChanged = true;
}
}
}
示例5: ToolStripMenuItemDismiss_Click
private void ToolStripMenuItemDismiss_Click(object sender, EventArgs e)
{
if (dataGridViewUpdates.SelectedRows.Count != 1)
log.DebugFormat("Only 1 update can be dismissed at a time (Attempted to dismiss {0}). Dismissing the clicked item.", dataGridViewUpdates.SelectedRows.Count);
DataGridViewRow clickedRow = FindAlertRow(sender as ToolStripMenuItem);
if (clickedRow == null)
{
log.Debug("Attempted to dismiss update with no update selected.");
return;
}
Alert alert = (Alert)clickedRow.Tag;
if (alert == null)
return;
using (var dlog = new ThreeButtonDialog(
new ThreeButtonDialog.Details(null, Messages.UPDATE_DISMISS_CONFIRM, Messages.XENCENTER),
ThreeButtonDialog.ButtonYes,
ThreeButtonDialog.ButtonNo))
{
if (dlog.ShowDialog(this) != DialogResult.Yes)
return;
}
DismissUpdates(new List<Alert> { (Alert)clickedRow.Tag });
}
示例6: dismissAllToolStripMenuItem_Click
/// <summary>
/// If the answer of the user to the dialog is YES, then make a list with all the updates and call
/// DismissUpdates on that list.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void dismissAllToolStripMenuItem_Click(object sender, EventArgs e)
{
DialogResult result;
if (!FilterIsOn)
{
using (var dlog = new ThreeButtonDialog(
new ThreeButtonDialog.Details(null, Messages.UPDATE_DISMISS_ALL_NO_FILTER_CONTINUE),
new ThreeButtonDialog.TBDButton(Messages.DISMISS_ALL_YES_CONFIRM_BUTTON, DialogResult.Yes),
ThreeButtonDialog.ButtonCancel))
{
result = dlog.ShowDialog(this);
}
}
else
{
using (var dlog = new ThreeButtonDialog(
new ThreeButtonDialog.Details(null, Messages.UPDATE_DISMISS_ALL_CONTINUE),
new ThreeButtonDialog.TBDButton(Messages.DISMISS_ALL_CONFIRM_BUTTON, DialogResult.Yes),
new ThreeButtonDialog.TBDButton(Messages.DISMISS_FILTERED_CONFIRM_BUTTON, DialogResult.No, ThreeButtonDialog.ButtonType.NONE),
ThreeButtonDialog.ButtonCancel))
{
result = dlog.ShowDialog(this);
}
}
if (result == DialogResult.Cancel)
return;
var alerts = result == DialogResult.No
? from DataGridViewRow row in dataGridViewUpdates.Rows select row.Tag as Alert
: Updates.UpdateAlerts;
DismissUpdates(alerts);
}
示例7: FiberChannelScan
public bool FiberChannelScan(IWin32Window owner, IXenConnection connection, out List<FibreChannelDevice> devices)
{
devices = new List<FibreChannelDevice>();
Host master = Helpers.GetMaster(connection);
if (master == null)
return false;
FibreChannelProbeAction action = new FibreChannelProbeAction(master, SrType);
using (var dialog = new ActionProgressDialog(action, ProgressBarStyle.Marquee))
dialog.ShowDialog(owner); //Will block until dialog closes, action completed
if (!action.Succeeded)
return false;
try
{
devices = FibreChannelProbeParsing.ProcessXML(action.Result);
if (devices.Count == 0)
{
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(SystemIcons.Warning, Messages.FIBRECHANNEL_NO_RESULTS, Messages.XENCENTER)))
{
dlg.ShowDialog();
}
return false;
}
return true;
}
catch (Exception e)
{
log.Debug("Exception parsing result of fibre channel scan", e);
log.Debug(e, e);
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(SystemIcons.Warning, Messages.FIBRECHANNEL_XML_ERROR, Messages.XENCENTER)))
{
dlg.ShowDialog();
}
return false;
}
}
示例8: DeleteGraph
private void DeleteGraph()
{
using (ThreeButtonDialog dlog = new ThreeButtonDialog(
new ThreeButtonDialog.Details(SystemIcons.Warning,
string.Format(Messages.DELETE_GRAPH_MESSAGE, GraphList.SelectedGraph.DisplayName),
Messages.XENCENTER),
ThreeButtonDialog.ButtonYes,
ThreeButtonDialog.ButtonNo))
{
if (dlog.ShowDialog(this) == DialogResult.Yes)
if (GraphList.AuthorizedRole)
{
GraphList.DeleteGraph(GraphList.SelectedGraph);
GraphList.LoadDataSources(SaveGraphs);
}
}
}
示例9: ExecuteCore
protected override void ExecuteCore(SelectedItemCollection selection)
{
Dictionary<SelectedItem, string> reasons = new Dictionary<SelectedItem, string>();
foreach (Host host in _hosts)
{
PoolJoinRules.Reason reason = PoolJoinRules.CanJoinPool(host.Connection, _pool.Connection, true, true, true);
if (reason != PoolJoinRules.Reason.Allowed)
reasons[new SelectedItem(host)] = PoolJoinRules.ReasonMessage(reason);
}
if (reasons.Count > 0)
{
string title = Messages.ERROR_DIALOG_ADD_TO_POOL_TITLE;
string text = string.Format(Messages.ERROR_DIALOG_ADD_TO_POOL_TEXT, Helpers.GetName(_pool).Ellipsise(500));
new CommandErrorDialog(title, text, reasons).ShowDialog(Parent);
return;
}
if (_confirm && !ShowConfirmationDialog())
{
// Bail out if the user doesn't want to continue.
return;
}
if (!Helpers.IsConnected(_pool))
{
string message = _hosts.Count == 1
? string.Format(Messages.ADD_HOST_TO_POOL_DISCONNECTED_POOL,
Helpers.GetName(_hosts[0]).Ellipsise(500), Helpers.GetName(_pool).Ellipsise(500))
: string.Format(Messages.ADD_HOST_TO_POOL_DISCONNECTED_POOL_MULTIPLE,
Helpers.GetName(_pool).Ellipsise(500));
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(SystemIcons.Error, message, Messages.XENCENTER)))
{
dlg.ShowDialog(Parent);
}
return;
}
// Check supp packs and warn
List<string> badSuppPacks = PoolJoinRules.HomogeneousSuppPacksDiffering(_hosts, _pool);
if (!HelpersGUI.GetPermissionFor(badSuppPacks, sp => true,
Messages.ADD_HOST_TO_POOL_SUPP_PACK, Messages.ADD_HOST_TO_POOL_SUPP_PACKS, false, "PoolJoinSuppPacks"))
{
return;
}
// Are there any hosts which are forbidden from masking their CPUs for licensing reasons?
// If so, we need to show upsell.
Host master = Helpers.GetMaster(_pool);
if (null != _hosts.Find(host =>
!PoolJoinRules.CompatibleCPUs(host, master, false) &&
Helpers.FeatureForbidden(host, Host.RestrictCpuMasking) &&
!PoolJoinRules.FreeHostPaidMaster(host, master, false))) // in this case we can upgrade the license and then mask the CPU
{
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;
}
// Get permission for any fix-ups: 1) Licensing free hosts; 2) CPU masking 3) Ad configuration 4) CPU feature levelling (Dundee or higher only)
// (We already know that these things are fixable because we have been through CanJoinPool() above).
if (!HelpersGUI.GetPermissionFor(_hosts, host => PoolJoinRules.FreeHostPaidMaster(host, master, false),
Messages.ADD_HOST_TO_POOL_LICENSE_MESSAGE, Messages.ADD_HOST_TO_POOL_LICENSE_MESSAGE_MULTIPLE, true, "PoolJoinRelicensing")
||
!HelpersGUI.GetPermissionFor(_hosts, host => !PoolJoinRules.CompatibleCPUs(host, master, false),
Messages.ADD_HOST_TO_POOL_CPU_MASKING_MESSAGE, Messages.ADD_HOST_TO_POOL_CPU_MASKING_MESSAGE_MULTIPLE, true, "PoolJoinCpuMasking")
||
!HelpersGUI.GetPermissionFor(_hosts, host => !PoolJoinRules.CompatibleAdConfig(host, master, false),
Messages.ADD_HOST_TO_POOL_AD_MESSAGE, Messages.ADD_HOST_TO_POOL_AD_MESSAGE_MULTIPLE, true, "PoolJoinAdConfiguring")
||
!HelpersGUI.GetPermissionForCpuFeatureLevelling(_hosts, _pool))
{
return;
}
MainWindowCommandInterface.SelectObjectInTree(_pool);
List<AsyncAction> actions = new List<AsyncAction>();
foreach (Host host in _hosts)
{
string opaque_ref = host.opaque_ref;
AddHostToPoolAction action = new AddHostToPoolAction(_pool, host, GetAdPrompt, NtolDialog, ApplyLicenseEditionCommand.ShowLicensingFailureDialog);
action.Completed += s => Program.ShowObject(opaque_ref);
actions.Add(action);
// hide connection. If the action fails, re-show it.
Program.HideObject(opaque_ref);
}
RunMultipleActions(actions, string.Format(Messages.ADDING_SERVERS_TO_POOL, _pool.Name), Messages.POOLCREATE_ADDING, Messages.POOLCREATE_ADDED, true);
}
示例10: NtolDialog
public static bool NtolDialog(HostAbstractAction action, Pool pool, long currentNtol, long targetNtol)
{
bool cancel = false;
Program.Invoke(Program.MainWindow, delegate()
{
string poolName = Helpers.GetName(pool).Ellipsise(500);
string hostName = Helpers.GetName(action.Host).Ellipsise(500);
string msg;
if (targetNtol == 0)
{
string f;
if (action is EvacuateHostAction)
{
f = Messages.HA_HOST_DISABLE_NTOL_ZERO;
}
else if (action is RebootHostAction)
{
f = Messages.HA_HOST_REBOOT_NTOL_ZERO;
}
else
{
f = Messages.HA_HOST_SHUTDOWN_NTOL_ZERO;
}
msg = string.Format(f, poolName, hostName);
}
else
{
string f;
if (action is EvacuateHostAction)
{
f = Messages.HA_HOST_DISABLE_NTOL_DROP;
}
else if (action is RebootHostAction)
{
f = Messages.HA_HOST_REBOOT_NTOL_DROP;
}
else
{
f = Messages.HA_HOST_SHUTDOWN_NTOL_DROP;
}
msg = string.Format(f, poolName, currentNtol, hostName, targetNtol);
}
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)
))
{
if (dlg.ShowDialog(Program.MainWindow) == DialogResult.No)
{
cancel = true;
}
}
});
return cancel;
}
示例11: EnableNtolDialog
public static bool EnableNtolDialog(Pool pool, Host host, long currentNtol, long max)
{
bool doit = false;
Program.Invoke(Program.MainWindow, delegate()
{
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);
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)))
{
if (dlg.ShowDialog(Program.MainWindow) == DialogResult.Yes)
{
doit = true;
}
}
});
return doit;
}
示例12: ExecuteCore
protected override void ExecuteCore(SelectedItemCollection selection)
{
VM vm = (VM)selection[0].XenObject;
if (vm.VBDs.Count >= vm.MaxVBDsAllowed)
{
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Error,
FriendlyErrorNames.VBDS_MAX_ALLOWED,
Messages.DISK_ATTACH)))
{
dlg.ShowDialog(Program.MainWindow);
}
}
else
{
MainWindowCommandInterface.ShowPerXenModelObjectWizard(vm, new AttachDiskDialog(vm));
}
}
示例13: errorLinkLabel_LinkClicked
private void errorLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
if (!canDownload)
{
var msgtemplate = SelectedExistingPatch.host_patches.Count > 0 ? Messages.PATCH_DOWNLOAD_FAILED_MORE_INFO : Messages.PATCH_DOWNLOAD_FAILED_MORE_INFO_NOT_APPLIED;
var msg = string.Format(msgtemplate, SelectedExistingPatch.name_label, SelectedExistingPatch.Connection.Name, Branding.Update);
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(SystemIcons.Error, msg)))
{
dlg.ShowDialog(this);
}
}
if (diskSpaceRequirements == null)
return;
if (diskSpaceRequirements.CanCleanup)
{
using (var d = new ThreeButtonDialog(
new ThreeButtonDialog.Details(SystemIcons.Warning,
diskSpaceRequirements.GetSpaceRequirementsMessage()),
new ThreeButtonDialog.TBDButton(Messages.OK, DialogResult.OK),
new ThreeButtonDialog.TBDButton(Messages.CANCEL, DialogResult.Cancel)))
{
if (d.ShowDialog(this) == DialogResult.OK)
{
// do the cleanup and retry uploading
CleanupDiskSpaceAction action = new CleanupDiskSpaceAction(diskSpaceRequirements.Host, null,
true);
action.Completed += delegate
{
if (action.Succeeded)
{
Program.Invoke(Program.MainWindow, TryUploading);
}
};
action.RunAsync();
}
}
}
else
{
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(SystemIcons.Warning,
diskSpaceRequirements.GetSpaceRequirementsMessage())))
{
dlg.ShowDialog(this);
}
}
}
示例14: CreateAction
protected override AsyncAction CreateAction(out bool cancelled)
{
Program.AssertOnEventThread();
string vmNames = string.Join(",", (from vm in vmsToDestroy select vm.Name).ToArray());
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))
{
dialogResult = dlg.ShowDialog();
}
if (dialogResult == DialogResult.Yes)
{
cancelled = false;
return new ShutdownAndDestroyVMsAction(vmsToDestroy[0].Connection, vmsToDestroy);
}
cancelled = true;
return null;
}
示例15: CompleteRequest
private static void CompleteRequest(string destdir, string token)
{
bool restored;
try
{
Settings.RestoreSession();
restored = Properties.Settings.Default.SaveSession;
}
catch (ConfigurationErrorsException ex)
{
log.Error("Could not load settings.", ex);
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Error,
string.Format(Messages.MESSAGEBOX_LOAD_CORRUPTED, Settings.GetUserConfigPath()),
Messages.MESSAGEBOX_LOAD_CORRUPTED_TITLE)))
{
dlg.ShowDialog(Program.MainWindow);
}
Application.Exit();
return;
}
try
{
if (restored)
{
WriteXML(destdir, token, null);
}
else
{
// The user has cancelled the restore.
WriteXML(destdir, null, "cancelled");
}
}
catch (Exception exn)
{
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Error,
string.Format(Messages.MESSAGEBOX_PASSWORD_WRITE_FAILED, exn.Message),
Messages.XENCENTER)))
{
dlg.ShowDialog(Program.MainWindow);
}
Application.Exit();
}
}