Exemple #1
0
        private static WorkflowApplication GetApp()
        {
            // Create a new workflow
            Activity workflow1 = new Workflow1();

            // Create a new host
            WorkflowApplication app = new WorkflowApplication(workflow1);

            SqlWorkflowInstanceStore store =
                new SqlWorkflowInstanceStore(ConfigurationManager.ConnectionStrings["Demos"].ConnectionString);

            // Delete all when workflow instance is terminated
            // store.InstanceCompletionAction = InstanceCompletionAction.DeleteAll;

            // Pomote extensions properties (InstancePromotedPropertiesTable)
            store.Promote("MyExtension", MyExtension.GetValuesToPromote(), null);

            app.InstanceStore = store;

            // Add extension
            MyExtension extension = new MyExtension();

            app.Extensions.Add(extension);
            app.PersistableIdle = PersistableIdle;
            app.Unloaded        = Unloaded;
            return(app);
        }
        static void Main(string[] args)
        {
            // Create and cache the workflow definition
            Activity workflow1 = new Workflow1();

            WorkflowInvoker.Invoke(workflow1);
        }
Exemple #3
0
        static void Main(string[] args)
        {
            Activity workflow1 = new Workflow1();
            IDictionary <string, object> output = WorkflowInvoker.Invoke(workflow1);

            Console.WriteLine(output["OutMessage"]);
        }
Exemple #4
0
        static void Main(string[] args)
        {
            Beep();
            Activity workflow1 = new Workflow1();

            WorkflowInvoker.Invoke(workflow1);
        }
        static void Main(string[] args)
        {
            Activity workflow1 = new Workflow1();

            WorkflowInvoker.Invoke(workflow1);
            Console.Read();
        }
        static void Main(string[] args)
        {
            Activity        workflow1 = new Workflow1();
            WorkflowInvoker host      = new WorkflowInvoker(workflow1);

            host.Extensions.Add(new TraceTracking());
            host.Invoke();
        }
Exemple #7
0
        protected override void OnStart(string[] args)
        {
            Activity workflow1 = new Workflow1();
            //WorkflowInvoker.Invoke(workflow1);
            WorkflowApplication wfApp = new WorkflowApplication(workflow1);

            wfApp.Run();
        }
Exemple #8
0
        static void Main(string[] args)
        {
            Activity workflow1 = new Workflow1();
            WorkflowInvoker.Invoke(workflow1);

            Console.WriteLine("Press ENTER to exit");
            Console.ReadLine();
        }
Exemple #9
0
        static void Main(string[] args)
        {
            Activity workflow1 = new Workflow1();
            var      invoker   = new WorkflowInvoker(workflow1);

            invoker.Extensions.Add(new StartsWithFilter("s"));
            invoker.Invoke();
        }
Exemple #10
0
        static void Main(string[] args)
        {
            Activity workflow1 = new Workflow1();
            Dictionary <string, object> wfArgs = new Dictionary <string, object>();

            wfArgs.Add("MessageToShow", "WorkFlow Arg");
            WorkflowInvoker.Invoke(workflow1, wfArgs);
            Console.WriteLine("The End");
        }
Exemple #11
0
 static void Main(string[] args)
 {
     // Create and cache the workflow definition
     Activity workflow1 = new Workflow1();
     Dictionary<string, object> parms = new Dictionary<string, object>();
     parms.Add("Name", "Morgan");
     WorkflowInvoker.Invoke(workflow1, parms);
     Console.ReadLine();
 }
Exemple #12
0
        static void Main(string[] args)
        {
            Console.BackgroundColor = ConsoleColor.DarkGreen;
            Console.ForegroundColor = ConsoleColor.White;


            Activity workflow1 = new Workflow1();

            WorkflowInvoker.Invoke(workflow1);
        }
Exemple #13
0
        static void Main(string[] args)
        {
            IDictionary <string, object> input = new Dictionary <string, object>
            {
                { "InOutMessage", "Now, I am InMessage" }
            };
            Activity workflow1 = new Workflow1();
            var      output    = WorkflowInvoker.Invoke(workflow1, input);

            Console.WriteLine(output["InOutMessage"]);
        }
