精华内容
下载资源
问答
  • C#Workflow工作流

    热门讨论 2011-06-29 14:11:36
    C#Workflow工作流实例.看过demo以后决对可以 自己在项目中能实现自己的工作流
  • C#编写WorkFlow真的很困难吗?

    千次阅读 2004-07-07 17:53:00
    最近查阅了一下网上资料,确实这方面的内容很少。一点不如JAVA在工作流方面的工作那么扎实。由此我想在这方面做点工作,看用C#实现工作流到底的困难有多大。
    最近查阅了一下网上资料,确实这方面的内容很少。一点不如JAVA在工作流方面的工作那么扎实。由此我想在这方面做点工作,看用C#来实现工作流到底的困难有多大。
    展开全文
  • 曾经我们遇到过这样的一个问题:由于workflow的一个基本的功能实现就是将webservice有序的串起来 我们必须解决在不同的webservice以及C# Client 之间传递数据的难题。这个问题困扰了我们一个多星期之久, 我还因为这...
    曾经我们遇到过这样的一个问题:
    由于workflow的一个基本的功能实现就是将webservice有序的串起来 我们必须解决在不同的webservice以及C# Client 之间传递数据的难题。这个问题困扰了我们一个多星期之久, 我还因为这个难题被老板challenge了一次.....5555
    其实 直白的点的妙诉问题 就是:
    Workflow 调用WS1 ,WS1将返回一个ResultDTO , 这个DTO将存储在Workflow的process里面。 此时 我们再调用WS2   然后返回C#。  这是 如何将ResultDTO 传回C#  将是一个问题。 我们知道C#要主动调用 WS,  WS总是被动的, 不可能主动的传送数据。
    问题的英文Doc 如下:
    We are dealing with a demo project about delivery order(DO) handling process. A major step of the process is the DO confirmation, which requires human interaction to manually confirm the DO, consequently, a ConfirmDO webservice is called to update the database, and some result information is generated by the web service and sent back to the caller.
          Originally, we handle the situation in this way:
    1. The demo process initiates a DO confirmation user task, which requires human interaction to complete it.
    2. .NET layer, the caller, call the ConfirmDO webservice to update the database, and get a ResultDTO for information. The ResultDTO carries a flag which indicates whether the database is successfully updated.
    3. According to the ResultDTO, .NET layer, call the completeTask webservice to complete the confirmation user task. (Note, the completeTask webservice is created using BPEL API and deployed in a different OC4J with service layer’s)
    4. The process then can go to the next activity.
     
    Workflow has no control with the business process, it just waiting for C# ’s message.
     
    See Figure 1 for the original process.
    Figure 1
          In order to better utilize the process, we changed  the process as follows, see Figure 2:
    Figure 2
    As you can see from Figure 2, the situation is handled in another way(The shaded part is modified):
    1. The demo process initiates a DO confirmation user task, which requires human interaction to complete it.
    2. .NET layer, call the completeTask webservice to complete the confirmation user task. (Note: the completeTask webservice is created using BPEL API and deployed in a different OC4J with service layer’s).
    3. The process invoke the ConfirmDO webservice to update the database.
    4. The process then can go to the next activity.
     
    If we do like this, we can be sure when the process got to the next activity, the former one must be executed successfully, and we will be truly using process to control the services.
     
     
    The second way seems more rational; however, we encountered a problem:
     
    For we need to present the result to user, we need a resultDTO to update the datagrid in C# client.  In the clicking button event, we will also write codes for grid updating, together with writing codes for giving user message to bpel process.
     
    The problem is invoking a webservice must be written like this,
     
     
    So the return value will be send back follow the invoking way to the process .
     
    That means if we want to get a return DTO from the service, we should let another webservice send a message to C# initiatively, we know that is impossible.
     
    So After ConfirmDO webservice is called, how could we return the ResultDTO back to the .NET layer?
     
     
     
     经过研究我们相处了这样一个办法:
    文档如下:

    Solution for BPEL controlled process 

    1            Definition of Purpose

    The purpose of this document is to describe the solution for BPEL controlled process.

    2            Description of Problems

    2.1         User task

    As we all know, user interaction is an essential part of workflow. In BPEL, user task is the mechanism to implement user interaction with a process.

    Generally, when a user interaction is required, the BPEL process initiates a user task and assigns it to a certain user. The user can check his/her tasks in the worklist and do necessary operations (update, complete, reject, etc). Right after the task is handled, the result is returned to the BPEL process, which causes the process to call certain web services to do actual work implied in the task. Figure 2.1 illustrates the whole process. 

    Figure 2.1 BPEL process with user task

    2.2         The original usage of user task in BPEL process

    Although the standard solution for user task of BPEL process should follow the steps illustrated in Figure 2.1, the current solution is not done in that way. Instead, BPEL process initiates tasks and waits for response as usual, the web service which ought to be called by BPEL process is currently called by the frontier layer (.NET layer in MiniTMS), and task is completed after the web service is successfully called. The current solution can be illustrated by Figure 2.2.

    Figure 2.2 current solution

    You may find that the web service is by no means orchestrated by BPEL process, instead, the .NET layer works as a controller when handling a user task. We handle this case in this way because some limitations: the web service called may return some data back to the .NET layer for future use. If we use the standard solution showed in Figure 2.1, we simply can not return the data back to the .NET layer because BPEL process does not know where to send the data. Although the current solution works, t is absolutely a deviation from the BPEL principle and may cause problems.

    3            Solutions for BPEL controlled process

    3.1         Solution description

    In order to solve the problem, and use user task properly, we figure out a new solution, which seems more rational.

    You may find that the major bottle-neck is the return of data generated by web service to the .NET layer (The demo Loan Flow in BPEL tutorial follows the standard solution but does not return any data back to the frontier layer after CreditRating web service is called).
    In the new solution, the main BPEL process(MainFlow) follows the standard steps to deal with user task, and another BPEL process(Callee) is set up for completing the user task and gets the return data generated by web service from communication with the main BPEL process. Since BPEL process Callee is directly called by .NET layer(.NET layer works as the client for Callee), it can return the data by simply call back the client. Figure 3.1 shows how it works.

    Figure 3.1 new solution

     

    3.2         Demo for the new solution

    A demo project is set up to show implementation of the new solution. Figure 3.2 for MainFlow and Figure 3.3 for Callee. The web service here is CreditRating web service, it simply returns a rating and the rating is treated as the data we need to send back to the .NET layer.

    C

    B

    A

    Figure3.2 Mainflow

    E

    D

    Figure3.3 Callee

                    Here is some description for the blocks outlined in the process.

                    A: initiates a user task and waits response of it.

                    B: call a web service.
                    C: return data to the callee.

                    D: complete the user task.
                    E: get the return data from the MainFlow.

                    For more detail, please check the attachment for the demo project.

                   

    3.3         How to play around the demo

    How to play around? Follow the steps below:

    1.        Initiate the MainFlow process, the input string is for task customKey. As a result, the MainFlow process is active and a user task whose customKey is the input has been initiated.

    2.        Initate the Callee process, the input string should be the customKey for the user task you want to complete.

    If the input string in step 1 and step 2 are the same, both the processes are completed, Callee can get the return data of CreditRating web service called in MainFlow.          

    If the input string in step 1 and step 2 are different, MainFlow is stilling waiting for task completion response, and Callee is waiting for the return data from its matching MainFlow process instance.

    4            Demo Analysis

    In the demo, Two BPEL processes, Callee and Mainflow need to interact with each other. In order to enable these two process instances to interact during run time, correlationset should be used. Correlationset is based on the user-defined properties, and properties are linked to some payload of messages sent between processes.

    When two processes instance interact, properties on each part are checked. If the properties match, the two instances are regarded as corresponding ones (See tutorial ABCRouting for another example of correlationset).

    Message and correlationset definitions will be covered in 4.1 and 4.2.

    4.1         Message Definition

    In the demo, we use same message definition for both Callee and Mainflow, for messages for interaction between the two processes should by all means the same. What is more, properties setting are also based on unified messages.

    <?xml version="1.0" encoding="UTF-8"?>

    <definitions name="Callee1"

                 targetNamespace="http://xmlns.oracle.com"

                 xmlns="http://schemas.xmlsoap.org/wsdl/"

                 xmlns:client="http://xmlns.oracle.com"

                 xmlns:plnk="http://schemas.xmlsoap.org/ws/2003/05/partner-link/"

                 xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/">

     

                    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                    TYPE DEFINITION - List of services participating in this BPEL process

                    The default output of the BPEL designer uses strings as input and

                    output to the BPEL Process. But you can define or import any XML

                    Schema type and us them as part of the message types.

                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->  

                    <types>

                    <schema attributeFormDefault="qualified"

                                     elementFormDefault="qualified"

                                     targetNamespace="http://xmlns.oracle.com"

                                     xmlns="http://www.w3.org/2001/XMLSchema">

                    <element name="ProcessRequest">

                                    <complexType>

                                                    <sequence>

                                                                    <element name="input" type="string"/>

                                                             <element name="credit" type="string"/>

                                                  </sequence>

                                    </complexType>

                    </element>

                    <element name="ProcessResponse">

                                    <complexType>

                                                    <sequence>

                                                                    <element name="result" type="string"/>

                                                    </sequence>

                                    </complexType>

                    </element>

                    </schema>

                    </types>

     

                    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                    MESSAGE TYPE DEFINITION - Definition of the message types used as

                    part of the port type defintions

                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->     

                    <message name="RequestMessage">

                                    <part name="payload" element="client:ProcessRequest"/>

                    </message>

     

                    <message name="ResponseMessage">

                                    <part name="payload" element="client:ProcessResponse"/>

                    </message>

    </definitions>

    4.2         Correlationset Definition

    In the demo, we use the payload of Request Message /ProcessRequest/input as the property for correlationset. When the instances of Callee and Mainflow interact, the payload from both side are checked to see whether they are the same. If they match, the two instances are regarded as corresponding ones.

    1. in .bpel file

    <correlationSets>

        <correlationSet name="CorrelationSet" properties="cor:orderId"/>

    </correlationSets>

    2. in process .wsdl file

    <bpws:propertyAlias propertyName="cor:orderId" messageType="client:RequestMessage" part="payload" query="/client:ProcessRequest/client:input"/>

    <bpws:property name="orderId" type="xsd:string"/>

    The correlationset setting ought to follow the following steps:

    1.        Create properties.

    2.        Assign necessary message payload as the property alias for each property.

    3.        Create correlationset and add property to it.

    4.        Set correlationset for BPEL activities when necessary.

     

    4.3         Use WorklistManager to complete a user task

    To use WorklistManager to complete a user task, the following steps are suggested:

    1.        Set the search condition WhereCondition for task listing.

    2.        Use operation listTasks to list the tasks needed.

    3.        Get the task that needs to be completed.

    4.        Assign the task to the input Variable for operation completeTask.

    5.        Do operation completeTask to complete the user task.

    Since the original WorklistManager jar has bug while listing tasks, a modified WorklistManager jar is attached here.

    这样 就大致解决了这个问题。

    Oracle BPEL PM  内部提供了一个CorrelationSet  Demo了这个问题中一个部分的详细实现

    展开全文
  • Windows Workflow Foundation(以下简称WWF)是Visual Studio 2008中一个核心组件,主要用来实现工作流。WWF的出现大大简化了软件开发的流程,同时引入了新的软件开发思想。 转载于:...
        Windows Workflow Foundation(以下简称WWF)是Visual Studio 2008中一个核心组件,主要用来实现工作流。WWF的出现大大简化了软件开发的流程,同时引入了新的软件开发思想。

    转载于:https://www.cnblogs.com/008aspnet/archive/2008/06/23/1228228.html

    展开全文
  • C#中调用VBScript、JavaScript等脚本的实现 作者:郑佐 2004-04-26 以前在做工作流(workflow)项目的时候,里面有一项就是在用户制定流程定义时可以编写脚本来控制活动的跳转,而这些脚本定义后存在数据库中,当...

    在C#中调用VBScript、JavaScript等脚本的实现

    作者:郑佐

    2004-04-26

    以前在做工作流(workflow)项目的时候,里面有一项就是在用户制定流程定义时可以编写脚本来控制活动的跳转,而这些脚本定义后存在数据库中,当流程启动的时候,工作流引擎会控制活动执行顺序,串型的两个活动比较简单,但有的活动到下一个活动有条件判断,或者存在多个分支,简单的还好,只要在数据库表中加个字段就可以实现,复杂一点的就需要通过脚本实现了。当时经验不够,几天都没找到快速的解决办法,想自己写一个自定义脚本引擎没有把握,而且时间也不够,还是在网上找找看吧,花了一些时间,还是找到了一个自认为比较好的解决办法,写出来同大家分享。
    下面通过两部分来说明实现以及应用。

    一.使用MSScriptControl

    到微软的网站上下载Windows Script Control,它是一个ActiveX(R) 控件,所以在.NET中使用我Interop了一下。下载安装完成后,新建一个C#的Windows应用程序项目,在解决方案资源管理器中选中引用节点,右键点击选择添加引用菜单,弹出添加引用对话框,单击浏览找到安装Windows Script Control的目录,选取msscript.ocx文件确定。那么在引用节点下会增加一个MSScriptControl组件,下面是他Interop后的所有对象。
    类

    ScriptControl 对支持 ActiveX(TM) Script 的宿主 Script 引擎提供简单接口。接下来我们对被转化成ScriptControlClass类的ScriptControl的属性和方法进行一些说明。

    属性

    AllowUI 属性:应用于 ScriptControl 本身或 Scirpt 引擎显示的用户界面元素,可读写。

    CodeObject 属性:返回对象,该对象用于调用指定模块的公用成员。只读。

    Error 属性:返回 Error 对象,其中包含所发生的最后一个错误的相关详细信息。只读。

    Language 属性:设置或返回正在使用的 Script 语言名称。可读写。

    Modules 属性:为 ScriptControl 对象返回模块集合。只读。

    Procedures 属性:返回在指定模块中定义的过程集合。只读。

    SitehWnd 属性:设置或返回窗口的 hWnd,通过执行 Script 代码,此窗口用于显示对话框和其他用户界面元素。可读写。

    State 属性:设置或返回 ScriptControl 对象的模式。可读写。

    Timeout 属性:设置或返回时间(毫秒),此时间后用户可选择中止 Script 代码的执行或允许代码继续执行。可读写。

    UseSafeSubset 属性:设置或返回 Boolean 值,指明宿主应用程序是否有保密性要求。如果宿主应用程序需要安全控制,则 UseSafeSubset 为 True,否则为 False。可读写。

    方法

    AddCode 方法:向模块添加指定代码。可多次调用 AddCode 方法。

    AddObject 方法:使主机对象模型对 Script 引擎可用。

    Eval 方法:计算表达式并返回结果。

    ExecuteStatement 方法:执行指定的语句。

    Reset 方法:放弃所有已经添加到 ScriptControl 中的 Script 代码和对象。

    Run 方法:运行指定过程。

    事件

    Error 事件:出现运行时错误时,发生此事件。

    Timeout 事件:当超出了 Timeout 属性指定的时间且用户在结果对话框中选定了 End 时,发生此事件。

    补充几点

    AllowUI 属性如果设置为false,则显示对话框之类的语句不起作用,如在 VBScript 中MsgBox 语句,JavaScript中的alert等,并且如果执行的脚本超出TimeOut设置的毫秒数,也不会跳出超出时间提醒的对话框,反之则相反;重新设置 Language 属性会清空AddCode加载的代码;对于TimeOut属性,发生超时时,ScriptControl 检查对象的 AllowUI 属性,确定是否允许显示用户界面元素。

    如果读者需要更详细的了解,可以查看MSDN文档。

    为了使控件更容易使用,我用一个ScriptEngine类包装了一下,下面是完整代码:

    using System;

    using MSScriptControl;

    using System.Text;

    namespace ZZ

    {

         /// <summary>

         /// 脚本类型

         /// </summary>

         public enum ScriptLanguage

         {

             /// <summary>

             /// JScript脚本语言

             /// </summary>

             JScript,

             /// <summary>

             /// VBscript脚本语言

             /// </summary>

             VBscript,

             /// <summary>

             /// JavaScript脚本语言

             /// </summary>

             JavaScript

         }

         /// <summary>

         /// 脚本运行错误代理

         /// </summary>

         public delegate void RunErrorHandler();

         /// <summary>

         /// 脚本运行超时代理

         /// </summary>

         public delegate void RunTimeoutHandler();

         /// <summary>

         /// ScriptEngine类

         /// </summary>

         public class ScriptEngine

         {

             private ScriptControl msc;

             //定义脚本运行错误事件

             public event RunErrorHandler RunError;

             //定义脚本运行超时事件

             public event RunTimeoutHandler RunTimeout;

             /// <summary>

             ///构造函数

             /// </summary>

             public ScriptEngine():this(ScriptLanguage.VBscript)

             {

             }

             /// <summary>

             /// 构造函数

             /// </summary>

             /// <param name="language">脚本类型</param>

             public ScriptEngine(ScriptLanguage language)

             {

                  this.msc = new ScriptControlClass();

                  this.msc.UseSafeSubset = true;

                  this.msc.Language = language.ToString();

                  ((DScriptControlSource_Event)this.msc).Error += new DScriptControlSource_ErrorEventHandler(ScriptEngine_Error);

                  ((DScriptControlSource_Event)this.msc).Timeout += new DScriptControlSource_TimeoutEventHandler(ScriptEngine_Timeout);

             }

             /// <summary>

             /// 运行Eval方法

             /// </summary>

             /// <param name="expression">表达式</param>

             /// <param name="codeBody">函数体</param>

             /// <returns>返回值object</returns>

             public object Eval(string expression,string codeBody)

             {

                  msc.AddCode(codeBody);

                  return msc.Eval(expression);

             }

             /// <summary>

             /// 运行Eval方法

             /// </summary>

             /// <param name="language">脚本语言</param>

             /// <param name="expression">表达式</param>

             /// <param name="codeBody">函数体</param>

             /// <returns>返回值object</returns>

             public object Eval(ScriptLanguage language,string expression,string codeBody)

             {

                  if(this.Language != language)

                       this.Language = language;

                  return Eval(expression,codeBody);

             }

             /// <summary>

             /// 运行Run方法

             /// </summary>

             /// <param name="mainFunctionName">入口函数名称</param>

             /// <param name="parameters">参数</param>

             /// <param name="codeBody">函数体</param>

             /// <returns>返回值object</returns>

             public object Run(string mainFunctionName,object[] parameters,string codeBody)

             {

                  this.msc.AddCode(codeBody);

                  return msc.Run(mainFunctionName,ref parameters);

              }

             /// <summary>

             /// 运行Run方法

             /// </summary>

             /// <param name="language">脚本语言</param>

             /// <param name="mainFunctionName">入口函数名称</param>

             /// <param name="parameters">参数</param>

             /// <param name="codeBody">函数体</param>

             /// <returns>返回值object</returns>

             public object Run(ScriptLanguage language,string mainFunctionName,object[] parameters,string codeBody)

             {

                  if(this.Language != language)

                       this.Language = language;

                  return Run(mainFunctionName,parameters,codeBody);

             }

             /// <summary>

             /// 放弃所有已经添加到 ScriptControl 中的 Script 代码和对象

             /// </summary>

             public void Reset()

             {

                  this.msc.Reset();

             }

             /// <summary>

             /// 获取或设置脚本语言

             /// </summary>

             public ScriptLanguage Language

             {

                  get{return (ScriptLanguage)Enum.Parse(typeof(ScriptLanguage),this.msc.Language,false);}

                  set{this.msc.Language = value.ToString();}

             }

             /// <summary>

             /// 获取或设置脚本执行时间,单位为毫秒

             /// </summary>

             public int Timeout

             {

                  get{return this.msc.Timeout;}

                  set{this.msc.Timeout = value;}

             }

             /// <summary>

             /// 设置是否显示用户界面元素

             /// </summary>

             public bool AllowUI

             {

                  get{return this.msc.AllowUI;}

                  set{this.msc.AllowUI = value;}

             }

             /// <summary>

             /// 宿主应用程序是否有保密性要求

             /// </summary>

             public bool UseSafeSubset

             {

                  get{return this.msc.UseSafeSubset;}

                  set{this.msc.UseSafeSubset = true;}

             }

             /// <summary>

             /// RunError事件激发

             /// </summary>

             private void OnError()

             {

                  if(RunError!=null)

                       RunError();

             }

             /// <summary>

             /// OnTimeout事件激发

             /// </summary>

             private void OnTimeout()

             {

                  if(RunTimeout!=null)

                       RunTimeout();

             }

             private void ScriptEngine_Error()

             {

                  OnError();

             }

             private void ScriptEngine_Timeout()

             {

                  OnTimeout();

             }

         }

    }

    上面的包装定义了一个ScriptLanguage枚举,这样操作起来更方便一点。另外脚本引擎包括了Error事件和Timeout事件,根据实际使用情况可进行注册。

    二.脚本引擎演示

         我建了个窗体程序,测试包括脚本语言的选择,是否开启AllowUI属性,超时时间的设置,以及脚本引擎调用方法的选择。测试程序代码比较长,下面列出了主要部分:

    using System;

    using System.Drawing;

    using System.Collections;

    using System.ComponentModel;

    using System.Windows.Forms;

    using System.Data;

    namespace ZZ

    {

         public class Form1 : System.Windows.Forms.Form

         {

             private ScriptEngine scriptEngine;

             private System.Windows.Forms.CheckBox checkBoxAllowUI;

             private System.Windows.Forms.TextBox textBoxResult;

             private System.Windows.Forms.NumericUpDown numericUpDownTimeout;

             private System.Windows.Forms.TextBox textBoxCodeBody;

             private System.Windows.Forms.Button buttonRun;

             private System.Windows.Forms.Button buttonCancel;

             private System.Windows.Forms.ComboBox comboBoxScript;

             private System.Windows.Forms.TextBox textBoxParams;

             private System.Windows.Forms.RadioButton radioButtonEval;

             private System.Windows.Forms.RadioButton radioButtonRun;

             private System.Windows.Forms.TextBox textBoxMethodName;

             private System.ComponentModel.Container components = null;

             public Form1()

             {

                  InitializeComponent();

                  this.comboBoxScript.SelectedIndex = 0;

                  this.scriptEngine = new ScriptEngine();

                  this.scriptEngine.UseSafeSubset = true;

                  this.scriptEngine.RunError += new RunErrorHandler(scriptEngine_RunError);

                  this.scriptEngine.RunTimeout += new RunTimeoutHandler(scriptEngine_RunTimeout);

             }

             protected override void Dispose( bool disposing )

             {

                  if( disposing )

                       if (components != null)

                           components.Dispose();

                  base.Dispose( disposing );

             }

             #region Windows 窗体设计器生成的代码

             private void InitializeComponent()

             {

                  //省略

             }

             #endregion

              [STAThread]

             static void Main()

             {

                  Application.Run(new Form1());

             }

             //运行脚本

             private void buttonRun_Click(object sender, System.EventArgs e)

             {

                  this.scriptEngine.Reset();

                  this.scriptEngine.Language = (ScriptLanguage)Enum.Parse(typeof(ScriptLanguage),this.comboBoxScript.SelectedItem.ToString());

                  this.scriptEngine.Timeout = (int)this.numericUpDownTimeout.Value;

                  this.scriptEngine.AllowUI = this.checkBoxAllowUI.Checked;

                  if(this.radioButtonEval.Checked)//执行Eval方法

                  {

                       this.textBoxResult.Text = this.scriptEngine.Eval(this.textBoxMethodName.Text+"("+this.textBoxParams.Text+")",this.textBoxCodeBody.Text).ToString();

                  }

                  else//执行Run方法

                  {

                       string[] parameters = (string[])this.textBoxParams.Text.Split(',');

                       object [] paramArray = new object[parameters.Length];

                       for(int i = 0;i<parameters.Length;i++)

                           paramArray[i] = Int32.Parse(parameters[i]);

                       this.textBoxResult.Text = this.scriptEngine.Run(this.textBoxMethodName.Text,paramArray,this.textBoxCodeBody.Text).ToString();

                  }

             }

             //退出程序

             private void buttonCancel_Click(object sender, System.EventArgs e)

             {

                  this.Close();

             }

             //错误函数

             private void scriptEngine_RunError()

             {

                  MessageBox.Show("RunError执行脚本错误!");

             }

             private void scriptEngine_RunTimeout()

             {

                  MessageBox.Show("RunTimeout执行脚本超时,引发错误!");

             }

         }

    }

    测试界面

    在文本框中写了一个JavaScript的函数。输入12,输出12000012。

    如果把超时时间调整为1毫秒,那么执行该脚本就会跳出下面的超时提醒框,同时激发事件。

    总结,上面演示了JavaScript脚本,如果有兴趣读者可以写一些VBsript函数进行测试,脚本语言也只列出了三种,看了帮助,他还支持其他一些脚本,如果需要可以添加。另外,因为是调用Com,有些返回值是obejct类型的,需要进行转换。在CSDN的技术论坛C#板块下时常有朋友问这方面的问题,对于碰到这类问题的朋友,希望通过这篇文章能获得一些你需要的帮助,很高兴能和搞.net的朋友进行交流,我的邮件地址zhzuocn@163.com

    引用 :http://blog.csdn.net/zhzuo/article/details/22031

    资料: http://www.cnblogs.com/hailexuexi/archive/2011/02/15/1955166.html

    转载于:https://www.cnblogs.com/chencidi/p/4723783.html

    展开全文
  • C#中调用JavaScript等脚本的实现 作者:秋枫 发布时间:2004-4-29 9:49:05 文章来源:csdn 以前在做工作流(workflow)项目的时候,里面有一项就是在用户制定流程定义时可以编写脚本来控制活动的跳转,而这些脚本...
  • C#中调用VBScript、JavaScript等脚本的实现 以前在做工作流(workflow)项目的时候,里面有一项就是在用户制定流程定义时可以编写脚本来控制活动的跳转,而这些脚本定义后存在数据库中,当流程启动的时候,工作流...
  • 以前在做工作流(workflow)项目的时候,里面有一项就是在用户制定流程定义时可以编写脚本来控制活动的跳转,而这些脚本定义后存在数据库中,当流程启动的时候,工作流引擎会控制活动执行顺序,串型的两个活动比较简单...
  • 以前在做工作流(workflow)项 目的时候,里面有一项就是在用户制定流程定义时可以编写脚本来控制活动的跳转,而这些脚本定义后存在数据库中,当流程启动的时候,工作流引擎会控制活动执 行顺序,串型的两个活动比较...
  • 以前在做工作流(workflow)项目的时候,里面有一项就是在用户制定流程定义时可以编写脚本来控制活动的跳转,而这些脚本定义后存在数据库中,当流程启动的时候,工作流引擎会控制活动执行顺序,串型的两个活动比较简单...
  • 以前在做工作流(workflow)项目的时候,里面有一项就是在用户制定流程定义时可以编写脚本来控制活动的跳转,而这些脚本定义后存在数据库中,当流程启动的时候,工作流引擎会控制活动执行顺序,串型的两个活动比较简单...
  • 以前在做工作流(workflow)项目的时候,里面有一项就是在用户制定流程定义时可以编写脚本来控制活动的跳转,而这些脚本定义后存在数据库中,当流程启动的时候,工作流引擎会控制活动执行顺序,串型的两个活动比较简单...
  • 浅析C#工作流以及功能

    千次阅读 2014-03-13 13:53:21
    C# 工作流(Workflow)就是工作流程的计算模型,即将工作流程中的工作如何前后组织在一起的逻辑和规则在计算机中以恰当的模型进行表示并对其实施计算。工作流要解决的主要问题是:为实现某个业务目标,在多个参与者...
  • 本书最后一章是第27 章,介绍了Windows Workflow Foundation(WF),它允许在应用程序中执 行工作流功能,因此可以定义一些操作,这些操作由外部的交互操作控制,按特定顺序执行,这对 许多类型的应用程序都很有帮助。
  • 另外,C#和.NET都对开发人员编写程序的方式进行了革新,更易于实现在Windows上的编程。 那么,.NET和C#有什么优点? .NET和C#的重要性 为了理解.NET的重要性,就一定要了解过去20年来出现的许多Windows技术的本质...
  • 3.2.4 用C#如何实现继承 29 3.2.5 多态 30 3.2.6 用C#如何实现多态 31 3.3 面向对象开发的简单实例 31 3.3.1 面向对象功能设计 31 3.3.2 面向对象的类设计 32 3.3.3 面向对象的应用 32 3.4 小结 34 第2篇 C#中的LINQ...
  • C#高级编程(第6版)

    2011-05-11 11:10:30
    第Ⅰ部分 C# 语言  第1章 .NET体系结构  1.1 C#与.NET的关系  1.2 公共语言运行库  1.2.1 平台无关性  1.2.2 提高性能  1.2.3 语言的互操作性  1.3 中间语言  1.3.1 面向对象和接口的支持  1.3.2 相异值...
  • 第Ⅰ部分 C# 语言  第1章 .NET体系结构  1.1 C#与.NET的关系  1.2 公共语言运行库  1.2.1 平台无关性  1.2.2 提高性能  1.2.3 语言的互操作性  1.3 中间语言  1.3.1 面向对象和接口的支持  1.3.2 相异值...
  • 以前在做工作流(workflow)项目的时候,里面有一项就是在用户制定流程定义时可以编写脚本来控制活动的跳转,而这些脚本定义后存在数据库中,当流 程启动的时候,工作流引擎会控制活动执行顺序,串型的两个活动比较...

空空如也

空空如也

1 2 3
收藏数 44
精华内容 17
热门标签
关键字:

c#workflow实现

c# 订阅