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


C# SelectedItemCollection.AsXenObjects方法代码示例

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


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

示例1: 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

示例2: ExecuteCore

        protected override void ExecuteCore(SelectedItemCollection selection)
        {
            List<Folder> folders = new List<Folder>(selection.AsXenObjects<Folder>(CanExecute));

            folders.RemoveAll((Predicate<Folder>)delegate(Folder folder)
            {
                // if the list contains any folders that are children to others in the list then
                // they will automatically get deleted, so remove them here.

                foreach (Folder f in folders)
                {
                    if (folder.opaque_ref.StartsWith(f.opaque_ref + "/"))
                    {
                        return true;
                    }
                }
                return false;
            });

            List<AsyncAction> actions = new List<AsyncAction>();
            foreach (Folder folder in folders)
            {
                actions.Add(new FolderAction((IXenObject)folder, null, FolderAction.Kind.Delete));
            }
            RunMultipleActions(actions, Messages.DELETING_FOLDERS, Messages.DELETING_FOLDERS, Messages.DELETED_FOLDERS, true);
        }
开发者ID:huizh,项目名称:xenadmin,代码行数:26,代码来源:DeleteFolderCommand.cs

示例3: ExecuteCore

        protected sealed override void ExecuteCore(SelectedItemCollection selection)
        {
            ConfirmVMDeleteDialog dialog = new ConfirmVMDeleteDialog(selection.AsXenObjects<VM>());

            if (MainWindowCommandInterface.RunInAutomatedTestMode || dialog.ShowDialog(Parent) == DialogResult.Yes)
            {
                CommandErrorDialog errorDialog = null;
                Dictionary<SelectedItem, string> cantExecuteReasons = GetCantExecuteReasons();

                if (cantExecuteReasons.Count > 0)
                {
                    errorDialog = new CommandErrorDialog(ErrorDialogTitle, ErrorDialogText, GetCantExecuteReasons());
                }

                List<AsyncAction> actions = new List<AsyncAction>();
                foreach (VM vm in selection.AsXenObjects<VM>(CanExecute))
                {
                    var snapshotsToDelete = dialog.DeleteSnapshots.FindAll(x => x.Connection.Resolve(x.snapshot_of) == vm);
                    actions.Add(GetAction(vm, dialog.DeleteDisks, snapshotsToDelete));
                }
                RunMultipleActions(actions, Messages.ACTION_VMS_DESTROYING_TITLE, Messages.ACTION_VM_DESTROYING, Messages.ACTION_VM_DESTROYED, true);

                if (errorDialog != null)
                {
                    errorDialog.ShowDialog(Parent);
                }
            }
        }
开发者ID:huizh,项目名称:xenadmin,代码行数:28,代码来源:DeleteVMCommand.cs

示例4: ExecuteCore

 protected override void ExecuteCore(SelectedItemCollection selection)
 {
     List<AsyncAction> actions = new List<AsyncAction>();
     foreach (SR sr in selection.AsXenObjects<SR>(CanExecute))
     {
         actions.Add(new SrAction(SrActionKind.Destroy, sr));
     }
     RunMultipleActions(actions, Messages.ACTION_SRS_DESTROYING, string.Empty, string.Empty, true);
 }
开发者ID:agimofcarmen,项目名称:xenadmin,代码行数:9,代码来源:DestroySRCommand.cs

示例5: ExecuteCore

 protected override void ExecuteCore(SelectedItemCollection selection)
 {
     var actions = new List<AsyncAction>();
     foreach (SR sr in selection.AsXenObjects<SR>(CanExecute))
     {
         actions.Add(new SrTrimAction(sr.Connection, sr));
     }
     RunMultipleActions(actions, null, Messages.ACTION_SR_TRIM_DESCRIPTION, Messages.ACTION_SR_TRIM_DONE, true);
 }
开发者ID:agimofcarmen,项目名称:xenadmin,代码行数:9,代码来源:TrimSRCommand.cs

示例6: ExecuteCore

 protected override void ExecuteCore(SelectedItemCollection selection)
 {
     List<AsyncAction> actions = new List<AsyncAction>();
     foreach (SR sr in selection.AsXenObjects<SR>(CanExecute))
     {
         actions.Add(new SrAction(SrActionKind.Detach, sr));
     }
     RunMultipleActions(actions, Messages.ACTION_SRS_DETACHING, Messages.ACTION_SRS_DETACHING, Messages.ACTION_SRS_DETACH_SUCCESSFUL, true);
 }
开发者ID:huizh,项目名称:xenadmin,代码行数:9,代码来源:DetachSRCommand.cs

示例7: ExecuteCore

 protected override void ExecuteCore(SelectedItemCollection selection)
 {
     List<AsyncAction> actions = new List<AsyncAction>();
     foreach (VM vm in selection.AsXenObjects<VM>())
     {
         actions.Add(new VMSnapshotDeleteAction(vm));
     }
     RunMultipleActions(actions, Messages.ACTION_VM_DELETE_SNAPSHOTS_TITLE, Messages.SNAPSHOT_DELETING, Messages.SNAPSHOTS_DELETED, true);
 }
开发者ID:huizh,项目名称:xenadmin,代码行数:9,代码来源:DeleteSnapshotCommand.cs

示例8: ExecuteCore

 protected override void ExecuteCore(SelectedItemCollection selection)
 {
     List<AsyncAction> actions = new List<AsyncAction>();
     foreach (SR sr in selection.AsXenObjects<SR>(CanExecute))
     {
         actions.Add(new SrAction(SrActionKind.UpgradeLVM, sr));
     }
     RunMultipleActions(actions, Messages.ACTION_SRS_UPGRADE, Messages.ACTION_SRS_UPGRADING, Messages.ACTION_SRS_UPGRADED, true);
 }