Exemple #14
0
    static void Main(string[] args)
    {
        // Create and cache the workflow definition
        Activity workflow1 = new Workflow1();
        var      names     = new[] { "Bob", "Jan", "Ron", "Rick" };
        var      arguments = new Dictionary <string, object>()
        {
            { "Names", names }
        };

        WorkflowInvoker.Invoke(workflow1, arguments);
    }
        static void Main(string[] args) {
            Dictionary<string, object> wfArgs = new Dictionary<string, object>();
            wfArgs.Add("MessageToShow", "Hello");

            Activity workflow1 = new Workflow1();
           
            //RunWithWorkflowInvoker(workflow1, wfArgs);
            RunWithWorkflowApplication(workflow1, wfArgs);
            
            
            Console.ReadLine();
        }
Exemple #16
0
        static void Main(string[] args)
        {
            Activity workflow1 = new Workflow1();

            WorkflowInvoker.Invoke(workflow1);

            ExchageRates er = new ExchageRates();

            er.StartDownloadTimer(DateTime.Now);
            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();
            //decimal rate = er.GetRate(826, DateTime.Now.Date);
        }
Exemple #17
0
        static void Main(string[] args)
        {
            // Create and cache the workflow definition
            Dictionary<string, object> parms = new Dictionary<string, object>();
            parms.Add("Person", "Morgan");
            Activity workflow1 = new Workflow1();

            foreach (KeyValuePair<string, object> kvp in
                WorkflowInvoker.Invoke(workflow1, parms))
            {
                Console.WriteLine("{0} = {1}", kvp.Key, kvp.Value);
            }
        }
Exemple #18
0
 static void Main(string[] args)
 {
     try
     {
         var wf = new Workflow1();
         WorkflowInvoker.Invoke(wf);
         Console.WriteLine("Done.");
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
     }
     Console.ReadKey();
 }
        static void Main(string[] args) {
            
            Dictionary<string, object> wfArgs = new Dictionary<string, object>();
            wfArgs.Add("UserName", "Bob");
            try {
                Activity workflow1 = new Workflow1();
                WorkflowInvoker.Invoke(workflow1, wfArgs);
            } catch (Exception ex) {
                Console.WriteLine(ex.Message);
                Console.WriteLine(ex.Data["Reason"]);
            }

            Console.ReadLine();
        }
Exemple #20
0
        static void Main(string[] args)
        {
            options = new Options();

            if (ParseArgs(args))
            {
                var inArguments = new Dictionary <string, object>();
                inArguments.Add("Options", options);

                Workflow1 workflow = new Workflow1();
                WorkflowInvoker.Invoke(workflow, inArguments);
            }
            Console.WriteLine("Press Enter to exit");
            Console.ReadLine();
        }
Exemple #21
0
        static void Main(string[] args)
        {
            var workflow = new Workflow1();

            // Creat an host
            WorkflowInvoker invoker = new WorkflowInvoker(workflow);

            // Add extension
            invoker.Extensions.Add(new MyExtension());

            //Invoke
            invoker.Invoke();

            Console.Read();
        }
Exemple #22
0
 static void Main(string[] args)
 {
     try
     {
         Dictionary <string, object> wfArgs = new Dictionary <string, object>();
         wfArgs.Add("UserName", "Mel");
         Activity workflow1 = new Workflow1();
         WorkflowInvoker.Invoke(workflow1, wfArgs);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         Console.WriteLine(ex.Data["Reason"]);
     }
 }
