本文整理匯總了C#中System.Activities.WorkflowApplication.Unload方法的典型用法代碼示例。如果您正苦於以下問題:C# WorkflowApplication.Unload方法的具體用法?C# WorkflowApplication.Unload怎麽用?C# WorkflowApplication.Unload使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Activities.WorkflowApplication
的用法示例。
在下文中一共展示了WorkflowApplication.Unload方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Interact
// single interaction with the user. The user enters a string in the console and that
// string is used to resume the ReadLine activity bookmark
static void Interact(WorkflowApplication application, AutoResetEvent resetEvent)
{
Console.WriteLine("Workflow is ready for input");
Console.WriteLine("Special commands: 'unload', 'exit'");
bool done = false;
while (!done)
{
Console.Write("> ");
string s = Console.ReadLine();
if (s.Equals("unload"))
{
try
{
// attempt to unload will fail if the workflow is idle within a NoPersistZone
application.Unload(TimeSpan.FromSeconds(5));
done = true;
}
catch (TimeoutException e)
{
Console.WriteLine(e.Message);
}
}
else if (s.Equals("exit"))
{
application.ResumeBookmark("inputBookmark", s);
done = true;
}
else
{
application.ResumeBookmark("inputBookmark", s);
}
}
resetEvent.WaitOne();
}