开发者ID:agimofcarmen,项目名称:xenadmin,代码行数:9,代码来源:UpgradeSRCommand.cs

示例9: ExecuteCore

 protected override void ExecuteCore(SelectedItemCollection selection)
 {
     List<AsyncAction> actions = new List<AsyncAction>();
     foreach (SR sr in selection.AsXenObjects<SR>(CanExecute))
     {
         actions.Add(new SrAction(SrActionKind.Forget, sr));
     }
     RunMultipleActions(actions, Messages.ACTION_SRS_FORGETTING, Messages.FORGETTING_SRS, Messages.SRS_FORGOTTEN, true);
 }
开发者ID:robhoes,项目名称:xenadmin,代码行数:9,代码来源:ForgetSRCommand.cs

示例10: 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);
     }
 }
开发者ID:agimofcarmen,项目名称:xenadmin,代码行数:10,代码来源:ShareSRCommand.cs

示例11: ExecuteCore

 protected override void ExecuteCore(SelectedItemCollection selection)
 {
     if (newPoolDialog == null || newPoolDialog.IsDisposed)
     {
         newPoolDialog = new NewPoolDialog(selection.AsXenObjects<Host>());
         newPoolDialog.Show(Program.MainWindow);
     }
     else
     {
         HelpersGUI.BringFormToFront(newPoolDialog);
     }
 }
开发者ID:huizh,项目名称:xenadmin,代码行数:12,代码来源:NewPoolCommand.cs

示例12: ExecuteCore

 protected override void ExecuteCore(SelectedItemCollection selection)
 {
     List<AsyncAction> actions = new List<AsyncAction>();
     foreach (Host host in selection.AsXenObjects<Host>(CanExecute))
     {
         MainWindowCommandInterface.CloseActiveWizards(host.Connection);
         RebootHostAction action = new RebootHostAction( host,AddHostToPoolCommand.NtolDialog);
         action.Completed += s => MainWindowCommandInterface.RequestRefreshTreeView();
         actions.Add(action);
     }
     RunMultipleActions(actions, null, Messages.ACTION_HOSTS_REBOOTING, Messages.ACTION_HOSTS_REBOOTED, true);
 }
开发者ID:huizh,项目名称:xenadmin,代码行数:12,代码来源:RebootHostCommand.cs

示例13: ExecuteCore

        protected override void ExecuteCore(SelectedItemCollection selection)
        {
            List<AsyncAction> actions = new List<AsyncAction>();
            foreach (Host host in selection.AsXenObjects<Host>())
            {
                string opaque_ref = host.opaque_ref;
                Pool pool = Helpers.GetPool(host.Connection);

                if (selection.Count == 1 && pool.master == host.opaque_ref)
                {
                    // Trying to remove the master from a pool.
                    new ThreeButtonDialog(
                       new ThreeButtonDialog.Details(
                           SystemIcons.Error,
                           Messages.MESSAGEBOX_POOL_MASTER_REMOVE,
                           Messages.XENCENTER)).ShowDialog(MainWindowCommandInterface.Form);
                    return;
                }

                // Optimistically, add the ejected host as a standalone host (but don't connect to it yet)
                IXenConnection connection = new XenConnection();
                connection.Hostname = host.address;
                connection.Username = host.Connection.Username;
                connection.Password = host.Connection.Password;
                connection.FriendlyName = host.Name;

                lock (ConnectionsManager.ConnectionsLock)
                {
                    ConnectionsManager.XenConnections.Add(connection);
                }

                Program.HideObject(opaque_ref);

                var action = new EjectHostFromPoolAction(pool, host);
                action.Completed += delegate
                {
                    if (action.Succeeded)
                    {
                        ThreadPool.QueueUserWorkItem(WaitForReboot, connection);
                    }
                    else
                    {
                        Program.ShowObject(opaque_ref);
                        MainWindowCommandInterface.RemoveConnection(connection);
                    }
                };

                actions.Add(action);
            }

            RunMultipleActions(actions, Messages.REMOVING_SERVERS_FROM_POOL, Messages.POOLCREATE_REMOVING, Messages.POOLCREATE_REMOVED, true);
        }
开发者ID:huizh,项目名称:xenadmin,代码行数:52,代码来源:RemoveHostFromPoolCommand.cs

示例14: ExecuteCore

        protected override void ExecuteCore(SelectedItemCollection selection)
        {
            List<AsyncAction> actions = new List<AsyncAction>();
            foreach (Host host in selection.AsXenObjects<Host>())
            {
                Pool pool = Helpers.GetPool(host.Connection);
                var action = new DestroyHostAction(pool, host);
                actions.Add(action);
            }

            RunMultipleActions(actions, Messages.DESTROYING_HOSTS_TITLE, Messages.DESTROYING_HOSTS_START_DESC,
                               Messages.DESTROYING_HOSTS_END_DESC, true);
        }
开发者ID:huizh,项目名称:xenadmin,代码行数:13,代码来源:DestroyHostCommand.cs

示例15: ExecuteCore

        protected override void ExecuteCore(SelectedItemCollection selection)
        {
            var actions = new List<AsyncAction>();
            var liveHosts = selection.AsXenObjects<Host>().Where(h => h.IsLive);

            foreach (Host host in liveHosts)
            {
                MainWindowCommandInterface.CloseActiveWizards(host.Connection);
                var action = new RestartToolstackAction(host);
                actions.Add(action);
            }
            RunMultipleActions(actions, null, Messages.ACTION_TOOLSTACK_RESTARTING, Messages.ACTION_TOOLSTACK_RESTARTED, true);
        }
开发者ID:huizh,项目名称:xenadmin,代码行数:13,代码来源:RestartToolstackCommand.cs


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