Exemple #23
0
        private static Activity GetWorkflow(string workflowId)
        {
            Activity workflow = null;

            switch (workflowId)
            {
            case "Workflow1":
                workflow = new Workflow1();
                break;

            case "Workflow2":
                workflow = new Workflow2();
                break;
            }
            return(workflow);
        }
        public void Run()
        {
            try
            {
                var workflow1 = new Workflow1();

                var workflowApplication = new WorkflowApplication(workflow1);
                workflowApplication.InstanceStore = this.instanceStoreSetupper.InstanceStore;

                // configure here the workflowapplication
                workflowApplication.Run();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Exemple #25
0
        static void Main(string[] args)
        {
            Document document;
            var      idsMap = new Dictionary <Guid, string>();
            var      connectionString = @"Server=.\SQLEXPRESS;Initial Catalog=PersistenceDatabase;Integrated Security=True";;
            var      instanceStore = new SqlWorkflowInstanceStore(connectionString); var waitHandler = new AutoResetEvent(initialState: false);
            var      rootAcitivty = new Workflow1();
            var      wfapp        = new WorkflowApplication(rootAcitivty);

            wfapp.InstanceStore = instanceStore;
            wfapp.Unloaded      = (workflowApplicationEventArgs) =>
            {
                Console.WriteLine("WorkflowApplication has Unloaded\n");
                waitHandler.Set();
            };
            wfapp.PersistableIdle = (e) => { return(PersistableIdleAction.Unload); };
            idsMap.Add(wfapp.Id, "OrderNameBookmark");

            wfapp.Run();
            Console.WriteLine($"Host thread: {Thread.CurrentThread.ManagedThreadId}");
            waitHandler.WaitOne();

            var name = Console.ReadLine();

            rootAcitivty        = new Workflow1();
            wfapp               = new WorkflowApplication(rootAcitivty);
            wfapp.InstanceStore = instanceStore;

            wfapp.Completed = (workflowApplicationCompletedEventArgs) =>
            {
                document = (Document)workflowApplicationCompletedEventArgs.Outputs["DocumentOut"];
                Console.WriteLine($"\n WorkflowApplication has Completed in the {workflowApplicationCompletedEventArgs.CompletionState}");
            };
            wfapp.Unloaded = (workflowApplicationEventArgs) =>
            {
                Console.WriteLine("WorkflowApplication has Unloaded\n");
                waitHandler.Set();
            };
            wfapp.Load(idsMap.First().Key);
            wfapp.ResumeBookmark("OrderNameBookmark", name);
            Console.WriteLine($"Host thread: { Thread.CurrentThread.ManagedThreadId }");
            //var nameFromActivity = rootAcitivty.outArgument;

            waitHandler.WaitOne();
        }
Exemple #26
0
        // Rename to Main and comment Main() below to use WorkflowInvoker.
        static void OLD_Main(string[] args)
        {
            Console.WriteLine("***** Welcome to this amazing WF application *****");

            // Get data from user, to pass to workflow.
            Console.Write("Please enter the data to pass the workflow: ");
            string wfData = Console.ReadLine();

            // Package up the data as a dictionary.
            Dictionary<string, object> wfArgs = new Dictionary<string, object>();
            wfArgs.Add("MessageToShow", wfData);

            // Pass to the workflow.
            Activity workflow1 = new Workflow1();
            WorkflowInvoker.Invoke(workflow1, wfArgs);

            Console.WriteLine("Thanks for playing");
        }
Exemple #27
0
        // Rename to Main and comment Main() below to use WorkflowInvoker.
        static void OLD_Main(string[] args)
        {
            Console.WriteLine("***** Welcome to this amazing WF application *****");

            // Get data from user, to pass to workflow.
            Console.Write("Please enter the data to pass the workflow: ");
            string wfData = Console.ReadLine();

            // Package up the data as a dictionary.
            Dictionary <string, object> wfArgs = new Dictionary <string, object>();

            wfArgs.Add("MessageToShow", wfData);

            // Pass to the workflow.
            Activity workflow1 = new Workflow1();

            WorkflowInvoker.Invoke(workflow1, wfArgs);

            Console.WriteLine("Thanks for playing");
        }
Exemple #28
0
        static void CallInRule()
        {
            Console.WriteLine("Start Workflow Execution");

            Console.Write("Enter your name: ");

            var name = Console.ReadLine();

            //Create collection of arguments to be passed into the workflow.
            //Arguments are defined in the workflow xaml.
            var wfArgs = new Dictionary <string, object>();

            //Option 1: pass in this xml as an argument
            //var xml = @"<Person><FirstName>Mike</FirstName></Person>";

            //Option 2: Create and instance of an object and serialize it to an xml string
            //var person = new Person { FirstName = "Mike" };
            //var xml = SerializeToString(person);

            //Option 3: Create and instance of an object and pass it in as an argument.
            //The argument (as defined in the workflow designer) will need to be updated
            //to reflect the object type being passed in.
            var person = new Model.Person {
                FirstName = name.Trim()
            };

            wfArgs["varStateXml"] = person;

            Workflow1 workflow = new Workflow1();

            var result = WorkflowInvoker.Invoke(workflow, wfArgs);

            Console.WriteLine(person.Salutation);

            var ruleExecutionLog = result["varRuleExecutionLog"] as RuleExecutionLog;

            Console.WriteLine("Workflow Execution Complete");

            Console.ReadLine();
        }
Exemple #29
0
 static void Main(string[] args)
 {
     // Create and cache the workflow definition
     Activity workflow1 = new Workflow1();
     WorkflowInvoker.Invoke(workflow1);
 }
Exemple #30
0
        private static void Main()
        {
            Activity workflow1 = new Workflow1();

            WorkflowInvoker.Invoke(workflow1);
        }
        public void Run(AutoResetEvent syncEvent, AutoResetEvent idleEvent)
        {
            try
            {
                // var act = new ProcessActivity();
                // var result = WorkflowInvoker.Invoke(act);
                var workflow1 = new Workflow1(); // new Workflow1();

                var workflowApplication = new WorkflowApplication(workflow1);
                workflowApplication.InstanceStore = this.instanceStoreSetupper.InstanceStore;

                var trackingProfile =
                    new TrackingProfile()
                {
                    Name = "SampleTrackingProfile",
                    ActivityDefinitionId     = "*", // "ProcessOrder",
                    ImplementationVisibility = ImplementationVisibility.All,
                    Queries =
                    {
                        new WorkflowInstanceQuery()
                        {
                            States ={ "*"              }
                        },
                        new ActivityStateQuery()
                        {
                            Variables    = { "*" },
                            Arguments    = { "*" },
                            ActivityName = "*",
                            States       = { "*" }
                        },
                        new ActivityScheduledQuery()
                        {
                            ActivityName      = "*",
                            ChildActivityName = "*"
                        },
                        new FaultPropagationQuery(),
                        new CancelRequestedQuery(),
                        new CustomTrackingQuery(),
                        new BookmarkResumptionQuery()
                        {
                            Name = "*"
                        },
                    }
                };

                var trackingParticipant =
                    new TraceTrackingParticipant()
                {
                    TrackingProfile = trackingProfile
                };

                workflowApplication.Extensions.Add(trackingParticipant);

                // workflowApplication.RunEpisode();
                // configure here the workflowapplication
                workflowApplication.Run();

                workflowApplication.Completed = wac =>
                {
                    syncEvent.Set();
                    // var stdOutput = wac.Outputs["MyStandardOutput"];

                    // Console.WriteLine(stdOutput);
                };

                workflowApplication.Aborted = abortedEventArgs =>
                {
                    Console.WriteLine(abortedEventArgs.Reason);
                    syncEvent.Set();
                };

                //wfApp.PersistableIdle wfApp.Unloaded

                workflowApplication.OnUnhandledException = unhandledExceptionEventArgs =>
                {
                    Console.WriteLine(unhandledExceptionEventArgs.UnhandledException.ToString());
                    return(UnhandledExceptionAction.Terminate);
                };

                workflowApplication.Idle = (WorkflowApplicationIdleEventArgs e) =>
                {
                    idleEvent.Set();
                };

                //Thread.Sleep(1000); // give time for events to record to the screen
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Exemple #32
0
        static void Main(string[] args)
        {
            var workflow1 = new Workflow1();

            WorkflowInvoker.Invoke(workflow1);
        }
Exemple #33
0
 static void Main(string[] args)
 {
     Activity workflow1 = new Workflow1();
     WorkflowInvoker.Invoke(workflow1);
 }
Exemple #34
0
        static void Main(string[] args)
        {
            Activity workflow1 = new Workflow1();

            WorkflowInvoker.Invoke(InvokeMethodActivity.CreateInvokeMethodWf());
        }