當前位置: 首頁>>代碼示例>>C#>>正文


C# VM.FindVMCDROM方法代碼示例

本文整理匯總了C#中XenAPI.VM.FindVMCDROM方法的典型用法代碼示例。如果您正苦於以下問題:C# VM.FindVMCDROM方法的具體用法?C# VM.FindVMCDROM怎麽用?C# VM.FindVMCDROM使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在XenAPI.VM的用法示例。


在下文中一共展示了VM.FindVMCDROM方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: SingleVMExecute

        /// <summary>
        /// Attempts to install tools on the vm
        /// </summary>
        /// <param name="vm"></param>
        /// <returns>null if user cancels or an AsyncAction. This is either the InstallPVToolsAction or the CreateCdDriveAction if the VM needed a DVD drive.</returns>
        private AsyncAction SingleVMExecute(VM vm)
        {
            if (vm.FindVMCDROM() == null)
            {
                if (new ThreeButtonDialog(
                        new ThreeButtonDialog.Details(
                            null,
                            Messages.NEW_DVD_DRIVE_REQUIRED,
                            Messages.XENCENTER),
                        ThreeButtonDialog.ButtonYes,
                        ThreeButtonDialog.ButtonNo).ShowDialog(Parent) == DialogResult.Yes)
                {
                    MainWindowCommandInterface.AllowHistorySwitch();
                    CreateCdDriveAction createDriveAction = new CreateCdDriveAction(vm, true,NewDiskDialog.ShowMustRebootBoxCD,NewDiskDialog.ShowVBDWarningBox);
                    new ActionProgressDialog(createDriveAction, ProgressBarStyle.Marquee).ShowDialog(Parent);

                    if (createDriveAction.Succeeded)
                    {
                        ShowMustRebootBox();
                    }
                    return createDriveAction;
                }
            }
            else
            {
                DialogResult dr = new InstallToolsWarningDialog(vm.Connection).ShowDialog(Parent);
                if (dr == DialogResult.Yes)
                {
                    MainWindowCommandInterface.AllowHistorySwitch();
                    InstallPVToolsAction installToolsAction = new InstallPVToolsAction( vm, XSToolsSRNotFound, Properties.Settings.Default.ShowHiddenVMs);
                    installToolsAction.Completed += InstallToolsActionCompleted;

                    installToolsAction.RunAsync();
                    return installToolsAction;
                }
            }
            return null;
        }
開發者ID:ChrisH4rding,項目名稱:xenadmin,代碼行數:43,代碼來源:InstallToolsCommand.cs

示例2: SingleVMExecute

        /// <summary>
        /// Attempts to install tools on the vm
        /// </summary>
        /// <param name="vm"></param>
        /// <returns>null if user cancels or an AsyncAction. This is either the InstallPVToolsAction or the CreateCdDriveAction if the VM needed a DVD drive.</returns>
        private AsyncAction SingleVMExecute(VM vm)
        {
            if (vm.FindVMCDROM() == null)
            {
                DialogResult dialogResult;
                using (var dlg = new ThreeButtonDialog(
                        new ThreeButtonDialog.Details(
                            null,
                            Messages.NEW_DVD_DRIVE_REQUIRED,
                            Messages.XENCENTER),
                        ThreeButtonDialog.ButtonYes,
                        ThreeButtonDialog.ButtonNo))
                {
                    dialogResult = dlg.ShowDialog(Parent);
                }
                if (dialogResult == DialogResult.Yes)
                {
                    CreateCdDriveAction createDriveAction = new CreateCdDriveAction(vm, true,NewDiskDialog.ShowMustRebootBoxCD,NewDiskDialog.ShowVBDWarningBox);
                    using (var dlg = new ActionProgressDialog(createDriveAction, ProgressBarStyle.Marquee))
                    {
                        dlg.ShowDialog(Parent);
                    }

                    if (createDriveAction.Succeeded)
                    {
                        ShowMustRebootBox();
                    }
                    return createDriveAction;
                }
            }
            else
            {
                DialogResult dr = new InstallToolsWarningDialog(vm.Connection).ShowDialog(Parent);
                if (dr == DialogResult.Yes)
                {
                    var installToolsAction = new InstallPVToolsAction(vm, Properties.Settings.Default.ShowHiddenVMs);
                    installToolsAction.Completed += InstallToolsActionCompleted;

                    installToolsAction.RunAsync();
                    return installToolsAction;
                }
            }
            return null;
        }
開發者ID:ushamandya,項目名稱:xenadmin,代碼行數:49,代碼來源:InstallToolsCommand.cs


注:本文中的XenAPI.VM.FindVMCDROM方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。