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


C# Actions.AsyncAction类代码示例

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


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

示例1: BringDown

        //private static void BringDown(AsyncAction action, PIF master, bool this_host, int hi)
        //{
        //    ForSomeHosts(action, master, this_host, false, hi, BringDown);
        //}
        /// <summary>
        /// Depurpose (set disallow_unplug=false) and remove the IP address from the given PIF.
        /// </summary>
        internal static void BringDown(AsyncAction action, PIF pif, int hi)
        {
            int mid = (action.PercentComplete + hi) / 2;

            Depurpose(action, pif, mid);
            ClearIP(action, pif, hi);
        }
开发者ID:huizh,项目名称:xenadmin,代码行数:14,代码来源:NetworkingActionHelpers.cs

示例2: TaskPoller

 /// <summary>
 /// Polls the action regularly and updates the history item's progress from the task's progress,
 /// scaled to a value between lo and hi.
 /// </summary>
 public TaskPoller(AsyncAction action, int lo, int hi)
 {
     _action = action;
     _lo = lo;
     if (hi < lo)
     {
         log.Warn("Squelching progress bar reversal.");
         hi = lo + 1;
     }
     _scale = hi - lo;
 }
开发者ID:huizh,项目名称:xenadmin,代码行数:15,代码来源:TaskPoller.cs

示例3: ActionProgressDialog

 public ActionProgressDialog(AsyncAction action, ProgressBarStyle progressBarStyle)
 {
     InitializeComponent();
     this.action = action;
     action.Completed += action_Completed;
     action.Changed += action_Changed;
     progressBar1.Style = progressBarStyle;
     updateStatusLabel();
     buttonCancel.Enabled = action.CanCancel;
     ShowIcon = false;
     HideTitleBarIcons();
 }
开发者ID:ushamandya,项目名称:xenadmin,代码行数:12,代码来源:ActionProgressDialog.cs

示例4: Put

        /// <summary>
        /// HTTP PUT file from path to HTTP action f, updating action with progress every 500ms.
        /// </summary>
        /// <param name="action">Action on which to update the progress</param>
        /// <param name="timeout">Timeout value in ms</param>
        /// <param name="path">path of file to put</param>
        public static String Put(AsyncAction action, int timeout, string path, string hostname, Delegate f, params object[] p)
        {
            Session session = action.Session;
            action.RelatedTask = XenAPI.Task.create(session, "uploadTask", hostname);

            try
            {
                HTTP.UpdateProgressDelegate progressDelegate = delegate(int percent)
                {
                    action.Tick(percent, action.Description);
                };

                return Put(progressDelegate, action.GetCancelling, timeout, action.Connection,
                    action.RelatedTask, ref session, path, hostname, f, p);
            }
            finally
            {
                action.Session = session;
                Task.destroy(session, action.RelatedTask);
            }
        }
开发者ID:agimofcarmen,项目名称:xenadmin,代码行数:27,代码来源:HTTPHelper.cs

示例5: GetTextColor

 private Color GetTextColor(AsyncAction action)
 {
     Color textColor;
     if (action == null || !action.StartedRunning) // not started yet
         textColor = flickerFreeListBox1.ForeColor;
     else if (!action.IsCompleted) // in progress
         textColor = Color.Blue;
     else textColor = action.Succeeded ? Color.Green : Color.Red; // completed
     return textColor;
 }
开发者ID:GaborApatiNagy,项目名称:xenadmin,代码行数:10,代码来源:PatchingWizard_UploadPage.cs

示例6: GetActionDescription

 private static string GetActionDescription(AsyncAction action)
 {
     return !action.StartedRunning ? "" :
         action.Exception == null
         ? action.Description
         : action.Exception is CancelledException ? Messages.CANCELLED_BY_USER : action.Exception.Message;
 }
开发者ID:GaborApatiNagy,项目名称:xenadmin,代码行数:7,代码来源:PatchingWizard_UploadPage.cs

示例7: CancelAction

 private void CancelAction(AsyncAction action)
 {
     Program.AssertOnEventThread();
     OnPageUpdated();
     action.Changed -= singleAction_Changed;
     action.Completed -= singleAction_Completed;
     action.Cancel();
 }
开发者ID:GaborApatiNagy,项目名称:xenadmin,代码行数:8,代码来源:PatchingWizard_UploadPage.cs

示例8: Depurpose

        /// <summary>
        /// Clear the disallow_unplug and ManagementPurpose on the given NIC.
        /// </summary>
        private static void Depurpose(AsyncAction action, PIF pif, int hi)
        {
            log.DebugFormat("Depurposing PIF {0} {1}...", pif.Name, pif.uuid);
            action.Description = string.Format(Messages.ACTION_CHANGE_NETWORKING_DEPURPOSING, pif.Name);

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

            action.PercentComplete = hi;

            log.DebugFormat("Depurposed PIF {0} {1}.", pif.Name, pif.uuid);
            action.Description = string.Format(Messages.ACTION_CHANGE_NETWORKING_DEPURPOSED, pif.Name);
        }
