當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。