WF4状态机+书签 [英] WF4 State machine + bookmarks

查看:122
本文介绍了WF4状态机+书签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I 一直在寻找WF4(或更高)的状态机的简历好简单样品(从我已经阅读文档可能书签)。 我想知道怎样才能实现一个状态机,它能够恢复在里面WF任何给定的状态。 因为我不知道WF什么,我希望看到一个简单的状态机,我可以恢复exceution在国家这是最后一次,它也将是很好看怎么力一WF跳到一个国家,再从那里开始(如果可能)。 Thansk了很多。

Ive been searching a good simple sample for WF4 (or higher) state machine with resume (possibly BookMarks from the docs Ive read). I would like to see how can I implement a state machine that is able to resume at any given state inside a WF. Since I don't know anything about WF, I would like to see a simple state machine where I can resume the exceution at the state it was last time and it would also be nice to see how to 'force' a WF to jump to a state and re-start from there (if possible). Thansk a lot.

推荐答案

您需要实现这样一个自定义活动:

You need implement a custom activity like this:

public sealed class WaitForBookmark : NativeActivity
{
    [RequiredArgument]
    public InArgument<String> BookmarkName { get; set; }

    protected override void Execute(NativeActivityContext context)
    {
        context.CreateBookmark(BookmarkName.Get(context));
    }

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

将这个活动里面的状态。当您需要恢复每一个书签。

Put this activity inside a state. After you need to Resume each bookmark.

这篇关于WF4状态机+书签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