本文整理汇总了C#中XenAdmin.Dialogs.ThreeButtonDialog类的典型用法代码示例。如果您正苦于以下问题:C# ThreeButtonDialog类的具体用法?C# ThreeButtonDialog怎么用?C# ThreeButtonDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ThreeButtonDialog类属于XenAdmin.Dialogs命名空间,在下文中一共展示了ThreeButtonDialog类的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: LaunchUrlInBrowser
public void LaunchUrlInBrowser()
{
try
{
if (UriToLaunch != null)
Process.Start(UriToLaunch.AbsoluteUri);
}
catch (Exception)
{
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Error,
string.Format(Messages.COULD_NOT_OPEN_URL,
UriToLaunch != null ? UriToLaunch.AbsoluteUri : string.Empty),
Messages.XENCENTER)))
{
dlg.ShowDialog(Program.MainWindow);
}
}
}
示例4: CreateAction
protected override AsyncAction CreateAction(out bool cancelled)
{
AsyncAction action = null;
if (diskSpaceReq.CanCleanup)
{
Program.Invoke(Program.MainWindow, delegate()
{
DialogResult r = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Warning,
diskSpaceReq.GetSpaceRequirementsMessage()),
new ThreeButtonDialog.TBDButton(Messages.YES, DialogResult.Yes, ThreeButtonDialog.ButtonType.ACCEPT, true),
ThreeButtonDialog.ButtonNo
).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();
});
}
cancelled = action == null;
return action;
}
示例5: 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;
}
}
}
示例6: 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;
}
}
}
示例7: 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 });
}
示例8: 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);
}
示例9: EditWLB
internal void EditWLB(Pool pool)
{
// Do nothing if there is a WLB action in progress
if (HelpersGUI.FindActiveWLBAction(pool.Connection) != null)
{
log.Debug("Not opening WLB dialog: an WLB action is in progress");
return;
}
if (!pool.Connection.IsConnected)
{
log.Debug("Not opening WLB dialog: the connection to the pool is now closed");
return;
}
try
{
WlbConfigurationDialog wlbConfigDialog = new WlbConfigurationDialog(pool);
DialogResult dr = wlbConfigDialog.ShowDialog();
if (dr == DialogResult.OK)
{
_wlbPoolConfiguration = wlbConfigDialog.WlbPoolConfiguration;
//check to see if the current opt mode matches the current schedule
if (_wlbPoolConfiguration.AutomateOptimizationMode)
{
WlbPoolPerformanceMode scheduledPerfMode = _wlbPoolConfiguration.ScheduledTasks.GetCurrentScheduledPerformanceMode();
if (scheduledPerfMode != _wlbPoolConfiguration.PerformanceMode)
{
string blurb = string.Format(Messages.WLB_PROMPT_FOR_MODE_CHANGE_BLURB, getOptModeText(scheduledPerfMode), getOptModeText(_wlbPoolConfiguration.PerformanceMode));
DialogResult drModeCheck = new ThreeButtonDialog(
new ThreeButtonDialog.Details(null, blurb, Messages.WLB_PROMPT_FOR_MODE_CHANGE_CAPTION),
ThreeButtonDialog.ButtonYes,
ThreeButtonDialog.ButtonNo).ShowDialog(this);
if (drModeCheck == DialogResult.Yes)
{
_wlbPoolConfiguration.PerformanceMode = scheduledPerfMode;
}
}
}
SaveWLBConfig(_wlbPoolConfiguration);
}
}
catch (Exception ex)
{
log.Debug("Unable to open the WLB configuration dialog.", ex);
return;
}
if (!(WlbServerState.GetState(_pool) == WlbServerState.ServerState.NotConfigured))
{
RetrieveConfiguration();
}
}
示例10: 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;
}
}
示例11: SetTreeViewReportList
/// <summary>
/// Populates the treeview with ReportInfo and SubscriptionInfo nodes
/// </summary>
private void SetTreeViewReportList()
{
bool errorLoading = false;
// Prep treeview for population
treeViewReportList.BeginUpdate();
treeViewReportList.Nodes.Clear();
// Set up the image list for the tree
this.treeViewReportList.ImageList = CreateReportImageList();
//_subscriptionCollection = null;
try
{
// retrieve subscription
SetSubscriptionCollection();
if (_isMROrLater && _subscriptionCollection != null && !_isBostonOrLater)
{
this.wlbReportView1.btnSubscribe.Visible = true;
}
else
{
this.wlbReportView1.btnSubscribe.Visible = false;
}
this.wlbReportView1.btnLaterReport.Visible = false;
this.wlbReportView1.IsCreedenceOrLater = _isCreedenceOrLater;
PopulateTreeView();
}
catch (XenAdmin.CancelledException xc)
{
// User cancelled entering credentials when prompted by action
log.Debug(xc);
errorLoading = true;
}
catch (Exception ex)
{
log.Debug(ex, ex);
using (var dlg = new ThreeButtonDialog(new ThreeButtonDialog.Details(SystemIcons.Error, Messages.WLBREPORT_REPORT_CONFIG_ERROR, Messages.XENCENTER)))
{
dlg.ShowDialog(this);
}
errorLoading = true;
}
finally
{
if ((treeViewReportList != null) && (!errorLoading))
treeViewReportList.EndUpdate();
else
this.Close();
}
}
示例12: OnChangeOK_Refresh
/// <summary>
/// Update report treeView and subscription treeView
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void OnChangeOK_Refresh(object sender, EventArgs e)
{
try
{
// set _subscriptionCollection
SetSubscriptionCollection();
// Start update treeViews
if (_subscriptionCollection != null)
{
// Update subscription treeView must be before updating report treeView
this.UpdateSubscriptionTreeView();
// Update report treeView
this.UpdateReportTreeView();
// Rebuild panel if ReportSubscriptionView is visible
if (sender is WlbReportSubscriptionView)
{
this.subscriptionView1.BuildPanel();
}
}
}
catch (Exception ex)
{
log.Debug(ex, ex);
using (var dlg = new ThreeButtonDialog(new ThreeButtonDialog.Details(SystemIcons.Error, Messages.WLBREPORT_REPORT_CONFIG_ERROR, Messages.XENCENTER)))
{
dlg.ShowDialog(this);
}
this.Close();
}
}
示例13: deleteSavedSearch_Click
private void deleteSavedSearch_Click(object sender, EventArgs e)
{
var item = sender as ToolStripItem;
if (item == null)
return;
var search = item.Tag as Search;
if (search == null)
return;
using (var dlog = new ThreeButtonDialog(
new ThreeButtonDialog.Details(SystemIcons.Warning,
String.Format(Messages.DELETE_SEARCH_PROMPT, search.Name),
String.Format(Messages.DELETE_SEARCH, search.Name)),
ThreeButtonDialog.ButtonYes,
ThreeButtonDialog.ButtonNo))
{
if (dlog.ShowDialog(this) == DialogResult.Yes)
new SearchAction(search, SearchAction.Operation.delete).RunAsync();
}
}
示例14: ScanForSRs
private void ScanForSRs(SR.SRTypes type)
{
var srs = new List<SR.SRInfo>();
switch (type)
{
case SR.SRTypes.lvmohba:
var devices = FiberChannelScan();
if (devices != null && devices.Count > 0)
{
foreach (FibreChannelDevice device in devices)
{
string deviceId = string.IsNullOrEmpty(device.SCSIid) ? device.Path : device.SCSIid;
var metadataSrs = ScanDeviceForSRs(SR.SRTypes.lvmohba, deviceId, GetFCDeviceConfig(device));
if (metadataSrs != null && metadataSrs.Count > 0)
srs.AddRange(metadataSrs);
}
}
AddScanResultsToDataGridView(srs, SR.SRTypes.lvmohba);
break;
case SR.SRTypes.lvmoiscsi:
using (var dialog = new IscsiDeviceConfigDialog(Connection))
{
if (dialog.ShowDialog(this) == DialogResult.OK)
{
Dictionary<String, String> dconf = dialog.DeviceConfig;
string deviceId = string.IsNullOrEmpty(dconf[SCSIID]) ? dconf[LUNSERIAL] : dconf[SCSIID];
var metadataSrs = ScanDeviceForSRs(SR.SRTypes.lvmoiscsi, deviceId, dconf);
if (metadataSrs != null && metadataSrs.Count > 0)
srs.AddRange(metadataSrs);
}
}
AddScanResultsToDataGridView(srs, SR.SRTypes.lvmoiscsi);
break;
}
if (srs.Count == 0)
using (var dlg = new ThreeButtonDialog(
new ThreeButtonDialog.Details(SystemIcons.Information,
Messages.DR_WIZARD_STORAGEPAGE_SCAN_RESULT_NONE,
Messages.XENCENTER)))
{
dlg.ShowDialog(this);
}
}
示例15: 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);
}