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

namespace BookmarkSample
{

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

        // 如果您的活动要返回值，请从 CodeActivity<TResult> 衍生该值，
        // 并从Execute 方法传回该值。
        protected override void Execute(NativeActivityContext context)
        {
            // 取得 Text 输入参数的运行阶段值
            string text = context.GetValue(this.Text);

            context.CreateBookmark("InputUsername",
                new BookmarkCallback(ProcessUsername));

        }

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

        public void ProcessUsername(NativeActivityContext context, Bookmark bookmark, object obj)
        {
            string username = obj as string;
            Console.WriteLine("Hi, " + username);
        }

    }
}
