当前位置: 首页>>代码示例>>C#>>正文


C# WorkflowInvoker.Invoke方法代码示例

本文整理汇总了C#中System.Activities.WorkflowInvoker.Invoke方法的典型用法代码示例。如果您正苦于以下问题:C# WorkflowInvoker.Invoke方法的具体用法?C# WorkflowInvoker.Invoke怎么用?C# WorkflowInvoker.Invoke使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Activities.WorkflowInvoker的用法示例。


在下文中一共展示了WorkflowInvoker.Invoke方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Sequence

Activity wf = new Sequence()
{
    Activities = 
    {
        new WriteLine()
        {
            Text = "Before the 1 minute delay."
        },
        new Delay()
        {
            Duration = TimeSpan.FromMinutes(1)
        },
        new WriteLine()
        {
            Text = "After the 1 minute delay."
        }
    }
};

// This workflow completes successfully.
WorkflowInvoker.Invoke(wf, TimeSpan.FromMinutes(2));

// This workflow does not complete and a TimeoutException
// is thrown.
try
{
    WorkflowInvoker.Invoke(wf, TimeSpan.FromSeconds(30));
}
catch (TimeoutException ex)
{
    Console.WriteLine(ex.Message);
}
开发者ID:.NET开发者,项目名称:System.Activities,代码行数:32,代码来源:WorkflowInvoker.Invoke

示例2: Execute

public sealed class Divide : CodeActivity
{
    [RequiredArgument]
    public InArgument<int> Dividend { get; set; }

    [RequiredArgument]
    public InArgument<int> Divisor { get; set; }

    public OutArgument<int> Remainder { get; set; }
    public OutArgument<int> Result { get; set; }

    protected override void Execute(CodeActivityContext context)
    {
        int quotient = Dividend.Get(context) / Divisor.Get(context);
        int remainder = Dividend.Get(context) % Divisor.Get(context);

        Result.Set(context, quotient);
        Remainder.Set(context, remainder);
    }
}
开发者ID:.NET开发者,项目名称:System.Activities,代码行数:20,代码来源:WorkflowInvoker.Invoke

示例3: Divide

int dividend = 500;
int divisor = 36;

Dictionary<string, object> arguments = new Dictionary<string, object>();
arguments.Add("Dividend", dividend);
arguments.Add("Divisor", divisor);

IDictionary<string, object> outputs =
    WorkflowInvoker.Invoke(new Divide(), arguments);

Console.WriteLine("{0} / {1} = {2} Remainder {3}",
    dividend, divisor, outputs["Result"], outputs["Remainder"]);
开发者ID:.NET开发者,项目名称:System.Activities,代码行数:12,代码来源:WorkflowInvoker.Invoke

示例4: Execute

public sealed class Divide : CodeActivity<int>
{
    public InArgument<int> Dividend { get; set; }
    public InArgument<int> Divisor { get; set; }
    public OutArgument<int> Remainder { get; set; }

    protected override int Execute(CodeActivityContext context)
    {
        int quotient = Dividend.Get(context) / Divisor.Get(context);
        int remainder = Dividend.Get(context) % Divisor.Get(context);

        Remainder.Set(context, remainder);

        return quotient;
    }
}
开发者ID:.NET开发者,项目名称:System.Activities,代码行数:16,代码来源:WorkflowInvoker.Invoke

示例5: Divide

int dividend = 500;
int divisor = 36;

Dictionary<string, object> arguments = new Dictionary<string, object>();
arguments.Add("Dividend", dividend);
arguments.Add("Divisor", divisor);

Activity wf = new Divide();

IDictionary<string, object> outputs =
    WorkflowInvoker.Invoke(wf, arguments);

Console.WriteLine("{0} / {1} = {2} Remainder {3}",
    dividend, divisor, outputs["Result"], outputs["Remainder"]);
开发者ID:.NET开发者,项目名称:System.Activities,代码行数:14,代码来源:WorkflowInvoker.Invoke

示例6: Sequence

Activity wf = new Sequence()
{
    Activities = 
    {
        new WriteLine()
        {
            Text = "Before the 1 minute delay."
        },
        new Delay()
        {
            Duration = TimeSpan.FromMinutes(1)
        },
        new WriteLine()
        {
            Text = "After the 1 minute delay."
        }
    }
};

WorkflowInvoker invoker = new WorkflowInvoker(wf);

// This workflow completes successfully.
invoker.Invoke(TimeSpan.FromMinutes(2));

