本文整理汇总了C#中WorkflowRuntime类的典型用法代码示例。如果您正苦于以下问题:C# WorkflowRuntime类的具体用法?C# WorkflowRuntime怎么用?C# WorkflowRuntime使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WorkflowRuntime类属于命名空间,在下文中一共展示了WorkflowRuntime类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Main
static void Main()
{
CreateRoles();
using (WorkflowRuntime workflowRuntime = new WorkflowRuntime())
{
workflowRuntime.StartRuntime();
// Load the workflow type.
Type type = typeof(PurchaseOrderWorkflow);
ExternalDataExchangeService dataService = new ExternalDataExchangeService();
workflowRuntime.AddService(dataService);
poImpl = new StartPurchaseOrder();
dataService.AddService(poImpl);
workflowRuntime.WorkflowCompleted += OnWorkflowCompleted;
workflowRuntime.WorkflowTerminated += OnWorkflowTerminated;
WorkflowInstance instance = workflowRuntime.CreateWorkflow(type);
workflowInstanceId = instance.InstanceId;
instance.Start();
SendPORequestMessage();
waitHandle.WaitOne();
workflowRuntime.StopRuntime();
}
}
开发者ID:spzenk,项目名称:sfdocsamples,代码行数:31,代码来源:Program.cs
示例2: Main
static void Main()
{
string connectionString = "Initial Catalog=SqlPersistenceService;Data Source=localhost;Integrated Security=SSPI;";
using (WorkflowRuntime workflowRuntime = new WorkflowRuntime())
{
ExternalDataExchangeService dataService = new ExternalDataExchangeService();
workflowRuntime.AddService(dataService);
dataService.AddService(expenseService);
workflowRuntime.AddService(new SqlWorkflowPersistenceService(connectionString));
workflowRuntime.StartRuntime();
workflowRuntime.WorkflowCompleted += OnWorkflowCompleted;
workflowRuntime.WorkflowTerminated += OnWorkflowTerminated;
workflowRuntime.WorkflowIdled += OnWorkflowIdled;
workflowRuntime.WorkflowAborted += OnWorkflowAborted;
Type type = typeof(Microsoft.Samples.Workflow.CancelWorkflow.SampleWorkflow);
WorkflowInstance workflowInstance = workflowRuntime.CreateWorkflow(type);
workflowInstance.Start();
waitHandle.WaitOne();
workflowRuntime.StopRuntime();
}
}
开发者ID:spzenk,项目名称:sfdocsamples,代码行数:27,代码来源:Program.cs
示例3: DebugController
internal DebugController(WorkflowRuntime serviceContainer, string hostName)
{
if (serviceContainer == null)
{
throw new ArgumentNullException("serviceContainer");
}
try
{
this.programPublisher = new ProgramPublisher();
}
catch
{
return;
}
this.serviceContainer = serviceContainer;
this.programId = Guid.Empty;
this.controllerConduit = null;
this.channel = null;
this.isZombie = false;
this.hostName = hostName;
AppDomain.CurrentDomain.ProcessExit += new EventHandler(this.OnDomainUnload);
AppDomain.CurrentDomain.DomainUnload += new EventHandler(this.OnDomainUnload);
this.serviceContainer.Started += new EventHandler<WorkflowRuntimeEventArgs>(this.Start);
this.serviceContainer.Stopped += new EventHandler<WorkflowRuntimeEventArgs>(this.Stop);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:25,代码来源:DebugController.cs
示例4: Init
protected override void Init()
{
Kernel.ComponentRegistered += Kernel_ComponentRegistered;
_runtime = new WorkflowRuntime();
Kernel.AddComponentInstance("workflowruntime", _runtime);
}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:7,代码来源:WorkflowFacility.cs
示例5: Main
static void Main()
{
using (WorkflowRuntime workflowRuntime = new WorkflowRuntime())
{
try
{
const string connectString = "Initial Catalog=SqlPersistenceService;Data Source=localhost;Integrated Security=SSPI;";
workflowRuntime.AddService(new SqlWorkflowPersistenceService(connectString));
workflowRuntime.WorkflowCompleted += OnWorkflowCompleted;
workflowRuntime.WorkflowTerminated += OnWorkflowTerminated;
workflowRuntime.WorkflowAborted += OnWorkflowAborted;
workflowRuntime.StartRuntime();
Type type = typeof(Compensation.PurchaseOrder);
workflowRuntime.CreateWorkflow(type).Start();
waitHandle.WaitOne();
}
catch (Exception ex)
{
if (ex.InnerException != null)
Console.WriteLine(ex.InnerException.Message);
else
Console.WriteLine(ex.Message);
}
finally
{
workflowRuntime.StopRuntime();
}
}
}
开发者ID:spzenk,项目名称:sfdocsamples,代码行数:33,代码来源:Program.cs
示例6: Main
static void Main()
{
using (WorkflowRuntime workflowRuntime = new WorkflowRuntime())
{
try
{
// Start the engine.
workflowRuntime.StartRuntime();
// Load the workflow type.
Type type = typeof(Microsoft.Samples.Workflow.Synchronized.SynchronizedActivityWorkflow);
workflowRuntime.WorkflowCompleted += OnWorkflowCompleted;
workflowRuntime.WorkflowTerminated += OnWorkflowTerminated;
workflowRuntime.ServicesExceptionNotHandled += OnExceptionNotHandled;
workflowRuntime.CreateWorkflow(type).Start();
waitHandle.WaitOne();
}
catch (Exception e)
{
Console.WriteLine("Exception \n\t Source: {0} \n\t Message: {1}", e.Source, e.Message);
}
finally
{
workflowRuntime.StopRuntime();
Console.WriteLine("\nWorkflow runtime stopped, program exiting... \n");
}
}
}
开发者ID:ssickles,项目名称:archive,代码行数:32,代码来源:Program.cs
示例7: Main
static void Main()
{
using (WorkflowRuntime workflowRuntime = new WorkflowRuntime())
{
try
{
// engine will unload workflow instance when it is idle
workflowRuntime.AddService(new FilePersistenceService(true));
workflowRuntime.WorkflowCreated += OnWorkflowCreated;
workflowRuntime.WorkflowCompleted += OnWorkflowCompleted;
workflowRuntime.WorkflowIdled += OnWorkflowIdle;
workflowRuntime.WorkflowUnloaded += OnWorkflowUnload;
workflowRuntime.WorkflowLoaded += OnWorkflowLoad;
workflowRuntime.WorkflowTerminated += OnWorkflowTerminated;
workflowRuntime.ServicesExceptionNotHandled += OnExceptionNotHandled;
workflowRuntime.CreateWorkflow(typeof(PersistenceServiceWorkflow)).Start();
waitHandle.WaitOne();
}
catch (Exception e)
{
Console.WriteLine("Exception \n\t Source: {0} \n\t Message: {1}", e.Source, e.Message);
}
finally
{
workflowRuntime.StopRuntime();
Console.WriteLine("Workflow runtime stopped, program exiting... \n");
}
}
}
开发者ID:ssickles,项目名称:archive,代码行数:32,代码来源:Program.cs
示例8: Main
static void Main()
{
using (WorkflowRuntime workflowRuntime = new WorkflowRuntime())
{
// Create our local service and add it to the workflow runtime's list of services
ExternalDataExchangeService dataService = new ExternalDataExchangeService();
workflowRuntime.AddService(dataService);
VotingServiceImpl votingService = new VotingServiceImpl();
dataService.AddService(votingService);
// Start up the runtime and hook the creation and completion events
workflowRuntime.StartRuntime();
workflowRuntime.WorkflowCompleted += OnWorkflowCompleted;
workflowRuntime.WorkflowTerminated += OnWorkflowTerminated;
workflowRuntime.WorkflowStarted += OnWorkflowStarted;
// Create the workflow's parameters collection
Dictionary<string, object> parameters = new Dictionary<string, object>();
parameters.Add("Alias", "Jim");
// Create and start the workflow
Type type = typeof(HostCommunication.VotingServiceWorkflow);
workflowRuntime.CreateWorkflow(type, parameters).Start();
waitHandle.WaitOne();
// Cleanly stop the runtime and all services
workflowRuntime.StopRuntime();
}
}
开发者ID:ssickles,项目名称:archive,代码行数:31,代码来源:Program.cs
示例9: Main
static void Main()
{
orderService = new OrderServiceImpl();
// Start the workflow runtime engine.
using (WorkflowRuntime workflowRuntime = new WorkflowRuntime())
{
ExternalDataExchangeService dataService = new ExternalDataExchangeService();
workflowRuntime.AddService(dataService);
dataService.AddService(orderService);
workflowRuntime.StartRuntime();
// Listen for the workflow events
workflowRuntime.WorkflowCompleted += OnWorkflowCompleted;
workflowRuntime.WorkflowTerminated += OnWorkflowTerminated;
workflowRuntime.WorkflowIdled += OnWorkflowIdled;
// Start the workflow and wait for it to complete
Type type = typeof(PurchaseOrderWorkflow);
workflowRuntime.CreateWorkflow(type).Start();
waitHandle.WaitOne();
// Stop the workflow runtime engine.
workflowRuntime.StopRuntime();
}
}
开发者ID:spzenk,项目名称:sfdocsamples,代码行数:28,代码来源:Program.cs
示例10: Main
static void Main(string[] args)
{
using(WorkflowRuntime workflowRuntime = new WorkflowRuntime())
{
AutoResetEvent waitHandle = new AutoResetEvent(false);
workflowRuntime.WorkflowCompleted += delegate(object sender, WorkflowCompletedEventArgs e)
{
Console.WriteLine("Workflow completed.");
waitHandle.Set();
};
workflowRuntime.WorkflowTerminated += delegate(object sender, WorkflowTerminatedEventArgs e)
{
Console.WriteLine(e.Exception.Message);
waitHandle.Set();
};
WorkflowInstance instance = workflowRuntime.CreateWorkflow(typeof(StateInitialization.SampleWorkflow));
Console.WriteLine("Starting workflow.");
instance.Start();
waitHandle.WaitOne();
workflowRuntime.StopRuntime();
}
}
开发者ID:spzenk,项目名称:sfdocsamples,代码行数:25,代码来源:Program.cs
示例11: Main
static void Main()
{
using (WorkflowRuntime workflowRuntime = new WorkflowRuntime())
{
try
{
// Start the engine
workflowRuntime.StartRuntime();
// Subscribe to events
workflowRuntime.WorkflowCompleted += OnWorkflowCompleted;
workflowRuntime.WorkflowTerminated += OnWorkflowTerminated;
workflowRuntime.WorkflowIdled += OnWorkflowIdled;
workflowRuntime.ServicesExceptionNotHandled += OnServicesExceptionNotHandled;
// Start PO approval workflow with purchase less than $1000
System.Int32 poAmount = 750;
Type workflowType = typeof(Microsoft.Samples.Workflow.DynamicUpdateFromHost.DynamicUpdateWorkflow);
Dictionary<string, object> inputParameters = new Dictionary<string, object>();
inputParameters.Add("Amount", poAmount);
workflowRuntime.CreateWorkflow(workflowType, inputParameters).Start();
waitHandle.WaitOne();
}
catch (Exception e)
{
Console.WriteLine("Exception \n\t Source: {0} \n\t Message: {1}", e.Source, e.Message);
}
finally
{
workflowRuntime.StopRuntime();
Console.WriteLine("Workflow runtime stopped, program exiting... \n");
}
}
}
开发者ID:ssickles,项目名称:archive,代码行数:35,代码来源:Program.cs
示例12: Main
static void Main()
{
using (WorkflowRuntime workflowRuntime = new WorkflowRuntime())
{
try
{
// A workflow is always run asychronously; the main thread waits on this event so the program
// doesn't exit before the workflow completes
workflowRuntime.AddService(new SqlWorkflowPersistenceService("Initial Catalog=SqlPersistenceService;Data Source=localhost;Integrated Security=SSPI;"));
// Listen for the workflow events
workflowRuntime.WorkflowCompleted += OnWorkflowCompleted;
workflowRuntime.WorkflowTerminated += OnWorkflowTerminated;
workflowRuntime.WorkflowAborted += OnWorkflowAborted;
// Create an instance of the workflow
Type type = typeof(NestedExceptionsWorkflow);
workflowRuntime.CreateWorkflow(type).Start();
Console.WriteLine("Workflow Started.\n");
// Wait for the event to be signaled
waitHandle.WaitOne();
}
catch (Exception ex)
{
Console.WriteLine("Source: {0}\nMessage: {1}", ex.Source, ex.Message);
}
finally
{
workflowRuntime.StopRuntime();
Console.WriteLine("\nWorkflow Complete.");
}
}
}
开发者ID:spzenk,项目名称:sfdocsamples,代码行数:34,代码来源:Program.cs
示例13: Main
static void Main()
{
try
{
waitHandle = new AutoResetEvent(false);
CreateAndInsertTrackingProfile();
using (WorkflowRuntime runtime = new WorkflowRuntime())
{
SqlTrackingService trackingService = new SqlTrackingService(connectionString);
runtime.AddService(trackingService);
runtime.StartRuntime();
runtime.WorkflowCompleted += OnWorkflowCompleted;
runtime.WorkflowTerminated += OnWorkflowTerminated;
runtime.WorkflowAborted += OnWorkflowAborted;
WorkflowInstance instance = runtime.CreateWorkflow(typeof(BankMachineWorkflow));
instance.Start();
waitHandle.WaitOne();
runtime.StopRuntime();
OutputTrackedData(instance.InstanceId);
}
}
catch (Exception ex)
{
if (ex.InnerException != null)
Console.WriteLine(ex.InnerException.Message);
else
Console.WriteLine(ex.Message);
}
}
开发者ID:spzenk,项目名称:sfdocsamples,代码行数:32,代码来源:Program.cs
示例14: Pipeline_CC_Workflow_Should_Send_Acknowledgment_Email_To_Customer
public void Pipeline_CC_Workflow_Should_Send_Acknowledgment_Email_To_Customer() {
Order order = GetTestOrder();
using (WorkflowRuntime workflowRuntime = new WorkflowRuntime()) {
AutoResetEvent waitHandle = new AutoResetEvent(false);
workflowRuntime.WorkflowCompleted += delegate(object sender, WorkflowCompletedEventArgs e) { waitHandle.Set(); };
workflowRuntime.WorkflowTerminated += delegate(object sender, WorkflowTerminatedEventArgs e) {
Debug.WriteLine(e.Exception.Message);
waitHandle.Set();
};
WorkflowInstance instance = workflowRuntime.CreateWorkflow(
typeof(Commerce.Pipelines.SubmitOrderWorkflow), GetParams(order));
instance.Start();
waitHandle.WaitOne();
//execution should be finished
//check the mailers
TestMailerService mailer = _mailerService as TestMailerService;
Assert.IsTrue(mailer.SentMail.Count > 0);
//the first email should be to the customer
Assert.AreEqual(MailerType.CustomerOrderReceived, mailer.SentMail[0].MailType);
}
}
开发者ID:christattum,项目名称:MVC-Storefront,代码行数:29,代码来源:PipelineTests.cs
示例15: Main
static void Main()
{
// Create the WorkflowRuntime
using (WorkflowRuntime workflowRuntime = new WorkflowRuntime())
{
// Set up the WorkflowRuntime events so that the host gets notified when the workflow
// completes and terminates
workflowRuntime.WorkflowCompleted += new EventHandler<WorkflowCompletedEventArgs>(OnWorkflowCompleted);
workflowRuntime.WorkflowTerminated += new EventHandler<WorkflowTerminatedEventArgs>(OnWorkflowTerminated);
// Load the workflow type
Type type = typeof(ThrowWorkflow);
//Start the workflow and wait for it to complete
workflowRuntime.CreateWorkflow(type).Start();
Console.WriteLine("Workflow Started.");
waitHandle.WaitOne();
Console.WriteLine("Workflow Completed.");
workflowRuntime.StopRuntime();
}
}
开发者ID:ssickles,项目名称:archive,代码行数:25,代码来源:Program.cs
示例16: Main
static void Main()
{
// Start the engine.
using (WorkflowRuntime workflowRuntime = new WorkflowRuntime())
{
workflowRuntime.StartRuntime();
// Load the workflow type.
Type type = typeof(IfElseWorkflow);
workflowRuntime.WorkflowCompleted += OnWorkflowCompleted;
workflowRuntime.WorkflowTerminated += OnWorkflowTerminated;
// The "OrderValueParameter" parameter is used to determine which branch of the IfElse should be executed
// a value less than 10,000 will execute branch 1 - Get Manager Approval; any other value will execute branch 2 - Get VP Approval
Dictionary<string, object> parameters = new Dictionary<string, object>();
parameters.Add("OrderValue", 14000);
WorkflowInstance workflow = workflowRuntime.CreateWorkflow(type, parameters);
workflow.Start();
waitHandle.WaitOne();
workflowRuntime.StopRuntime();
}
}
开发者ID:ssickles,项目名称:archive,代码行数:25,代码来源:Program.cs
示例17: Main
static void Main()
{
// Create WorkflowRuntime
using (WorkflowRuntime workflowRuntime = new WorkflowRuntime())
{
// Add ConsoleTrackingService
workflowRuntime.AddService(new ConsoleTrackingService());
// Subscribe to Workflow Completed WorkflowRuntime Event
workflowRuntime.WorkflowCompleted += OnWorkflowCompleted;
// Subscribe to Workflow Terminated WorkflowRuntime Event
workflowRuntime.WorkflowTerminated += OnWorkflowTerminated;
// Start WorkflowRuntime
workflowRuntime.StartRuntime();
// Execute the SampleWorkflow Workflow
Console.WriteLine("Executing the workflow...");
workflowRuntime.CreateWorkflow(typeof(SimplePolicyWorkflow)).Start();
// Wait for the Workflow Completion
waitHandle.WaitOne();
// Stop Runtime
workflowRuntime.StopRuntime();
}
}
开发者ID:spzenk,项目名称:sfdocsamples,代码行数:28,代码来源:Program.cs
示例18: Main
static void Main(string[] args)
{
using (WorkflowRuntime workflowRuntime = new WorkflowRuntime())
{
// Add ChannelManager
ChannelManagerService channelmgr = new ChannelManagerService();
workflowRuntime.AddService(channelmgr);
AutoResetEvent waitHandle = new AutoResetEvent(false);
workflowRuntime.WorkflowCompleted += delegate(object sender, WorkflowCompletedEventArgs e) { Console.WriteLine("WorkflowCompleted: " + e.WorkflowInstance.InstanceId.ToString()); waitHandle.Set(); };
workflowRuntime.WorkflowTerminated += delegate(object sender, WorkflowTerminatedEventArgs e) { Console.WriteLine("WorkflowTerminated: " + e.Exception.Message); waitHandle.Set(); };
while (true)
{
WorkflowInstance instance = workflowRuntime.CreateWorkflow(typeof(Microsoft.WorkflowServices.Samples.SequentialCalculatorClient));
Console.WriteLine("Start SequentialCalculatorClient.");
instance.Start();
waitHandle.WaitOne();
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("Do another calculation? (Y)");
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("Press <enter> to exit.");
Console.ResetColor();
string input = Console.ReadLine();
if (input.Length == 0 || input[0] != 'Y')
break;
waitHandle.Reset();
}
}
}
开发者ID:spzenk,项目名称:sfdocsamples,代码行数:30,代码来源:Program.cs
示例19: Mainform
public Mainform()
{
InitializeComponent();
this.runtime = new WorkflowRuntime();
runtime.WorkflowCompleted += new EventHandler<WorkflowCompletedEventArgs>(runtime_WorkflowCompleted);
// Set up runtime to unload workflow instance from memory to file using FilePersistenceService
FilePersistenceService filePersistence = new FilePersistenceService(true);
runtime.AddService(filePersistence);
// Add document approval service
ExternalDataExchangeService dataService = new ExternalDataExchangeService();
runtime.AddService(dataService);
documentService = new DocumentApprovalService(this);
dataService.AddService(documentService);
// Search for workflows that have previously been persisted to file, and load into the listview control.
// These workflows will be reloaded by the runtime when events are raised against them.
LoadWorkflowData();
// Start the runtime
runtime.StartRuntime();
}
开发者ID:spzenk,项目名称:sfdocsamples,代码行数:25,代码来源:Mainform.cs
示例20: CreateWorkFlowRuntime
/// <summary>
/// 创建工作流运行时
/// </summary>
/// <param name="IsPer">是否使用持久化</param>
/// <returns></returns>
public static WorkflowRuntime CreateWorkFlowRuntime(bool IsPer)
{
try
{
WorkflowRuntime WfRuntime = new WorkflowRuntime();
if (IsPer)
{
ConnectionStringSettings defaultConnectionString = ConfigurationManager.ConnectionStrings["OracleConnection"];
WfRuntime.AddService(new AdoPersistenceService(defaultConnectionString, true, TimeSpan.FromSeconds(0), TimeSpan.FromSeconds(0)));
WfRuntime.AddService(new AdoTrackingService(defaultConnectionString));
WfRuntime.AddService(new AdoWorkBatchService());
}
FlowEvent ExternalEvent = new FlowEvent();
ExternalDataExchangeService objService = new ExternalDataExchangeService();
WfRuntime.AddService(objService);
objService.AddService(ExternalEvent);
ManualWorkflowSchedulerService scheduleService = new ManualWorkflowSchedulerService();
WfRuntime.AddService(scheduleService);
TypeProvider typeProvider = new TypeProvider(null);
WfRuntime.AddService(typeProvider);
WfRuntime.StartRuntime();
return WfRuntime;
}
catch (Exception ex)
{
LogHelper.WriteLog("CreateWorkFlowRuntime异常信息 :" + ex.ToString());
throw new Exception(ex.Message);
}
}
开发者ID:JuRogn,项目名称:OA,代码行数:39,代码来源:SMTWorkFlowManage.cs
注:本文中的WorkflowRuntime类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论