private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // Open the config file and get the connection string
            Configuration config =
                ConfigurationManager.OpenExeConfiguration
                    (ConfigurationUserLevel.None);
            ConnectionStringsSection css =
                (ConnectionStringsSection)config.GetSection("connectionStrings");
            _connectionString =
                css.ConnectionStrings["LeadResponse"].ConnectionString;

            _instanceStore = new SqlWorkflowInstanceStore(_connectionString);
            InstanceView view = _instanceStore.Execute
                (_instanceStore.CreateInstanceHandle(),
                new CreateWorkflowOwnerCommand(),
                TimeSpan.FromSeconds(30));
            _instanceStore.DefaultInstanceOwner = view.InstanceOwner;

            // Create the DBExtension
            _dbExtension = new DBExtension(_connectionString);

            // Create a service to handle incoming requests
            LoadExistingLeads();
            SetupHost();

            
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // Open the config file and get the connection string


            Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            ConnectionStringsSection css = (ConnectionStringsSection)config.GetSection("connectionStrings");
            _connectionString = css.ConnectionStrings["LeadGenerator"].ConnectionString;

            _dbExtension = new DBExtension(_connectionString);
            _instanceStore = new SqlWorkflowInstanceStore(_connectionString);
            InstanceView view = _instanceStore.Execute(_instanceStore.CreateInstanceHandle(), new CreateWorkflowOwnerCommand(), TimeSpan.FromSeconds(30));
            _instanceStore.DefaultInstanceOwner = view.InstanceOwner;

            
            // Set up the tracking participants
            CreateTrackingParticipant();
            CreateETWTrackingParticipant();
            CreateSqlTrackingParticipant();

            LoadExistingLeads();



        }
Ejemplo n.º 3
0
        // Configure a Default Owner for the instance store so instances can be re-loaded from WorkflowApplication
        private static InstanceHandle CreateInstanceStoreOwner(InstanceStore store, XName wfHostTypeName)
        {
            InstanceHandle ownerHandle = store.CreateInstanceHandle();

            CreateWorkflowOwnerCommand ownerCommand = new CreateWorkflowOwnerCommand()
            {
                InstanceOwnerMetadata =
                {
                    { WorkflowHostTypePropertyName, new InstanceValue(wfHostTypeName) }
                }
            };

            store.DefaultInstanceOwner = store.Execute(ownerHandle, ownerCommand, TimeSpan.FromSeconds(30)).InstanceOwner;

            return ownerHandle;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 创建工作流
        /// </summary>
        /// <param name="parameters">传入的参数</param>
        /// <returns>获取工作流实例的Id值</returns>
        public string Create(IDictionary<string, object> parameters)
        {
            _instanceStore = new SqlWorkflowInstanceStore(connectionString);
            InstanceView view = _instanceStore.Execute
                (_instanceStore.CreateInstanceHandle(),
                new CreateWorkflowOwnerCommand(),
                TimeSpan.FromSeconds(30));
            _instanceStore.DefaultInstanceOwner = view.InstanceOwner;

            WorkflowApplication i = new WorkflowApplication(ActivityXamlServices.Load(path), parameters);
            i.InstanceStore = _instanceStore;
            i.PersistableIdle = (waiea) => PersistableIdleAction.Unload;
            i.Run();
            return i.Id.ToString();

        }
Ejemplo n.º 5
0
        /// <summary>
        /// 加载工作流
        /// </summary>
        /// <param name="id">工作流的唯一标示</param>
        /// <param name="bookMark">标签名称</param>
        /// <param name="ids">恢复指定名称的书签的时候,传入的参数</param>
        /// <returns>工作流的加载的状态</returns>
        public string Load(string id, object inputs = null)
        {
            _instanceStore = new SqlWorkflowInstanceStore(connectionString);
            InstanceView view = _instanceStore.Execute
                (_instanceStore.CreateInstanceHandle(),
                new CreateWorkflowOwnerCommand(),
                TimeSpan.FromSeconds(30));
            _instanceStore.DefaultInstanceOwner = view.InstanceOwner;

            WorkflowApplication i = new WorkflowApplication(ActivityXamlServices.Load(path));
            i.InstanceStore = _instanceStore;
            i.PersistableIdle = (waiea) => PersistableIdleAction.Unload;
            i.Load(new Guid(id));
            return i.ResumeBookmark(bookMark, inputs).GetString();

        }
Ejemplo n.º 6
0
        private static void SetupInstanceStore()
        {
            instanceStore =
                new SqlWorkflowInstanceStore(@"Data Source=.\SQLEXPRESS;Initial Catalog=SampleInstanceStore;Integrated Security=True;Asynchronous Processing=True");

            InstanceHandle handle = instanceStore.CreateInstanceHandle();
            InstanceView view = instanceStore.Execute(handle, new CreateWorkflowOwnerCommand(), TimeSpan.FromSeconds(30));
            handle.Free();

            instanceStore.DefaultInstanceOwner = view.InstanceOwner;
        }