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


C# AsyncAction.PollToCompletion方法代碼示例

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


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

示例1: ReconfigureManagement_

        /// <summary>
        /// Switch the host's management interface from its current setting over to the given PIF.
        /// </summary>
        private static void ReconfigureManagement_(AsyncAction action, PIF pif, int hi)
        {
            log.DebugFormat("Switching to PIF {0} {1} for management...", pif.Name, pif.uuid);
            action.Description = string.Format(Messages.ACTION_CHANGE_NETWORKING_MANAGEMENT_RECONFIGURING, pif.Name);

            int mid = (hi + action.PercentComplete) / 2;

            PIF p = (PIF)pif.Clone();
            p.disallow_unplug = false;
            p.ManagementPurpose = null;
            p.SaveChanges(action.Session);

            action.PercentComplete = mid;

            action.RelatedTask = XenAPI.Host.async_management_reconfigure(action.Session, pif.opaque_ref);
            action.PollToCompletion(mid, hi);

            log.DebugFormat("Switched to PIF {0} {1} for management.", pif.Name, pif.uuid);
            action.Description = string.Format(Messages.ACTION_CHANGE_NETWORKING_MANAGEMENT_RECONFIGURED, pif.Name);
        }
開發者ID:huizh,項目名稱:xenadmin,代碼行數:23,代碼來源:NetworkingActionHelpers.cs

示例2: ReconfigureIP

        internal static void ReconfigureIP(AsyncAction action, PIF new_pif, PIF existing_pif, string ip, int hi)
        {
            log.DebugFormat("Reconfiguring IP on {0} {1} ...", existing_pif.Name, existing_pif.uuid);

            action.RelatedTask = PIF.async_reconfigure_ip(action.Session, existing_pif.opaque_ref,
                new_pif.ip_configuration_mode, ip, new_pif.netmask, new_pif.gateway, new_pif.DNS);
            action.PollToCompletion(action.PercentComplete, hi);

            log.DebugFormat("Reconfiguring IP on {0} {1} done.", existing_pif.Name, existing_pif.uuid);
        }
開發者ID:huizh,項目名稱:xenadmin,代碼行數:10,代碼來源:NetworkingActionHelpers.cs

示例3: ClearIP

        /// <summary>
        /// Remove the IP address from the given PIF.
        /// </summary>
        private static void ClearIP(AsyncAction action, PIF pif, int hi)
        {
            log.DebugFormat("Removing IP address from {0} {1}...", pif.Name, pif.uuid);
            action.Description = string.Format(Messages.ACTION_CHANGE_NETWORKING_BRINGING_DOWN, pif.Name);

            action.RelatedTask = PIF.async_reconfigure_ip(action.Session, pif.opaque_ref, ip_configuration_mode.None, "", "", "", "");
            action.PollToCompletion(action.PercentComplete, hi);

            action.Description = string.Format(Messages.ACTION_CHANGE_NETWORKING_BRINGING_DOWN_DONE, pif.Name);
            log.DebugFormat("Removed IP address from {0} {1}.", pif.Name, pif.uuid);
        }
開發者ID:huizh,項目名稱:xenadmin,代碼行數:14,代碼來源:NetworkingActionHelpers.cs

示例4: Plug

 internal static void Plug(AsyncAction action, PIF pif, int hi)
 {
     if (!PIF.get_currently_attached(action.Session, pif.opaque_ref))
     {
         log.DebugFormat("Plugging {0} {1} ...", pif.Name, pif.uuid);
         action.RelatedTask = PIF.async_plug(action.Session, pif.opaque_ref);
         action.PollToCompletion(action.PercentComplete, hi);
         log.DebugFormat("Plugging {0} {1} done.", pif.Name, pif.uuid);
     }
 }
開發者ID:huizh,項目名稱:xenadmin,代碼行數:10,代碼來源:NetworkingActionHelpers.cs


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