本文整理汇总了C#中SelectedItemCollection.AtLeastOneXenObjectCan方法的典型用法代码示例。如果您正苦于以下问题:C# SelectedItemCollection.AtLeastOneXenObjectCan方法的具体用法?C# SelectedItemCollection.AtLeastOneXenObjectCan怎么用?C# SelectedItemCollection.AtLeastOneXenObjectCan使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SelectedItemCollection
的用法示例。
在下文中一共展示了SelectedItemCollection.AtLeastOneXenObjectCan方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CanExecuteCore
protected override bool CanExecuteCore(SelectedItemCollection selection)
{
if (selection.AllItemsAre<VM_appliance>())
return selection.AtLeastOneXenObjectCan<VM_appliance>(CanStartAppliance);
if (selection.AllItemsAre<VM>())
{
var firstVm = (VM)selection.First;
if (firstVm.IsAssignedToVapp)
{
var firstVapp = firstVm.appliance;
if (selection.AsXenObjects<VM>().All(vm => vm.appliance != null && vm.appliance.opaque_ref == firstVapp.opaque_ref))
return CanStartAppliance(firstVm.Connection.Resolve(firstVapp));
}
}
return false;
}
示例2: CanExecuteCore
protected override bool CanExecuteCore(SelectedItemCollection selection)
{
Host hostAncestor = selection.HostAncestorFromConnection;
Pool poolAncestor = selection.PooAncestorFromConnection;
if ((poolAncestor != null || hostAncestor != null) //CA-61207: this check ensures there's no cross-pool selection
&& (selection.FirstIs<Pool>() || selection.FirstIs<Host>() || selection.FirstIsRealVM || selection.FirstIs<VM_appliance>()))
{
if (selection.AllItemsAre<VM>())
return selection.AtLeastOneXenObjectCan<VM>(CanExportVm);
if (selection.AllItemsAre<VM_appliance>())
{
if (selection.Count != 1)
return false;
var appliance = ((VM_appliance)selection.FirstAsXenObject);
return appliance.VMs.TrueForAll(vmRef =>
{
var vm = appliance.Connection.Resolve(vmRef);
return vm != null
&& CanExportVm(vm);
});
}
if ((hostAncestor != null && hostAncestor.enabled && hostAncestor.IsLive && selection[0].Connection.IsConnected)
|| (poolAncestor != null && Helpers.PoolHasEnabledHosts(poolAncestor)))
{
var vms = selection.FirstAsXenObject.Connection.Cache.VMs.Where(vm => vm.is_a_real_vm && CanExportVm(vm) && vm.Show(Properties.Settings.Default.ShowHiddenVMs)).ToList();
if (vms.Count > 0)
return vms.Any(CanExportVm);
}
}
return false;
}
示例3: CanExecuteCore
protected override bool CanExecuteCore(SelectedItemCollection selection)
{
return selection.AllItemsAre<Host>() && selection.AtLeastOneXenObjectCan<Host>(CanExecute);
}
示例4: CanExecuteCore
protected override bool CanExecuteCore(SelectedItemCollection selection)
{
if (selection.AllItemsAre<DockerContainer>())
return selection.AtLeastOneXenObjectCan<DockerContainer>(CanExecute);
return false;
}
示例5: CanExecuteCore
protected override bool CanExecuteCore(SelectedItemCollection selection)
{
return selection.ContainsOneItemOfType<Host>() && selection.AtLeastOneXenObjectCan<Host>(CanExecute);
}
示例6: CanExecuteCore
protected override bool CanExecuteCore(SelectedItemCollection selection)
{
return selection.ContainsOneItemOfType<VM>() && selection.AtLeastOneXenObjectCan<VM>(v => v.is_a_snapshot);
}