本文整理汇总了C#中XenAdmin.Actions.AsyncAction.Tick方法的典型用法代码示例。如果您正苦于以下问题:C# AsyncAction.Tick方法的具体用法?C# AsyncAction.Tick怎么用?C# AsyncAction.Tick使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XenAdmin.Actions.AsyncAction
的用法示例。
在下文中一共展示了AsyncAction.Tick方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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="dataRxDelegate">Delegate called every 500ms with the data transferred</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, HTTP.DataCopiedDelegate dataRxDelegate, string path, string hostname, Delegate f, params object[] p)
{
Session session = action.Session;
action.RelatedTask = XenAPI.Task.create(session, "downloadTask", hostname);
try
{
HTTP.UpdateProgressDelegate progressDelegate = delegate(int percent)
{
action.Tick(percent, action.Description);
};
return HTTPHelper.Get(progressDelegate, action.GetCancelling, timeout, dataRxDelegate, action.Connection,
action.RelatedTask, ref session, path, hostname, f, p);
}
finally
{
action.Session = session;
Task.destroy(session, action.RelatedTask);
}
}