static void Main(string[] arguments) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); WorkflowDemoEFWindowsFormsApplication xafApplication = new WorkflowDemoEFWindowsFormsApplication(); #if DEBUG DevExpress.ExpressApp.Win.EasyTest.EasyTestRemotingRegistration.Register(); #endif ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["ConnectionString"]; if (connectionStringSettings != null) { xafApplication.ConnectionString = connectionStringSettings.ConnectionString; } else if (string.IsNullOrEmpty(xafApplication.ConnectionString) && xafApplication.Connection == null) { connectionStringSettings = ConfigurationManager.ConnectionStrings["SqlExpressConnectionString"]; if (connectionStringSettings != null) { xafApplication.ConnectionString = DbEngineDetector.PatchConnectionString(connectionStringSettings.ConnectionString); } } xafApplication.Modules.FindModule <WorkflowWindowsFormsModule>().QueryAvailableActivities += delegate(object sender, ActivitiesInformationEventArgs e) { e.ActivitiesInformation.Add(new ActivityInformation(typeof(CreateTask), "Code Activities", "Create Task", ImageLoader.Instance.GetImageInfo("CreateTask").Image)); }; WorkflowServerStarter starter = null; xafApplication.LoggedOn += delegate(object sender, LogonEventArgs e) { if (starter == null) { starter = new WorkflowServerStarter(); starter.OnCustomHandleException += delegate(object sender1, ExceptionEventArgs args1) { MessageBox.Show(args1.Message); }; starter.Start(xafApplication.ConnectionString, xafApplication.ApplicationName); } }; try { xafApplication.Setup(); xafApplication.Start(); } catch (Exception e) { xafApplication.HandleException(e); } if (starter != null) { starter.Stop(); } }
public void Start(string connectionString, string applicationName) { try { domain = AppDomain.CreateDomain("ServerDomain"); starter = (WorkflowServerStarter)domain.CreateInstanceAndUnwrap( System.Reflection.Assembly.GetEntryAssembly().FullName, typeof(WorkflowServerStarter).FullName); starter.OnCustomHandleException_ += new EventHandler <ExceptionEventArgs>(starter_OnCustomHandleException_); starter.Start_(connectionString, applicationName); } catch (Exception e) { Tracing.Tracer.LogError(e); if (OnCustomHandleException != null) { OnCustomHandleException(null, new ExceptionEventArgs("Exception occurs:\r\n\r\n" + e.Message)); } } }