开发者ID:huizh,项目名称:xenadmin,代码行数:18,代码来源:NetworkingActionHelpers.cs

示例9: BringUp

        /// <summary>
        /// Configure an IP address, management purpose, and set the disallow_unplug flag on the given existing_pif.
        /// </summary>
        /// <param name="new_pif">The source of the new IP details</param>
        /// <param name="existing_pif">The PIF to configure</param>
        internal static void BringUp(AsyncAction action, PIF new_pif, string new_ip, PIF existing_pif, int hi)
        {
            bool primary = string.IsNullOrEmpty(new_pif.ManagementPurpose);

            int lo = action.PercentComplete;
            int inc = (hi - lo) / (primary ? 2 : 3);

            log.DebugFormat("Bringing PIF {0} {1} up as {2}/{3}, {4}, {5}...", existing_pif.Name, existing_pif.uuid,
                new_ip, new_pif.netmask, new_pif.gateway, new_pif.DNS);
            action.Description = string.Format(Messages.ACTION_CHANGE_NETWORKING_BRINGING_UP, existing_pif.Name);

            PIF p = (PIF)existing_pif.Clone();
            p.disallow_unplug = !primary;
            p.ManagementPurpose = new_pif.ManagementPurpose;
            p.SaveChanges(action.Session);

            action.PercentComplete = lo + inc;

            ReconfigureIP(action, new_pif, existing_pif, new_ip, action.PercentComplete + inc);
            if (!primary)
                Plug(action, existing_pif, hi);

            action.Description = string.Format(Messages.ACTION_CHANGE_NETWORKING_BRINGING_UP_DONE, existing_pif.Name);
            log.DebugFormat("Brought PIF {0} {1} up.", existing_pif.Name, existing_pif.uuid);
        }
开发者ID:huizh,项目名称:xenadmin,代码行数:30,代码来源:NetworkingActionHelpers.cs

示例10: PropertiesDialogClosingEventArgs

 public PropertiesDialogClosingEventArgs(AsyncAction action, bool startAction)
 {
     StartAction = startAction;
     Action = action;
 }
开发者ID:agimofcarmen,项目名称:xenadmin,代码行数:5,代码来源:PropertiesDialog.cs

示例11: AddActionToSummary

        void AddActionToSummary(AsyncAction action)
        {
            if (action == null)
                return;

            SrDescriptor srDescriptor;
            actionSrDescriptorDict.TryGetValue(action, out srDescriptor);

            if (srDescriptor == null)
                return;

            if (action.Succeeded)
                xenTabPageLvmoHbaSummary.SuccessfullyCreatedSRs.Add(srDescriptor);
            else
                xenTabPageLvmoHbaSummary.FailedToCreateSRs.Add(srDescriptor);
        }
开发者ID:agimofcarmen,项目名称:xenadmin,代码行数:16,代码来源:NewSRWizard.cs

示例12: Get

 /// <summary>
 /// HTTP GET file from HTTP action f, saving it to path (via a temporary file).
 /// </summary>
 /// <param name="action">Action on which to update the progress</param>
 /// <param name="timeout">Whether to apply a timeout</param>
 /// <param name="path">Path to save file to.</param>
 /// <returns>Result of the task used to GET the file</returns>
 public static String Get(AsyncAction action, bool timeout, string path, string hostname, Delegate f, params object[] p)
 {
     return Get(action, timeout, null, path, hostname, f, p);
 }
开发者ID:robhoes,项目名称:xenadmin,代码行数:11,代码来源:HTTPHelper.cs

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

示例14: SetSessionDetails

        private void SetSessionDetails(AsyncAction action)
        {
            if (elevatedSession == null || string.IsNullOrEmpty(elevatedUsername) || string.IsNullOrEmpty(elevatedPassword))
                return;

            action.sudoUsername = elevatedUsername;
            action.sudoPassword = elevatedPassword;
            action.Session = elevatedSession;
        }
开发者ID:robhoes,项目名称:xenadmin,代码行数:9,代码来源:GraphList.cs

示例15: ExtractApiCallList

 private List<string> ExtractApiCallList(AsyncAction myAction)
 {
     RbacMethodList rbacMethods = new RbacMethodList();
     RbacCollectorProxy.GetProxy(rbacMethods);
     Session session = new Session(RbacCollectorProxy.GetProxy(rbacMethods), myAction.Connection);
     myAction.RunExternal(session);
     return rbacMethods.ConvertAll(c => c.Method.ToLower().Replace('.', '_').Replace("async_", ""));
 }
开发者ID:ChrisH4rding,项目名称:xenadmin,代码行数:8,代码来源:TestAPICallVersions.cs


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