WorkflowApplication.GetBookmarks 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
워크플로 인스턴스에 대한 책갈피 컬렉션을 반환합니다.
오버로드
| Name | Description |
|---|---|
| GetBookmarks() |
워크플로 인스턴스에 대한 책갈피 컬렉션을 반환합니다. |
| GetBookmarks(TimeSpan) |
지정된 제한 시간 간격을 사용하여 워크플로 인스턴스에 대한 책갈피 컬렉션을 반환합니다. |
GetBookmarks()
워크플로 인스턴스에 대한 책갈피 컬렉션을 반환합니다.
public:
System::Collections::ObjectModel::ReadOnlyCollection<System::Activities::Hosting::BookmarkInfo ^> ^ GetBookmarks();
public System.Collections.ObjectModel.ReadOnlyCollection<System.Activities.Hosting.BookmarkInfo> GetBookmarks();
member this.GetBookmarks : unit -> System.Collections.ObjectModel.ReadOnlyCollection<System.Activities.Hosting.BookmarkInfo>
Public Function GetBookmarks () As ReadOnlyCollection(Of BookmarkInfo)
반품
워크플로 인스턴스에 대한 책갈피의 읽기 전용 컬렉션입니다.
예제
다음 예제에서는 작업을 만드는 워크플로를 ReadLine 만듭니다 Bookmark. 워크플로가 시작되고 Bookmark 만들어지고 워크플로가 유휴 상태가 되면 GetBookmarks 호출됩니다. 워크플로가 완료되면 콘솔에 다음 출력이 표시됩니다.
What is your name?
BookmarkName: UserName - OwnerDisplayName: ReadLine
Steve
Hello, Steve
public sealed class ReadLine : NativeActivity<string>
{
[RequiredArgument]
public InArgument<string> BookmarkName { get; set; }
protected override void Execute(NativeActivityContext context)
{
// Create a Bookmark and wait for it to be resumed.
context.CreateBookmark(BookmarkName.Get(context),
new BookmarkCallback(OnResumeBookmark));
}
// NativeActivity derived activities that do asynchronous operations by calling
// one of the CreateBookmark overloads defined on System.Activities.NativeActivityContext
// must override the CanInduceIdle property and return true.
protected override bool CanInduceIdle
{
get { return true; }
}
public void OnResumeBookmark(NativeActivityContext context, Bookmark bookmark, object obj)
{
// When the Bookmark is resumed, assign its value to
// the Result argument.
Result.Set(context, (string)obj);
}
Variable<string> name = new Variable<string>();
Activity wf = new Sequence
{
Variables = { name },
Activities =
{
new WriteLine
{
Text = "What is your name?"
},
new ReadLine
{
BookmarkName = "UserName",
Result = new OutArgument<string>(name)
},
new WriteLine
{
Text = new InArgument<string>((env) =>
("Hello, " + name.Get(env)))
}
}
};
// Create a WorkflowApplication instance.
WorkflowApplication wfApp = new WorkflowApplication(wf);
// Workflow lifecycle events omitted except idle.
AutoResetEvent idleEvent = new AutoResetEvent(false);
wfApp.Idle = delegate(WorkflowApplicationIdleEventArgs e)
{
// You can also inspect the bookmarks from the Idle handler
// using e.Bookmarks
idleEvent.Set();
};
// Run the workflow.
wfApp.Run();
// Wait for the workflow to go idle and give it a chance
// to create the Bookmark.
idleEvent.WaitOne();
// Inspect the bookmarks
foreach (BookmarkInfo info in wfApp.GetBookmarks())
{
Console.WriteLine("BookmarkName: {0} - OwnerDisplayName: {1}",
info.BookmarkName, info.OwnerDisplayName);
}
// Gather the user's input and resume the bookmark.
wfApp.ResumeBookmark("UserName", Console.ReadLine());
설명
이 작업이 30초 이내에 완료되지 않으면 throw TimeoutException 됩니다.
적용 대상
GetBookmarks(TimeSpan)
지정된 제한 시간 간격을 사용하여 워크플로 인스턴스에 대한 책갈피 컬렉션을 반환합니다.
public:
System::Collections::ObjectModel::ReadOnlyCollection<System::Activities::Hosting::BookmarkInfo ^> ^ GetBookmarks(TimeSpan timeout);
public System.Collections.ObjectModel.ReadOnlyCollection<System.Activities.Hosting.BookmarkInfo> GetBookmarks(TimeSpan timeout);
member this.GetBookmarks : TimeSpan -> System.Collections.ObjectModel.ReadOnlyCollection<System.Activities.Hosting.BookmarkInfo>
Public Function GetBookmarks (timeout As TimeSpan) As ReadOnlyCollection(Of BookmarkInfo)
매개 변수
- timeout
- TimeSpan
작업이 취소되고 throw되기 전에 이 메서드가 완료되어야 하는 TimeoutException 간격입니다.
반품
워크플로 인스턴스에 대한 책갈피의 읽기 전용 컬렉션입니다.
예제
다음 예제에서는 작업을 만드는 워크플로를 ReadLine 만듭니다 Bookmark. 워크플로가 시작되고 Bookmark 만들어지고 워크플로가 유휴 상태가 되면 GetBookmarks 호출됩니다. 워크플로가 완료되면 콘솔에 다음 출력이 표시됩니다.
What is your name?
BookmarkName: UserName - OwnerDisplayName: ReadLine
Steve
Hello, Steve
public sealed class ReadLine : NativeActivity<string>
{
[RequiredArgument]
public InArgument<string> BookmarkName { get; set; }
protected override void Execute(NativeActivityContext context)
{
// Create a Bookmark and wait for it to be resumed.
context.CreateBookmark(BookmarkName.Get(context),
new BookmarkCallback(OnResumeBookmark));
}
// NativeActivity derived activities that do asynchronous operations by calling
// one of the CreateBookmark overloads defined on System.Activities.NativeActivityContext
// must override the CanInduceIdle property and return true.
protected override bool CanInduceIdle
{
get { return true; }
}
public void OnResumeBookmark(NativeActivityContext context, Bookmark bookmark, object obj)
{
// When the Bookmark is resumed, assign its value to
// the Result argument.
Result.Set(context, (string)obj);
}
Variable<string> name = new Variable<string>();
Activity wf = new Sequence
{
Variables = { name },
Activities =
{
new WriteLine
{
Text = "What is your name?"
},
new ReadLine
{
BookmarkName = "UserName",
Result = new OutArgument<string>(name)
},
new WriteLine
{
Text = new InArgument<string>((env) =>
("Hello, " + name.Get(env)))
}
}
};
// Create a WorkflowApplication instance.
WorkflowApplication wfApp = new WorkflowApplication(wf);
// Workflow lifecycle events omitted except idle.
AutoResetEvent idleEvent = new AutoResetEvent(false);
wfApp.Idle = delegate(WorkflowApplicationIdleEventArgs e)
{
// You can also inspect the bookmarks from the Idle handler
// using e.Bookmarks
idleEvent.Set();
};
// Run the workflow.
wfApp.Run();
// Wait for the workflow to go idle and give it a chance
// to create the Bookmark.
idleEvent.WaitOne();
// Inspect the bookmarks
foreach (BookmarkInfo info in wfApp.GetBookmarks())
{
Console.WriteLine("BookmarkName: {0} - OwnerDisplayName: {1}",
info.BookmarkName, info.OwnerDisplayName);
}
// Gather the user's input and resume the bookmark.
wfApp.ResumeBookmark("UserName", Console.ReadLine());