private void OnExecuterRunningStateChanged(object sender, WorkflowExecutingStateEventArgs e)
        {
            IsExecuting = e.IsExecuting;

            if (e.IsExecuting)
            {
                DebugSteps.Clear();
            }
        }
        public void Debug()
        {
            if (IsExecuting || !Save(true))
            {
                return;
            }

            // HACK ZONE

            // WorkflowDesigner have to be loaded all over again through WorkflowDesigner.Load(filepath) otherwise
            // SourceLocationProvider.CollectMapping() won't collect nothing later on WorkflowDebugger and
            // becaquse of that debug process won't work as expected.

            // Activities not loaded with WorkflowDesigner.Load(filepath) won't be recognized at all.

            // That's the only motive for the workflow to be saved before debug.

            // More info: http://social.msdn.microsoft.com/forums/en-us/wfprerelease/thread/2DEE4DD9-D3F7-4430-BCC7-D613859074D1
            //            http://social.msdn.microsoft.com/Forums/en/wfprerelease/thread/0a28cade-bd8d-417b-a1e4-efbc0d9ccd43
            //            http://blogs.msdn.com/b/tilovell/archive/2011/06/08/wf4-visual-workflow-tracking-and-workflowinspectionservices.aspx

            // This needs to be addressed by MS. Didn't test it on NET4.5
            // Should check this in detail later

            WorkflowDesigner = new WorkflowDesigner();
            WorkflowDesigner.Load(FilePath);

            // END OF HACK ZONE

            if (WorkflowType == WorkflowType.Activity)
            {
                executer = new ActivityDebugger(WorkflowDesigner, outputTextWriter);
            }
            else
            {
                executer = new WorkflowServiceDebugger(WorkflowDesigner, outputTextWriter);
            }

            ((IWorkflowDebugger)executer).DebugStepAdded += (sender, args) =>
            {
                Application.Current.Dispatcher.Invoke(
                    DispatcherPriority.Normal,
                    (Action)(() => DebugSteps.Add(args.DebugStep)));
            };

            executer.ExecutingStateChanged += OnExecuterRunningStateChanged;
            executer.Start();
        }
예제 #3
0
 public override void Execute(object parameter)
 {
     DebugSteps.Show();
 }