本文整理汇总了C#中XenAdmin.Dialogs.ActionProgressDialog类的典型用法代码示例。如果您正苦于以下问题:C# ActionProgressDialog类的具体用法?C# ActionProgressDialog怎么用?C# ActionProgressDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ActionProgressDialog类属于XenAdmin.Dialogs命名空间,在下文中一共展示了ActionProgressDialog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExecuteCore
protected override void ExecuteCore(SelectedItemCollection selection)
{
ApplyLicenseEditionAction action = new ApplyLicenseEditionAction(xos, _edition, _licenseServerAddress, _licenseServerPort, null);
ActionProgressDialog actionProgress = new ActionProgressDialog(action, ProgressBarStyle.Marquee);
// close dialog even when there's an error as this action shows its own error dialog box.
action.Completed += s =>
{
Program.Invoke(Program.MainWindow, () =>
{
Failure f = action.Exception as Failure;
if (f != null && f.ErrorDescription[0] == Failure.RBAC_PERMISSION_DENIED_FRIENDLY)
return;
actionProgress.Close();
});
if (action.Exception != null)
{
ShowLicensingFailureDialog(action.LicenseFailures, action.Exception.Message, Parent);
}
};
actionProgress.ShowDialog(Parent);
if (actionProgress.action.Succeeded)
{
InvokeSuccedded(null);
}
}
示例2: ExecuteCore
protected override void ExecuteCore(SelectedItemCollection selection)
{
foreach (SR sr in selection.AsXenObjects<SR>(CanExecute))
{
SrShareAction action = new SrShareAction(sr.Connection, sr);
ActionProgressDialog dialog = new ActionProgressDialog(action, ProgressBarStyle.Marquee);
dialog.ShowCancel = true;
dialog.ShowDialog(Parent);
}
}
示例3: ScanForHeartbeatSRs
/// <summary>
///
/// </summary>
/// <returns>Whether any SRs suitable for heartbeating were found.</returns>
internal bool ScanForHeartbeatSRs()
{
System.Diagnostics.Trace.Assert(pool != null);
// Start action and show progress with a dialog
GetHeartbeatSRsAction action = new GetHeartbeatSRsAction(pool);
ActionProgressDialog dialog = new ActionProgressDialog(action, ProgressBarStyle.Blocks);
dialog.ShowCancel = true;
dialog.ShowDialog(this);
if (dialog.action.Cancelled || dialog.action.Cancelling || !dialog.action.IsCompleted)
return false;
if (!action.Succeeded || action.SRs.Count == 0)
{
dataGridViewExSRs.Enabled = false;
return true;
}
dataGridViewExSRs.Enabled = true;
List<SRWrapper> srs = action.SRs;
srs.Sort((a, b) => a.enabled != b.enabled
? b.enabled.CompareTo(a.enabled)
: (a.sr.NameWithoutHost.CompareTo(b.sr.NameWithoutHost)));
dataGridViewExSRs.Rows.Clear();
foreach (SRWrapper srWrapper in srs)
{
var row = new StorageRow(srWrapper);
dataGridViewExSRs.Rows.Add(row);
row.Enabled = srWrapper.enabled;
// coming forward to this page after having already been through it once
if (selectedHeartbeatSR != null && srWrapper.sr.opaque_ref == selectedHeartbeatSR.opaque_ref)
{
if (srWrapper.enabled)
row.Selected = true;
else
{
selectedHeartbeatSR = null;
OnPageUpdated();
}
}
}
return true;
}
示例4: buttonResolveAll_Click
private void buttonResolveAll_Click(object sender, EventArgs e)
{
Dictionary<AsyncAction, AsyncAction> actions = new Dictionary<AsyncAction, AsyncAction>();
foreach (DataGridViewRow row in dataGridView1.Rows)
{
PreCheckItemRow preCheckRow = row as PreCheckItemRow;
if (preCheckRow != null && preCheckRow.Problem != null)
{
bool cancelled;
AsyncAction action = preCheckRow.Problem.SolveImmediately(out cancelled);
if (action != null)
{
actions.Add(action, preCheckRow.Problem.UnwindChanges());
}
}
}
foreach (var asyncAction in actions.Keys)
{
_progressDialog = new ActionProgressDialog(asyncAction, ProgressBarStyle.Blocks);
_progressDialog.ShowDialog(this);
if (asyncAction.Succeeded && actions[asyncAction] != null)
RevertActions.Add(actions[asyncAction]);
Program.Invoke(Program.MainWindow, RefreshRechecks);
}
Program.Invoke(Program.MainWindow, RefreshRechecks);
}
示例5: SaveWLBConfig
private void SaveWLBConfig(WlbPoolConfiguration PoolConfiguration)
{
Dictionary<string, string> completeConfiguration = PoolConfiguration.ToDictionary();
SendWlbConfigurationKind kind = SendWlbConfigurationKind.SetPoolConfiguration;
// check for host configurations in the pool configuration
if (PoolConfiguration.HostConfigurations.Count > 0)
{
// add the flag denoting that there are host configs to be saved
kind |= SendWlbConfigurationKind.SetHostConfiguration;
// get the key for each host config (host.uuid)
foreach (string key in PoolConfiguration.HostConfigurations.ToDictionary().Keys)
{
//Drop any exising copy from the pool configuration
if (completeConfiguration.ContainsKey(key))
{
completeConfiguration.Remove(key);
}
// and add the task to the collection
completeConfiguration.Add(key, PoolConfiguration.HostConfigurations.ToDictionary()[key]);
}
}
// check for scheduled tasks in the pool configuration
if (PoolConfiguration.ScheduledTasks.TaskList.Count > 0)
{
// add the flag denoting that there are scheduled tasks to be saved
kind |= SendWlbConfigurationKind.SetScheduledTask;
// get the key for each scheduled task
foreach (string key in PoolConfiguration.ScheduledTasks.ToDictionary().Keys)
{
//Drop any exising copy from the pool configuration
if (completeConfiguration.ContainsKey(key))
{
completeConfiguration.Remove(key);
}
// and add the task to the collection
completeConfiguration.Add(key, PoolConfiguration.ScheduledTasks.ToDictionary()[key]);
}
}
SendWlbConfigurationAction action = new SendWlbConfigurationAction(_pool, PoolConfiguration.ToDictionary(), kind);
ActionProgressDialog dialog = new ActionProgressDialog(action, ProgressBarStyle.Blocks);
dialog.ShowCancel = true;
dialog.ShowDialog(this);
Program.MainWindow.UpdateToolbars();
}
示例6: 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;
}
}
示例7: buttonResolveAll_Click
private void buttonResolveAll_Click(object sender, EventArgs e)
{
List<AsyncAction> actions = new List<AsyncAction>();
foreach (DataGridViewRow row in dataGridView1.Rows)
{
PreCheckHostRow preCheckHostRow = row as PreCheckHostRow;
if (preCheckHostRow != null && preCheckHostRow.Problem != null)
{
bool cancelled;
AsyncAction action = preCheckHostRow.Problem.SolveImmediately(out cancelled);
if (action != null)
actions.Add(action);
}
}
foreach (var asyncAction in actions)
{
_progressDialog = new ActionProgressDialog(asyncAction, ProgressBarStyle.Blocks);
_progressDialog.ShowDialog(this);
Program.Invoke(Program.MainWindow, RefreshRechecks);
}
Program.Invoke(Program.MainWindow, RefreshRechecks);
}
示例8: linkLabel1_LinkClicked
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
NewSRWizard wizard = new NewSRWizard(Connection);
wizard.CheckNFSISORadioButton();
if (wizard.ShowDialog() == DialogResult.Cancel)
return;
// Return if we lost connection
if (Connection == null || Helpers.GetPoolOfOne(Connection) == null)
{
log.Error("Page_InstallationMedia: connection to the server was lost");
return;
}
// There's a chance the cd radio button was disabled because we didnt have any isos to select from, so refresh that bool
// and the enablement of that button.
cds = Helpers.CDsExist(Connection);
CdRadioButton.Enabled = (installed || installCd) && cds;
// We can get a lot of refresh flickering in the ISO box as all the VDIs are discovered
// Possibly slightly rude, but were going to have a pretend action here which gives it some breathing space before we look for VDIs
DelegatedAsyncAction waitAction = new DelegatedAsyncAction(Connection, Messages.SR_REFRESH_ACTION_DESC, Messages.SR_REFRESH_ACTION_DESC, Messages.COMPLETED,
delegate
{
System.Threading.Thread.Sleep(10000);
}, true);
using (var dlg = new ActionProgressDialog(waitAction, System.Windows.Forms.ProgressBarStyle.Marquee))
dlg.ShowDialog(this);
// Set the connection on the drop down iso box. This causes a complete refresh rather than a mini one - otherwise we miss out on
// getting event handlers for the new SR
CdDropDownBox.connection = Connection;
}
示例9: SetSubscriptionCollection
/// <summary>
/// Retrieve subscriptions and set _subscriptionCollection
/// </summary>
private void SetSubscriptionCollection()
{
_subscriptionCollection = null;
WlbPoolConfiguration poolConfiguration;
RetrieveWlbConfigurationAction action = new RetrieveWlbConfigurationAction(_pool);
using (var dialog = new ActionProgressDialog(action, ProgressBarStyle.Blocks))
{
dialog.ShowCancel = true;
dialog.ShowDialog(this);
}
if (action.Succeeded)
{
poolConfiguration = new WlbPoolConfiguration(action.WlbConfiguration);
_isMROrLater = poolConfiguration.IsMROrLater;
_isBostonOrLater = poolConfiguration.IsBostonOrLater;
_isCreedenceOrLater = poolConfiguration.IsCreedenceOrLater;
if (_isMROrLater && !_isBostonOrLater)
{
_subscriptionCollection = new WlbReportSubscriptionCollection(action.WlbConfiguration);
}
if (_isBostonOrLater)
{
this.splitContainerLeftPane.Panel2Collapsed = true;
this.wlbReportView1.btnSubscribe.Visible=false;
}
}
else
{
throw (action.Exception);
}
}
示例10: DownloadAndInstall
private void DownloadAndInstall()
{
if (dataGridViewUpdates.SelectedRows.Count == 0)
return;
XenServerPatchAlert patchAlert = dataGridViewUpdates.SelectedRows[0].Tag as XenServerPatchAlert;
if (patchAlert == null)
return;
string patchUri = patchAlert.Patch.PatchUrl;
if (string.IsNullOrEmpty(patchUri))
return;
Uri address = new Uri(patchUri);
string tempFile = Path.GetTempFileName();
var action = new DownloadAndUnzipXenServerPatchAction(patchAlert.Description, address, tempFile);
ActionProgressDialog dialog = new ActionProgressDialog(action, ProgressBarStyle.Continuous, false) { ShowCancel = true };
dialog.ShowDialog(this);
if (action.Succeeded)
{
var wizard = new PatchingWizard();
wizard.Show();
wizard.NextStep();
wizard.AddFile(action.PatchPath);
wizard.NextStep();
if (patchAlert.Hosts.Count > 0)
{
wizard.SelectServers(patchAlert.Hosts);
wizard.NextStep();
}
else
{
string disconnectedServerNames =
dataGridViewUpdates.SelectedRows[0].Cells[ColumnAppliesTo.Index].Value.ToString();
new ThreeButtonDialog(
new ThreeButtonDialog.Details(SystemIcons.Warning,
string.Format(Messages.UPDATES_WIZARD_DISCONNECTED_SERVER,
disconnectedServerNames),
Messages.UPDATES_WIZARD)).ShowDialog(this);
}
}
}
示例11: ButtonRemove_Click
private void ButtonRemove_Click(object sender, EventArgs e)
{
Program.AssertOnEventThread();
// Double check, this method is called from a context menu as well and the state could have changed under it
if (!ButtonRemove.Enabled)
return;
List<Subject> subjectsToRemove = new List<Subject>();
foreach (AdSubjectRow r in GridViewSubjectList.SelectedRows)
subjectsToRemove.Add(r.subject);
var removeMessage = subjectsToRemove.Count == 1
? string.Format(Messages.QUESTION_REMOVE_AD_USER_ONE, subjectsToRemove[0].DisplayName ?? subjectsToRemove[0].SubjectName)
: string.Format(Messages.QUESTION_REMOVE_AD_USER_MANY, subjectsToRemove.Count);
DialogResult questionDialog = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
null,
removeMessage,
Messages.AD_FEATURE_NAME),
ThreeButtonDialog.ButtonYes,
new ThreeButtonDialog.TBDButton(Messages.NO_BUTTON_CAPTION, DialogResult.No, ThreeButtonDialog.ButtonType.CANCEL, true)).ShowDialog(this);
//CA-64818: DialogResult can be No if the No button has been hit
//or Cancel if the dialog has been closed from the control box
if (questionDialog != DialogResult.Yes)
return;
// Warn if user is revoking his currently-in-use credentials
Session session = pool.Connection.Session;
if (session != null && session.Subject != null)
{
foreach (Subject entry in subjectsToRemove)
{
if (entry.opaque_ref == session.Subject)
{
string subjectName = entry.DisplayName ?? entry.SubjectName;
if (subjectName == null)
{
subjectName = entry.subject_identifier;
}
else
{
subjectName = subjectName.Ellipsise(256);
}
string msg = string.Format(entry.IsGroup ? Messages.AD_CONFIRM_SUICIDE_GROUP : Messages.AD_CONFIRM_SUICIDE,
subjectName, Helpers.GetName(pool).Ellipsise(50));
DialogResult r = new ThreeButtonDialog(
new ThreeButtonDialog.Details(
SystemIcons.Warning,
msg,
Messages.AD_FEATURE_NAME),
ThreeButtonDialog.ButtonYes,
new ThreeButtonDialog.TBDButton(Messages.NO_BUTTON_CAPTION, DialogResult.No, ThreeButtonDialog.ButtonType.CANCEL, true)).ShowDialog(this);
//CA-64818: DialogResult can be No if the No button has been hit
//or Cancel if the dialog has been closed from the control box
if (r != DialogResult.Yes)
return;
break;
}
}
}
removeUserDialog = new ActionProgressDialog(
new AddRemoveSubjectsAction(pool, new List<string>(), subjectsToRemove), ProgressBarStyle.Continuous);
removeUserDialog.ShowDialog();
}
示例12: PageLeave
public override void PageLeave(PageLoadedDirection direction, ref bool cancel)
{
if (direction == PageLoadedDirection.Back)
return;
// For Miami hosts we need to ensure an SR.probe()
// has been performed, and that the user has made a decision. Show the iSCSI choices dialog until
// they click something other than 'Cancel'. For earlier host versions, warn that data loss may
// occur.
Host master = Helpers.GetMaster(Connection);
if (master == null)
{
cancel = true;
return;
}
Dictionary<String, String> dconf = DeviceConfig;
if (dconf == null)
{
cancel = true;
return;
}
// Start probe
SrProbeAction IscsiProbeAction = new SrProbeAction(Connection, master, SR.SRTypes.lvmoiscsi, dconf);
using (var dialog = new ActionProgressDialog(IscsiProbeAction, ProgressBarStyle.Marquee))
{
dialog.ShowCancel = true;
dialog.ShowDialog(this);
}
// Probe has been performed. Now ask the user if they want to Reattach/Format/Cancel.
// Will return false on cancel
cancel = !ExamineIscsiProbeResults(IscsiProbeAction);
iscsiProbeError = cancel;
base.PageLeave(direction, ref cancel);
}
示例13: buttonCifsScan_Click
private void buttonCifsScan_Click(object sender, EventArgs e)
{
try
{
CifsScanButton.Enabled = false;
// Perform an SR.probe to see if there is already an SR present
Dictionary<String, String> dconf = new Dictionary<String, String>();
string[] fullpath = CifsServerPathTextBox.Text.Split(new char[] { ':' });
dconf[SERVER] = fullpath[0];
if (fullpath.Length > 1)
{
dconf[SERVERPATH] = fullpath[1];
}
if (userNameTextBox.Text.Trim().Length > 0 || passwordTextBox.Text.Trim().Length > 0)
{
dconf["username"] = userNameTextBox.Text;
dconf["password"] = passwordTextBox.Text;
}
Host master = Helpers.GetMaster(Connection);
if (master == null)
return;
// Start probe
SrProbeAction action = new SrProbeAction(Connection, master, SR.SRTypes.smb, dconf);
using (var dialog = new ActionProgressDialog(action, ProgressBarStyle.Marquee))
{
dialog.ShowCancel = true;
dialog.ShowDialog(this);
}
if (radioButtonCifsNew.Enabled)
radioButtonCifsNew.Checked = true;
listBoxCifsSRs.Items.Clear();
if (!action.Succeeded)
return;
List<SR.SRInfo> SRs = SR.ParseSRListXML(action.Result);
if (SRs.Count == 0)
{
// Disable box
ToggleReattachControlsEnabledState(false);
listBoxCifsSRs.Items.Add(Messages.NEWSR_NO_SRS_FOUND);
return;
}
// Fill box
foreach(SR.SRInfo info in SRs)
listBoxCifsSRs.Items.Add(info);
listBoxCifsSRs.TryAndSelectUUID();
ToggleReattachControlsEnabledState(true);
}
finally
{
UpdateButtons();
}
}
示例14: LoadPoolMetadata
private void LoadPoolMetadata(VDI vdi)
{
Session metadataSession = null;
try
{
VdiLoadMetadataAction action = new VdiLoadMetadataAction(Connection, vdi);
ActionProgressDialog dialog = new ActionProgressDialog(action, ProgressBarStyle.Marquee);
dialog.ShowDialog(this); //Will block until dialog closes, action completed
if (action.Succeeded && action.MetadataSession != null)
{
metadataSession = action.MetadataSession;
XenRef<VDI> vdiRef = new XenRef<VDI>(vdi);
if (action.PoolMetadata != null && !allPoolMetadata.ContainsKey(vdiRef))
{
allPoolMetadata.Add(vdiRef, action.PoolMetadata);
}
}
}
finally
{
if (metadataSession != null)
metadataSession.logout();
}
}
示例15: GetServerReportsConfig
/// <summary>
/// Invokes and executes a call to the Kirkwood database via Xapi
/// to obtain report configuration data including the actual
/// rdlc report definitions
/// </summary>
/// <returns>Report definition list XML document</returns>
private XmlDocument GetServerReportsConfig()
{
string returnValue;
XmlDocument xmlReportsDoc = new XmlDocument();
string reportName = "get_report_definitions";
// Parameters
Dictionary<string, string> parms = new Dictionary<string, string>();
parms.Add("LocaleCode", Program.CurrentLanguage);
if (_isCreedenceOrLater)
{
parms.Add("ReportVersion", "Creedence");
parms.Add("PoolId", _pool.uuid);
}
AsyncAction action = new WlbReportAction(_pool.Connection,
Helpers.GetMaster(_pool.Connection),
reportName,
Messages.WLB_REPORT_DEFINITIONS,
true,
parms);
using (var dlg = new ActionProgressDialog(action, ProgressBarStyle.Marquee))
dlg.ShowDialog();
returnValue = action.Result;
if ((action.Succeeded) && (!String.IsNullOrEmpty(returnValue)))
{
try
{
xmlReportsDoc.LoadXml(returnValue);
string rdlcText;
foreach (XmlNode currentRdlc in xmlReportsDoc.SelectNodes(@"Reports/Report/Rdlc"))
{
rdlcText = currentRdlc.InnerText;
currentRdlc.InnerText = String.Empty;
currentRdlc.InnerText = rdlcText;
}
}
catch (Exception)
{
xmlReportsDoc = null;
}
}
return xmlReportsDoc;
}