本文整理匯總了C#中XenAdmin.Actions.AsyncAction.GetType方法的典型用法代碼示例。如果您正苦於以下問題:C# AsyncAction.GetType方法的具體用法?C# AsyncAction.GetType怎麽用?C# AsyncAction.GetType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類XenAdmin.Actions.AsyncAction
的用法示例。
在下文中一共展示了AsyncAction.GetType方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ButtonApply_Click
/// <summary>
/// Apply optimization to a pool
/// </summary>
/// <param name="sender">object</param>
/// <param name="e">EventArgs</param>
private void ButtonApply_Click(object sender, EventArgs e)
{
if (this._pool == null)
return;
applyButton.Enabled = false;
action = HelpersGUI.FindActiveOptAction(_xenObject.Connection);
if ((action != null && action.GetType() != typeof(WlbOptimizePoolAction)) || action == null)
{
new WlbOptimizePoolAction(_pool, _vmOptList, _optId).RunAsync();
// Switch to logs tab, since this action takes a while and there's no feedback on the HA tab
Program.MainWindow.SwitchToTab(MainWindow.Tab.History);
Program.MainWindow.UpdateToolbars();
}
}
示例2: BuildRecList
/// <summary>
/// Build optimize pool list view properly
/// </summary>
private void BuildRecList()
{
Program.AssertOnEventThread();
if(_xenObject == null)
return;
if (Helpers.WlbEnabled(_xenObject.Connection))
{
try
{
if (_xenObject is Pool)
{
_pool = (Pool)_xenObject;
// get any active WLB action
action = HelpersGUI.FindActiveWLBAction(_xenObject.Connection);
// make sure we are not initializing, starting or stopping WLB
if (action is DisableWLBAction || action is EnableWLBAction || action is InitializeWLBAction)
return;
optimizePoolListView.BeginUpdate();
// check whether optimize pool is running before load optimize pool listview
if ((action != null && action is WlbOptimizePoolAction)
|| (action == null && _pool.other_config.ContainsKey(WlbOptimizationRecommendation.OPTIMIZINGPOOL)
&& _pool.other_config[WlbOptimizationRecommendation.OPTIMIZINGPOOL] == Messages.IN_PROGRESS))
{
//statusLabel.Text = Messages.WLB_OPT_OPTIMIZING;
this.applyButton.Text = Messages.WLB_OPT_OPTIMIZING;
EnableControls(false, false);
}
else if (action == null || (action != null && action.GetType() != typeof(WlbRetrieveRecommendationAction)))
{
this.applyButton.Text = Messages.WLB_OPT_APPLY_RECOMMENDATIONS;
// retrieve recommendations, and load optimize pool listview properly
WlbRetrieveRecommendationAction optAction = new WlbRetrieveRecommendationAction(_pool);
optAction.Completed += this.OptRecRetrieveAction_Completed;
optAction.RunAsync();
}
}
}
catch (Failure f)
{
statusLabel.Text = Messages.WLB_OPT_LOADING_ERROR;
log.Error(f, f);
}
catch (Exception e)
{
statusLabel.Text = Messages.WLB_OPT_LOADING_ERROR;
log.ErrorFormat("There was an error calling retrieve_wlb_recommendations on pool {0}", _pool.name_label);
log.Error(e, e);
}
finally
{
optimizePoolListView.EndUpdate();
}
}
else
{
this.WLBOptDisable(true);
}
}
示例3: ButtonApply_Click
/// <summary>
/// Apply optimization to a pool
/// </summary>
/// <param name="sender">object</param>
/// <param name="e">EventArgs</param>
private void ButtonApply_Click(object sender, EventArgs e)
{
if (this._pool == null)
return;
applyButton.Enabled = false;
action = HelpersGUI.FindActiveOptAction(_xenObject.Connection);
if ((action != null && action.GetType() != typeof(WlbOptimizePoolAction)) || action == null)
{
new WlbOptimizePoolAction(_pool, _vmOptList, _optId).RunAsync();
Program.MainWindow.UpdateToolbars();
}
}