Bookmark 클래스

정의

워크플로 또는 작업이 다시 시작할 때까지 수동적으로 대기할 수 있는 지점을 나타냅니다.

public ref class Bookmark : IEquatable<System::Activities::Bookmark ^>
[System.Runtime.Serialization.DataContract]
public class Bookmark : IEquatable<System.Activities.Bookmark>
[<System.Runtime.Serialization.DataContract>]
type Bookmark = class
    interface IEquatable<Bookmark>
Public Class Bookmark
Implements IEquatable(Of Bookmark)
상속
Bookmark
특성
구현

예제

다음 예제에서는 ReadLine 활동을 만듭니다. ReadLine 활동이 실행되면 Bookmark를 만들고 콜백을 등록한 다음 Bookmark가 다시 시작될 때까지 기다립니다. 책갈피가 다시 시작되면 ReadLine 활동은 Bookmark와 함께 전달된 데이터를 해당 Result 인수에 할당합니다.

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);  
    }  
}  

다음 예제에서는 워크플로가 만들어질를 사용 하는 ReadLine 사용자 이름을 수집 하 여 콘솔 창에 표시 하는 작업입니다. 호스트 애플리케이션에서는 실제로 입력을 수집하는 작업을 수행하고 Bookmark를 다시 시작하여 이를 워크플로에 전달합니다.

Variable<string> name = new Variable<string>  
{  
    Name = "name"  
};  

Activity wf = new Sequence  
{  
    Variables =  
    {  
        name  
    },  
    Activities =  
    {  
        new WriteLine()  
        {  
            Text = "What is your name?"  
        },  
        new ReadLine()  
        {  
            BookmarkName = "UserName",  
            Result = name  
        },  
        new WriteLine()  
        {  
            Text = new InArgument<string>((env) => "Hello, " + name.Get(env))  
        }  
    }  
};  

AutoResetEvent syncEvent = new AutoResetEvent(false);  

// Create the WorkflowApplication using the desired  
// workflow definition.  
WorkflowApplication wfApp = new WorkflowApplication(wf);  

// Handle the desired lifecycle events.  
wfApp.Completed = delegate(WorkflowApplicationCompletedEventArgs e)  
{  
    // Signal the host that the workflow is complete.  
    syncEvent.Set();  
};  

// Start the workflow.  
wfApp.Run();  

// Collect the user's name and resume the bookmark.  
// Bookmark resumption only occurs when the workflow  
// is idle. If a call to ResumeBookmark is made and the workflow  
// is not idle, ResumeBookmark blocks until the workflow becomes  
// idle before resuming the bookmark.  
wfApp.ResumeBookmark("UserName", Console.ReadLine());  

// Wait for Completed to arrive and signal that  
// the workflow is complete.  
syncEvent.WaitOne();  

ReadLine 활동이 실행되면 Bookmark이라는 UserName를 만든 다음 책갈피가 다시 시작될 때까지 기다립니다. 호스트는 원하는 데이터를 수집한 다음 Bookmark를 다시 시작합니다. 워크플로가 다시 시작되고 이름을 표시한 다음 완료됩니다. 책갈피를 다시 시작하는 데는 동기화 코드가 필요 없습니다. 워크플로가 유휴 상태일 때만 Bookmark를 다시 시작할 수 있습니다. 워크플로가 유휴 상태가 아닌 경우 워크플로가 유휴 상태가 될 때까지 ResumeBookmark에 대한 호출이 차단됩니다.

설명

활동에서 Bookmark를 만들면 유휴 상태가 되고 Bookmark가 다시 시작될 때까지 기다립니다. Bookmark를 만든 활동과 병렬 관계인 다른 활동이 있는 경우 실행이 예약됩니다.

ResumeBookmark 오버로드 중 하나를 사용하여 호스트 애플리케이션을 통해 책갈피를 다시 시작할 수 있습니다.

책갈피에 대한 자세한 내용은 WorkflowInvoker 및 WorkflowApplication 및책갈피 사용을 참조하세요.

생성자

Bookmark(String)

지정한 이름을 사용하여 Bookmark 클래스의 새 인스턴스를 초기화합니다.

속성

Name

책갈피 이름을 가져옵니다.

메서드

Equals(Bookmark)

현재 Bookmark와 지정한 Bookmark가 워크플로에서 동일한 연속 지점을 참조하는지 여부를 결정합니다.

Equals(Object)

현재 Bookmark와 지정한 개체가 워크플로에서 동일한 연속 지점을 참조하는지 여부를 결정합니다.

GetHashCode()

Bookmark 인스턴스의 고유 식별자를 반환합니다.

GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

명명된 책갈피의 책갈피 이름 또는 명명되지 않은 책갈피의 책갈피 ID를 반환합니다.

적용 대상