WEB开发网
开发学院软件开发C语言 WF4.0 Beta1之旅(3):全新的FlowChart 阅读

WF4.0 Beta1之旅(3):全新的FlowChart

 2010-10-01 08:29:03 来源:WEB开发网   
核心提示: 2.ReadInt:读取控制台输入转换为整数值,并返回,WF4.0 Beta1之旅(3):全新的FlowChart(2),代码如下:namespaceCaryGuessGame{publicclassReadInt:NativeActivity<int>{InArgument<

2.ReadInt:读取控制台输入转换为整数值,并返回,代码如下:

namespace CaryGuessGame
{
  public class ReadInt : NativeActivity<int>
  {
    InArgument<string> bookmarkName;

    public ReadInt()
      : base()
    {
    }

    public ReadInt(string bookmarkName)
      : this()
    {
      this.BookmarkName = bookmarkName;
    }

    public InArgument<string> BookmarkName
    {
      get
      {
        return this.bookmarkName;
      }
      set
      {
        ThrowIfOpen();
        this.bookmarkName = value;
      }
    }

    protected override void Execute(ActivityExecutionContext context)
    {
      context.CreateNamedBookmark(BookmarkName.Get(context),
        new BookmarkCallback(OnReadComplete));
    }

    void OnReadComplete(ActivityExecutionContext context, Bookmark bookmark, object state)
    {
      int Guess = Convert.ToInt32(state);
      this.Result.Set(context, Guess);
    }
  }
}

3.Prompt.xaml

项目右键添加新项,使用WorkflowInstance=》Activity模板,

上一页  1 2 3 4  下一页

Tags:WF 之旅

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接