WF 和 WPF 交互的真实示例

发布于 2024-10-17 16:22:10 字数 178 浏览 2 评论 0 原文

我正在寻找一些有关 Windows Presentation Foundation 和 Workflow Foundation 之间交互的真实示例。我看到的大多数 WF 教程都演示了在控制台应用程序中的使用。我对使用丰富的 WPF 界面和 WF 的应用程序更好奇。特别是如果它们允许用户定义的工作流程(允许用户动态设计和运行自己的工作流程)。

I'm looking for some good real-world examples of interaction between Windows Presentation Foundation and Workflow Foundation. Most of the WF tutorials I see demonstrate use within console applications. I'm more curious about applications that use a rich WPF interface and WF. Particularly if they allow user defined workflows (allow users to design and run their own workflows on the fly).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

花期渐远 2024-10-24 16:22:10

我不确定您到底在寻找什么,但这里有一些链接,指向有关以某种方式在桌面 (WPF) 应用程序中使用工作流的实际应用程序的信息:

I'm not sure what exactly you're looking for, but here are some links to information about actual real world applications using Workflow in desktop (WPF) applications in one way or another:

浪菊怪哟 2024-10-24 16:22:10

让我举一个尝试让两个工作流程相互通信的例子。

  1. 首先您需要编写一个主机。这是一个非常繁重的命题,因为要使两个 WF 主机相互通信,您还需要了解 WCF 以及所有模糊的线程概念。
  2. 然后您的 WF 将需要通过主机与其他 WF 进行通信。这是有道理的,因为当 WF 等待另一个 WF 发送事件时,它不会在内存中保持运行 3 个月。 WF 位于数据库中,并且通过主机进行通信。
  3. 好的,即使对于更简单的场景,对于本地进程内通信,您也有 CallExternalMethod 活动和 HandleExternalEvent 活动。即使在这种情况下,您也必须通过主机进行通信,因为 WF 可能已对数据库进行钝化。因此,为了做到这一点,您必须记住做三件事,用ExternalDataExchangeAttribute装饰您的界面,eventargs需要从ExternalDataEventArgs派生,并且事件args是可序列化的。
  4. 如果你搞砸了 #3 中的任何一项,你会得到一个非常不直观的“InvalidOperationException”。当然,该消息说“服务未实现具有ExternalDataExchange属性的接口”,但直到您查看内部异常,您才真正知道发生了什么 - 即您忘记使其可序列化。哦!但我确实将其标记为可序列化。实际上,一切都需要可序列化,即使是发送者。
  5. 然后,您必须通过用于通信的正确接口名称和方法名称来连接 WF 活动。
  6. 最后,即使对于进程内 WF 通信,您也必须记住将服务添加到ExternalDataExchangeService,而不是WF 运行时。否则,看起来好像没有人订阅该活动。更不用说,这是其中一个错误,它并不会真正引发错误。即很难追踪!

因此,简而言之,对于尝试使两个工作流程进行通信的简单场景,您需要很好地处理以下内容:

*编写 Windows 应用程序(针对主机),
*螺纹加工,
*WCF,
*面向对象编程的概念,
*序列化的所有概念,
*WF 本身有大量的连接和非直观细节,
*忍者调试技巧。

来源:http://blah.winsmarts.com/2008-2-I've_been_here_before.aspx

Let me take the example of trying to make two workflows communicate with each other.

  1. First you need to write a host. This is an extremely loaded proposition, because for two WF hosts to talk to each other, you will then also need to know WCF, and all mushy concepts of threading.
  2. Then your WF will need to communicate with other WFs via the hosts. This makes sense because a WF doesn't keep running in memory for 3 months, when it is waiting for another WF to send an event. The WF sits in the database, and the communication occurs through the hosts.
  3. Okay, even for simpler scenarios, for local in-process communication, you have the CallExternalMethod activity, and HandleExternalEvent activities. Even in this case, you have to talk via the host, because the WF might have been passivated to the database. So in order to do so, you have to remember to do 3 things, decorate your interface with the ExternalDataExchangeAttribute, eventargs needs to derive from ExternalDataEventArgs, and event args is serializable.
  4. If you mess up in any of the items in #3, you get a very non-intuitive "InvalidOperationException". Sure the message says, "Service does not implement an interface with the ExternalDataExchange attribute", but it isn't until you look at the inner exception, that you really know what happened - i.e. you forgot to make it serializable. doh! But I did mark it as serializable. Actually, everything needs to be serializable, even the sender.
  5. Then you have to connect the WF activities, via the proper interface names and method names you are using to communicate.
  6. Finally, for even in-process WF communication, you have to remember to add your service to the ExternalDataExchangeService, and not the WF runtime. Otherwise, it will look like nobody is subscribing to the event. Not to mention, that this is one of those bug, that doesn't really throw an error. i.e. hard to track down!

So, in short, for the simplistic scenario of trying to make two workflows communicate, you need to have a good handle on the following:

*Writing windows apps (for the host),
*Threading,
*WCF,
*OOP Concepts,
*All concepts of serialization,
*Plenty of hooking up and non-intuitive details of WF itself,
*Ninja debugging skills.

Source:http://blah.winsmarts.com/2008-2-I've_been_here_before.aspx

ˉ厌 2024-10-24 16:22:10

这个问题相当模糊,但这里有一个可能的遮阳篷 这篇博客文章是我写的。基本上,我正在重新托管工作流设计器,让最终用户根据需要更改工作流,并让他们立即运行它们。当然,您的问题可能意味着任何事情,例如如何从 WPF 表单调用工作流服务。

The question is pretty vague but here is a possible awnser in this blog post I wrote. Basically I am rehosting the workflow designer to let end users change workflows as needed and let them run them right there and then. Of course you question could mean pretty much anything, like how to call a workflow service from a WPF form.

萌︼了一个春 2024-10-24 16:22:10

这是一种自我推销,因为链接是我的,但是看看

This is a sort of self promotion since the link is mine, but have a look.

烂柯人 2024-10-24 16:22:10

这是我做的一个示例项目,它结合了 WF 和 WPF 来模拟 ATM 机。该代码可解决一些问题,例如处理书签、如何保持工作流程活动以及如何从工作流程操作 UI。

https://wpfwf.codeplex.com/

Here is a sample project I did, which combines WF and WPF to simulate a ATM machine. The code works on some issues like handling the bookmarks, how to keep the workflow alive, and how to manipulate the UI from the workflow.

https://wpfwf.codeplex.com/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文