// This workflow does not complete and a TimeoutException
// is thrown.
try
{
    invoker.Invoke(TimeSpan.FromSeconds(30));
}
catch (TimeoutException ex)
{
    Console.WriteLine(ex.Message);
}
开发者ID:.NET开发者,项目名称:System.Activities,代码行数:34,代码来源:WorkflowInvoker.Invoke

示例7: WorkflowInvoker

int dividend = 500;
int divisor = 36;

Dictionary<string, object> arguments = new Dictionary<string, object>();
arguments.Add("Dividend", dividend);
arguments.Add("Divisor", divisor);

WorkflowInvoker invoker = new WorkflowInvoker(new Divide());

IDictionary<string, object> outputs = invoker.Invoke(arguments);

Console.WriteLine("{0} / {1} = {2} Remainder {3}",
    dividend, divisor, outputs["Result"], outputs["Remainder"]);
开发者ID:.NET开发者,项目名称:System.Activities,代码行数:13,代码来源:WorkflowInvoker.Invoke

示例8: Divide

int dividend = 500;
int divisor = 36;

Dictionary<string, object> arguments = new Dictionary<string, object>();
arguments.Add("Dividend", dividend);
arguments.Add("Divisor", divisor);

Activity wf = new Divide();

WorkflowInvoker invoker = new WorkflowInvoker(wf);

IDictionary<string, object> outputs = invoker.Invoke(arguments);

Console.WriteLine("{0} / {1} = {2} Remainder {3}",
    dividend, divisor, outputs["Result"], outputs["Remainder"]);
开发者ID:.NET开发者,项目名称:System.Activities,代码行数:15,代码来源:WorkflowInvoker.Invoke

示例9: Execute

public sealed class DiceRoll : CodeActivity
{
    public OutArgument<int> D1 { get; set; }
    public OutArgument<int> D2 { get; set; }

    static Random r = new Random();

    protected override void Execute(CodeActivityContext context)
    {
        D1.Set(context, r.Next(1, 7));
        D2.Set(context, r.Next(1, 7));
    }
}
开发者ID:.NET开发者,项目名称:System.Activities,代码行数:13,代码来源:WorkflowInvoker.Invoke

示例10: DiceRoll

IDictionary<string, object> outputs =
    WorkflowInvoker.Invoke(new DiceRoll());

Console.WriteLine("The two dice are {0} and {1}.",
    outputs["D1"], outputs["D2"]);
开发者ID:.NET开发者,项目名称:System.Activities,代码行数:5,代码来源:WorkflowInvoker.Invoke

示例11:

Activity wf = new WriteLine
{
    Text = "Hello World."
};

WorkflowInvoker.Invoke(wf);
开发者ID:.NET开发者,项目名称:System.Activities,代码行数:6,代码来源:WorkflowInvoker.Invoke

示例12: WorkflowInvoker

WorkflowInvoker invoker = new WorkflowInvoker(new DiceRoll());

IDictionary<string, object> outputs =
    invoker.Invoke();

Console.WriteLine("The two dice are {0} and {1}.",
    outputs["D1"], outputs["D2"]);

outputs = invoker.Invoke();

Console.WriteLine("The next two dice are {0} and {1}.",
    outputs["D1"], outputs["D2"]);
开发者ID:.NET开发者,项目名称:System.Activities,代码行数:12,代码来源:WorkflowInvoker.Invoke

示例13: WorkflowInvoker

Activity wf = new WriteLine
{
    Text = "Hello World."
};

WorkflowInvoker invoker = new WorkflowInvoker(wf);

invoker.Invoke();
开发者ID:.NET开发者,项目名称:System.Activities,代码行数:8,代码来源:WorkflowInvoker.Invoke

示例14: Execute

public sealed class Add : CodeActivity<int>
{
    public InArgument<int> X { get; set; }
    public InArgument<int> Y { get; set; }

    protected override int Execute(CodeActivityContext context)
    {
        int x = X.Get(context);
        int y = Y.Get(context);

        return x + y;
    }
}
开发者ID:.NET开发者,项目名称:System.Activities,代码行数:13,代码来源:WorkflowInvoker.Invoke

示例15: Add

int x = 1;
int y = 2;

Dictionary<string, object> arguments = new Dictionary<string, object>();
arguments.Add("X", x);
arguments.Add("Y", y);

Console.WriteLine("Invoking Add.");

int result = WorkflowInvoker.Invoke(new Add(), arguments);

Console.WriteLine("{0} + {1} = {2}", x, y, result);
开发者ID:.NET开发者,项目名称:System.Activities,代码行数:12,代码来源:WorkflowInvoker.Invoke


注:本文中的System.Activities.WorkflowInvoker.Invoke方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。