当前位置: 首页>>代码示例>>C#>>正文


C# SelectedItemCollection.AllItemsAre方法代码示例

本文整理汇总了C#中SelectedItemCollection.AllItemsAre方法的典型用法代码示例。如果您正苦于以下问题:C# SelectedItemCollection.AllItemsAre方法的具体用法?C# SelectedItemCollection.AllItemsAre怎么用?C# SelectedItemCollection.AllItemsAre使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SelectedItemCollection的用法示例。


在下文中一共展示了SelectedItemCollection.AllItemsAre方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CanExecuteCore

        protected override bool CanExecuteCore(SelectedItemCollection selection)
        {
            if (selection.AllItemsAre<IStorageLinkObject>())
            {
                StorageLinkConnection con = ((IStorageLinkObject)selection.First).StorageLinkConnection;

                // check all selected SL items are on the same SL connection.
                if (con != null && con.ConnectionState == StorageLinkConnectionState.Connected && selection.AllItemsAre<IStorageLinkObject>(s => s.StorageLinkConnection.Equals(con)))
                {
                    return true;
                }
            }
            return false;

        }
开发者ID:agimofcarmen,项目名称:xenadmin,代码行数:15,代码来源:AddStorageLinkSystemCommand.cs

示例2: ExecuteCore

 protected override void ExecuteCore(SelectedItemCollection selection)
 {
     if (selection != null && selection.AllItemsAre<IXenObject>(x => x is Host || x is Pool))
         MainWindowCommandInterface.ShowForm(typeof(BugToolWizard), selection.AsXenObjects<IXenObject>().ToArray());
     else
         MainWindowCommandInterface.ShowForm(typeof(BugToolWizard));
 }
开发者ID:huizh,项目名称:xenadmin,代码行数:7,代码来源:BugToolCommand.cs

示例3: 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;
        }
开发者ID:huizh,项目名称:xenadmin,代码行数:18,代码来源:VappStartCommand.cs

示例4: ExecuteCore

        protected override void ExecuteCore(SelectedItemCollection selection)
        {
            var appsToStart = new List<VM_appliance>();

            if (selection.AllItemsAre<VM_appliance>())
            {
                appsToStart = (from IXenObject obj in selection.AsXenObjects()
                               let app = (VM_appliance)obj
                               where CanStartAppliance(app)
                               select app).ToList();
            }
            else if (selection.AllItemsAre<VM>())
            {
                var firstVm = (VM)selection.First;
                appsToStart.Add(firstVm.Connection.Resolve(firstVm.appliance));
            }

            foreach (var app in appsToStart)
                (new StartApplianceAction(app, false)).RunAsync();
        }
开发者ID:huizh,项目名称:xenadmin,代码行数:20,代码来源:VappStartCommand.cs

示例5: 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;
        }
开发者ID:ushamandya,项目名称:xenadmin,代码行数:36,代码来源:ExportCommand.cs

示例6: ExecuteCore

        protected override void ExecuteCore(SelectedItemCollection selection)
        {
            var dockerContainers = new List<DockerContainer>();

            if (selection.AllItemsAre<DockerContainer>())
            {
                dockerContainers = (from IXenObject obj in selection.AsXenObjects()
                                    let container = (DockerContainer)obj
                                    where CanExecute(container)
                                    select container).ToList();
            }

            foreach (var container in dockerContainers)
                (new StartDockerContainerAction(container)).RunAsync();
        }
开发者ID:huizh,项目名称:xenadmin,代码行数:15,代码来源:StartDockerContainerCommand.cs

示例7: CanExecuteCore

        protected override bool CanExecuteCore(SelectedItemCollection selection)
        {
            if (selection.AllItemsAre<IStorageLinkObject>())
            {
                var connections = new List<StorageLinkConnection>();

                foreach (IStorageLinkObject s in selection.AsXenObjects<IStorageLinkObject>())
                {
                    if (s.StorageLinkConnection.ConnectionState != StorageLinkConnectionState.Connected)
                    {
                        return false;
                    }
                }
                return true;
            }
            return false;
        }
开发者ID:agimofcarmen,项目名称:xenadmin,代码行数:17,代码来源:RefreshStorageLinkConnectionCommand.cs

