本文整理汇总了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);
}
示例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);
}
}
示例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"]);
示例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;
}
}
示例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"]);
示例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);
}
示例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"]);
示例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"]);
示例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));
}
}
示例10: DiceRoll
IDictionary<string, object> outputs =
WorkflowInvoker.Invoke(new DiceRoll());
Console.WriteLine("The two dice are {0} and {1}.",
outputs["D1"], outputs["D2"]);
示例11:
Activity wf = new WriteLine
{
Text = "Hello World."
};
WorkflowInvoker.Invoke(wf);
示例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"]);
示例13: WorkflowInvoker
Activity wf = new WriteLine
{
Text = "Hello World."
};
WorkflowInvoker invoker = new WorkflowInvoker(wf);
invoker.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;
}
}
示例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);