本文整理汇总了C#中Lookup.AddNewItem方法的典型用法代码示例。如果您正苦于以下问题:C# Lookup.AddNewItem方法的具体用法?C# Lookup.AddNewItem怎么用?C# Lookup.AddNewItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lookup
的用法示例。
在下文中一共展示了Lookup.AddNewItem方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExecuteTask
/// <summary>
/// Executes the task.
/// </summary>
public Task<WorkUnitResult> ExecuteTask(TargetLoggingContext targetLoggingContext, BuildRequestEntry requestEntry, ITargetBuilderCallback targetBuilderCallback, ProjectTargetInstanceChild task, TaskExecutionMode mode, Lookup lookupForInference, Lookup lookupForExecution, CancellationToken cancellationToken)
{
if (cancellationToken.IsCancellationRequested)
{
return Task<WorkUnitResult>.FromResult(new WorkUnitResult(WorkUnitResultCode.Canceled, WorkUnitActionCode.Stop, null));
}
ProjectOnErrorInstance errorTask = task as ProjectOnErrorInstance;
if (null != errorTask)
{
ErrorTasks.Add(errorTask);
}
else
{
ProjectTaskInstance taskInstance = task as ProjectTaskInstance;
ExecutedTasks.Add(taskInstance);
if ((mode & TaskExecutionMode.InferOutputsOnly) == TaskExecutionMode.InferOutputsOnly)
{
lookupForInference.AddNewItem(new ProjectItemInstance(requestEntry.RequestConfiguration.Project, taskInstance.Name + "_Item", "Item", task.Location.File));
}
else if ((mode & TaskExecutionMode.ExecuteTaskAndGatherOutputs) == TaskExecutionMode.ExecuteTaskAndGatherOutputs)
{
lookupForExecution.AddNewItem(new ProjectItemInstance(requestEntry.RequestConfiguration.Project, taskInstance.Name + "_Item", "Item", task.Location.File));
}
if (String.Equals(taskInstance.Name, "CallTarget", StringComparison.OrdinalIgnoreCase))
{
taskInstance.GetParameter("Targets");
char[] splitter = new char[] { ';' };
targetBuilderCallback.LegacyCallTarget(taskInstance.GetParameter("Targets").Split(splitter), false, taskInstance.Location);
}
_taskNumber++;
if (FailTaskNumber == _taskNumber)
{
if (taskInstance.ContinueOnError == "True")
{
return Task<WorkUnitResult>.FromResult(new WorkUnitResult(WorkUnitResultCode.Failed, WorkUnitActionCode.Continue, null));
}
return Task<WorkUnitResult>.FromResult(new WorkUnitResult(WorkUnitResultCode.Failed, WorkUnitActionCode.Stop, null));
}
}
return Task<WorkUnitResult>.FromResult(new WorkUnitResult(WorkUnitResultCode.Success, WorkUnitActionCode.Continue, null));
}