本文整理汇总了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();
}
}