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


C# AsyncAction.RunAsync方法代码示例

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


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

示例1: btnOK_Click

        private void btnOK_Click(object sender, EventArgs e)
        {
            // Have any of the fields in the tab pages changed?
            if (!HasChanged)
            {
                Close();
                return;
            }

            if (!ValidToSave)
            {
                // Keep dialog open and allow user to correct the error as
                // indicated by the balloon tooltip.
                DialogResult = DialogResult.None;
                return;
            }

            // Yes, save to the LocalXenObject.
            List<AsyncAction> actions = SaveSettings();

            Program.Invoke(Program.MainWindow.GeneralPage, Program.MainWindow.GeneralPage.EnableDisableEdit);

            // Add a save changes on the beginning of the actions to enact the alterations that were just changes to the xenObjectCopy.
            // Must come first because some pages' SaveChanges() rely on modifying the object via the xenObjectCopy before their actions are run.
            actions.Insert(0, new SaveChangesAction(xenObjectCopy, xenObjectBefore, true));

            _action = new MultipleAction(
                connection,
                string.Format(Messages.UPDATE_PROPERTIES, Helpers.GetName(xenObject).Ellipsise(50)),
                Messages.UPDATING_PROPERTIES,
                Messages.UPDATED_PROPERTIES,
                actions);

            _action.SetObject(xenObjectCopy);
            
            _action.Completed += action_Completed;
            Close();

            if (_startAction)
            {
                _action.RunAsync();
            }
        }
开发者ID:agimofcarmen,项目名称:xenadmin,代码行数:43,代码来源:PropertiesDialog.cs

示例2: FinishWizard

        protected override void FinishWizard()
        {
            Action = new CreateVMAction(xenConnection,
                                        page_1_Template.SelectedTemplate,
                                        page_1_Template.CopyBiosStrings
                                            ? page_1b_BiosLocking.CopyBiosStringsFrom
                                            : null,
                                        page_2_Name.SelectedName,
                                        page_2_Name.SelectedDescription,
                                        page_3_InstallationMedia.SelectedInstallMethod,
                                        page_3_InstallationMedia.SelectedPvArgs,
                                        page_3_InstallationMedia.SelectedCD,
                                        page_3_InstallationMedia.SelectedUrl,
                                        m_affinity,
                                        page_5_CpuMem.SelectedVcpus,
                                        page_5_CpuMem.SelectedMemoryDynamicMin,
                                        page_5_CpuMem.SelectedMemoryDynamicMax,
                                        page_5_CpuMem.SelectedMemoryStaticMax,
                                        page_6b_LunPerVdi.MapLunsToVdisRequired
                                            ? page_6b_LunPerVdi.MappedDisks
                                            : page_6_Storage.SelectedDisks,
                                        page_6_Storage.FullCopySR,
                                        page_7_Networking.SelectedVifs,
                                        page_8_Finish.StartImmediately,
                                        VMOperationCommand.WarningDialogHAInvalidConfig,
                                        VMOperationCommand.StartDiagnosisForm,
                                        gpuCapability ? pageVgpu.GpuGroup : null,
                                        gpuCapability ? pageVgpu.VgpuType : null,
                                        page_5_CpuMem.SelectedCoresPerSocket,
                                        page_CloudConfigParameters.ConfigDriveTemplateText);

            Action.RunAsync();

            base.FinishWizard();
        }
开发者ID:robertbreker,项目名称:xenadmin,代码行数:35,代码来源:NewVMWizard.cs

示例3: PageLoaded

        public override void PageLoaded(PageLoadedDirection direction)
        {
            base.PageLoaded(direction);

            if (_thisPageHasBeenCompleted)
            {
                actionManualMode = null;
                actionsWorker = null;
                oemWorker = null;
                return;
            }

            if (SelectedUpdateType == UpdateType.NewOem)
            {
                InstallOEMUpdates();
                return;
            }

            //if we reach here it's either UpdateType.NewRetail or UpdateType.Existing

            if (!IsAutomaticMode)
            {
                actionManualMode = new ApplyPatchAction(new List<Pool_patch> { Patch }, SelectedServers);
                actionManualMode.Changed += action_Changed;
                actionManualMode.Completed += action_Completed;
                textBoxLog.Text = ManualTextInstructions;
                actionManualMode.RunAsync();
                return;
            }

            _nextEnabled = false;
            OnPageUpdated();

            List<PlanAction> planActions = new List<PlanAction>();

            foreach (Pool pool in SelectedPools)
            {
                List<Pool_patch> poolPatches = new List<Pool_patch>(pool.Connection.Cache.Pool_patches);
                Pool_patch poolPatch = poolPatches.Find(delegate(Pool_patch otherPatch)
                                                                     {
                                                                         if (Patch != null)
                                                                             return otherPatch.uuid == Patch.uuid;
                                                                         return false;
                                                                     });

                List<Host> poolHosts = new List<Host>(pool.Connection.Cache.Hosts);
                Host master = SelectedServers.Find(host => host.IsMaster() && poolHosts.Contains(host));
                if (master != null)
                    planActions.AddRange(CompileActionList(master, poolPatch));
                foreach (Host server in SelectedServers)
                {
                    if (poolHosts.Contains(server))
                    {
                        if (!server.IsMaster())
                        {
                            // check patch isn't already applied here
                            if (poolPatch.AppliedOn(server) == DateTime.MaxValue)
                                planActions.AddRange(CompileActionList(server, poolPatch));
                        }
                    }
                }
                planActions.Add(new UnwindProblemsAction(ProblemsResolvedPreCheck));
            }

            actionsWorker = new BackgroundWorker();
            actionsWorker.DoWork += new DoWorkEventHandler(PatchingWizardAutomaticPatchWork);
            actionsWorker.WorkerReportsProgress = true;
            actionsWorker.ProgressChanged += new ProgressChangedEventHandler(actionsWorker_ProgressChanged);
            actionsWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(actionsWorker_RunWorkerCompleted);
            actionsWorker.WorkerSupportsCancellation = true;
            actionsWorker.RunWorkerAsync(planActions);
        }
开发者ID:heiden-deng,项目名称:xenadmin,代码行数:72,代码来源:PatchingWizard_PatchingPage.cs


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