using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Activities;
using System.Windows;

namespace BookmarkSample
{

    public sealed class RetrieveString : NativeActivity<string>
    {
        // 定义字符串类型的活动输入参数
        public InArgument<string> BookmarkName { get; set; }


        // 如果您的活动要返回值，请从 CodeActivity<TResult> 衍生该值，
        // 并从 Execute 方法返回该值。
        protected override void Execute(NativeActivityContext context)
        {

            context.CreateBookmark(BookmarkName.Get(context),
                new BookmarkCallback(OnResumeBookmark));

        }

        protected override bool CanInduceIdle
        {
            get
            {
                return true;
            }
        }

        public void OnResumeBookmark(NativeActivityContext context, Bookmark bookmark, object obj)
        {
            Result.Set(context, obj as string); //return input string.
        }

    }
}