示例8: CanExecuteCore

        protected override bool CanExecuteCore(SelectedItemCollection selection)
        {
            // you can only remove a storagelink server from XC if there isn't an SR using it.

            List<StorageLinkConnection> slCons = new List<StorageLinkConnection>();

            if (selection.AllItemsAre<IStorageLinkObject>())
            {
                foreach (IStorageLinkObject s in selection.AsXenObjects())
                {
                    if (!slCons.Contains(s.StorageLinkConnection))
                    {
                        slCons.Add(s.StorageLinkConnection);
                    }
                }
            }
            return slCons.Count == 1;
        }
开发者ID:agimofcarmen,项目名称:xenadmin,代码行数:18,代码来源:SetStorageLinkLicenseServerCommand.cs

示例9: IsValid

            public override bool IsValid(SelectedItemCollection selection)
            {
                List<string> types = new List<string>();

                if (selection.AllItemsAre<IXenObject>())
                {
                    foreach (SelectedItem item in selection)
                    {
                        string name = item.XenObject.GetType().Name;

                        VM vm = item.XenObject as VM;

                        if (vm != null && vm.is_a_template)
                        {
                            name = vm.is_a_snapshot ? "snapshot" : "template";
                        }

                        if (!types.Contains(name))
                        {
                            types.Add(name);
                        }
                    }
                }

                if (types.Count > 1)
                {
                    // if types only contains a mix of vms and templates then don't use this Builder. MixedVMsAndTemplates should be used instead.
                    types.Remove("VM");
                    types.Remove("template");
                    return types.Count > 0;
                }
                return false;
            }
开发者ID:robhoes,项目名称:xenadmin,代码行数:33,代码来源:ContextMenuBuilder.cs

示例10: CanExecuteCore

 protected override bool CanExecuteCore(SelectedItemCollection selection)
 {
     return selection.AllItemsAre<StorageLinkSystem>();
 }
开发者ID:agimofcarmen,项目名称:xenadmin,代码行数:4,代码来源:RemoveStorageLinkSystemCommand.cs

示例11: CanExecuteCore

            protected override bool CanExecuteCore(SelectedItemCollection selection)
            {
                if (!selection.AllItemsAre<VM>())
                {
                    return false;
                }

                IXenConnection connection = null;

                bool atLeaseOneCanExecute = false;
                foreach (SelectedItem item in selection)
                {
                    VM vm = (VM)item.XenObject;

                    // all VMs must be on the same connection
                    if (connection != null && vm.Connection != connection)
                    {
                        return false;
                    }

                    if (CanExecute(item.XenObject as VM))
                    {
                        atLeaseOneCanExecute = true;
                    }
                }
                return atLeaseOneCanExecute;
            }
开发者ID:slamj1,项目名称:xenadmin,代码行数:27,代码来源:MigrateVMToolStripMenuItem.cs

示例12: CanExecuteCore

        protected override bool CanExecuteCore(SelectedItemCollection selection)
        {
            if (!selection.AllItemsAre<Host>())
            {
                return false;
            }

            foreach (SelectedItem item in selection)
            {
                if (CanExecute((Host)item.XenObject))
                {
                    return true;
                }
            }
            return false;
        }
开发者ID:ChrisH4rding,项目名称:xenadmin,代码行数:16,代码来源:RebootHostCommand.cs

示例13: CanExecuteCore

 protected override bool CanExecuteCore(SelectedItemCollection selection)
 {
     if (!selection.AllItemsAre<Host>() || selection.Count > 1)
     {
         return false;
     }
     
     return CanExecute(selection.AsXenObjects<Host>().First());
 }
开发者ID:huizh,项目名称:xenadmin,代码行数:9,代码来源:DestroyHostCommand.cs

示例14: CanExecuteCore

 protected override bool CanExecuteCore(SelectedItemCollection selection)
 {
     if (selection.AllItemsAre<DockerContainer>())
         return selection.AtLeastOneXenObjectCan<DockerContainer>(CanExecute);
     return false;
 }
开发者ID:huizh,项目名称:xenadmin,代码行数:6,代码来源:StartDockerContainerCommand.cs

示例15: CanExecuteCore

 protected override bool CanExecuteCore(SelectedItemCollection selection)
 {
     return selection.AllItemsAre<Host>() && selection.AtLeastOneXenObjectCan<Host>(CanExecute);
 }
开发者ID:ushamandya,项目名称:xenadmin,代码行数:4,代码来源:ShutDownHostCommand.cs


注:本文中的SelectedItemCollection.AllItemsAre方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。