本文整理汇总了C#中IProgress.SetError方法的典型用法代码示例。如果您正苦于以下问题:C# IProgress.SetError方法的具体用法?C# IProgress.SetError怎么用?C# IProgress.SetError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IProgress
的用法示例。
在下文中一共展示了IProgress.SetError方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExecuteExperiment
//.........这里部分代码省略.........
{
RunnableNode completedNode = currentActiveNodesList.TakeOutNode(index);
if (progress != null)
{
progress.Increment();
}
// if experiment runner reaches end node, then prepare to exit the experiment runner
if (completedNode.Equals(m_runnableExperiment.EndNode))
{
end = true;
// if there are any other nodes still running other than end node
if (currentActiveNodesList.Count > 1)
{
successful = false;
endMessage = Messages.ExperimentRunnerErrorMessage;
TerminateExperimentExecution(); //send signal terminate in case sth else in sub level experiment is running
NLog.LogManager.GetCurrentClassLogger().Error(Messages.ExperimentRunnerEarlyTerminationErrorMessage);
}
}
else
{
// send one token to all successor nodes
foreach (RunnableNode successorNode in completedNode.NextNodes)
{
//sends token; method will return true if successor node is ready to be run
bool readyToRun = successorNode.SendToken();
if (readyToRun)
{
//add node to the pending nodes to be activated
pendingNodesToBeRun.Enqueue(successorNode);
}
}
}
}
else
{
//EXECUTED ON SIGNAL TERMINATED
// If any node signal TERMINATE for any reason, we shut down the experiment and stop processing new nodes.
end = true;
successful = false;
endMessage = Messages.ExperimentExecutionTerminated;
System.Diagnostics.Trace.WriteLine("TERMINATED!");
}
}
else
{
end = true;
successful = false;
endMessage = Messages.ExperimentRunnerInfiniteWaitDetected;
TerminateExperimentExecution(); //send signal terminate in case sth else in sub level experiment is running
System.Diagnostics.Trace.WriteLine("Infinite wait detected!");
}
} // while(!end)
//wait if there are any still running threads, only in case if experiment runner ended on termination
foreach (RunnableNode n in currentActiveNodesList.Nodes)
{
//Blocks this thread until all node threads terminate.
n.JoinNodeThread();
}
}
else // if (m_runnableExperiment.IsEmpty == false)
{
#if DEBUG
NLog.LogManager.GetCurrentClassLogger().Debug("RunnableExperiment is empty");
#endif
successful = false;
endMessage = Messages.ExperimentRunnerErrorMessage;
}
if (progress != null)
{
progress.Reset();
if (!successful)
{
progress.SetError(true);
}
progress.CurrentStatus = endMessage;
}
}
finally
{
if (m_disposeRunnableExperiment == true)
{
// destroy components app domain... note the app domain should not be destroyed by sub level experiments
TraceLab.Core.Components.LibraryHelper.DestroyDomain(m_runnableExperiment.ComponentsAppDomain);
//dispose entire experiment - it disposes all subexperiments as well.
m_runnableExperiment.Dispose();
}
OnExperimentFinished();
}
}