本文整理汇总了C#中System.Threading.Tasks.Task.All方法的典型用法代码示例。如果您正苦于以下问题:C# Task.All方法的具体用法?C# Task.All怎么用?C# Task.All使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Threading.Tasks.Task
的用法示例。
在下文中一共展示了Task.All方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateLockFile
private bool UpdateLockFile(PublishRoot root)
{
var appEnv = (IApplicationEnvironment)root.HostServices.GetService(typeof(IApplicationEnvironment));
var feedOptions = new FeedOptions();
feedOptions.IgnoreFailedSources = true;
feedOptions.Sources.Add(root.TargetPackagesPath);
feedOptions.TargetPackagesFolder = root.TargetPackagesPath;
var tasks = new Task<bool>[root.Projects.Count];
for (int i = 0; i < root.Projects.Count; i++)
{
var project = root.Projects[i];
var restoreCommand = new RestoreCommand(appEnv);
foreach (var runtime in root.Runtimes)
{
restoreCommand.TargetFrameworks.Add(project.SelectFrameworkForRuntime(runtime));
}
var restoreDirectory = project.IsPackage ? Path.Combine(project.TargetPath, "root") : project.TargetPath;
restoreCommand.SkipRestoreEvents = true;
restoreCommand.SkipInstall = true;
// This is a workaround for #1322. Since we use restore to generate the lock file
// after publish, it's possible to fail restore after copying the closure
// if framework assemblies and packages have the same name. This is more likely now
// since dependencies may exist in the top level
restoreCommand.IgnoreMissingDependencies = true;
restoreCommand.CheckHashFile = false;
restoreCommand.RestoreDirectories.Add(restoreDirectory);
restoreCommand.FeedOptions = feedOptions;
restoreCommand.Reports = root.Reports.ShallowCopy();
// Mute "dnu restore" completely if it is invoked by "dnu publish --quiet"
restoreCommand.Reports.Information = root.Reports.Quiet;
tasks[i] = restoreCommand.Execute();
}
Task.WaitAll(tasks);
return tasks.All(t => t.Result);
}
示例2: UpdateLockFile
private bool UpdateLockFile(PublishRoot root)
{
var tasks = new Task<bool>[root.Projects.Count];
for (int i = 0; i < root.Projects.Count; i++)
{
var project = root.Projects[i];
var restoreDirectory = project.IsPackage ? Path.Combine(project.TargetPath, "root") : project.TargetPath;
tasks[i] = Restore(root, project, restoreDirectory);
}
Task.WaitAll(tasks);
return tasks.All(t => t.Result);
}
示例3: FinalWork
private void FinalWork(Task[] tasks)
{
if (tasks.All(t => t.Status == TaskStatus.RanToCompletion))
{
Logger.LogToFile("======== Create PNR process ended at :" + DateTime.Now.ToString());
this.progressBar.BeginInvoke((MethodInvoker)delegate()
{
btnCreate.Enabled = true;
btnProcessPNRs.Enabled = true;
progressBar.Visible = false;
progressBar.Refresh();
lblInfo.Text = "PROCESS COMPLETED";
lblInfo.Refresh();
lblInfo.ForeColor = Color.Green;
lblUploadInfo.Text = string.Empty;
});
}
}