title: Disable a step on a flowchart
body: <p>I would like to disable some steps on a WF4 flowchart, before execute it.
  My flowchart is very simple, a start node and 3 sequences with a WriteLine activity on each one : "Step 1", "Step 2", "Step 3".</p>
  
  <p>I would like to suppress the "Step 2" sequence, so the Console must write "Step 1" \n "Step 3", here is my code (It works pefectly with a sequential workflow, but not with a flowchart !!)</p>
  
  <pre><code>Activity a = new Activity1();
  Activity customActivity = Customize(a);
  WorkflowInvoker.Invoke(customActivity);
  Console.ReadLine();
  
  static System.Activities.Activity Customize(System.Activities.Activity scheme)
  {
      var activities = WorkflowInspectionServices.GetActivities(scheme);
      var rootActivity = activities.FirstOrDefault();
  
      if (rootActivity is Sequence)
      {
          var seqActivities = ((Sequence)rootActivity).Activities;
          var badActivity = seqActivities.FirstOrDefault(a =&gt; a.DisplayName == "Step2");
          seqActivities.Remove(badActivity);
      }
  
      if (rootActivity is Flowchart)
      {
          var seqActivities = ((Flowchart)rootActivity).Nodes.Cast&lt;FlowStep&gt;().ToList();
          var badActivity = seqActivities.FirstOrDefault(a =&gt; a.Action.DisplayName == "Step2");
          bool b = ((Flowchart)rootActivity).Nodes.Remove(badActivity);
      }
  
      return scheme;
  }
  </code></pre>
  
  <p>Thx for your help !</p>