title: Workflow 4.0 custom activity to start external process
body: <p>I am trying out Workflow 4.0 and hoping to write a custom activity to start an external executable, wait for that process to complete and then resume subsequent steps in the workflow.  </p>
  
  <p>I found the following example that shows (towards the bottom of the page) how to write an activity to waiting for a file to arrive in a specific directory:</p>
  
  <p><a href="http://www.develop.com/wf4" rel="nofollow noreferrer">Creating Custom Activities with Workflow 4.0</a></p>
  
  <p>I have a couple of problems with the example. Firstly, when I add the following code:</p>
  
  <pre><code>void FileCreated(object sender, FileSystemEventArgs e)
  {
      instance.ResumeBookmark(bookmarkName, e.FullPath);
      fsw.Dispose();
  }
  </code></pre>
  
  <p><code>instance.Resumebookmark(...)</code> does not seem to be available but <code>instance.BeginResumeBookmark</code> and <code>instance.EndResumeBookmark</code> are.</p>
  
  <p>I am also unsure of how to change this around to deal with external processes, rather than just watching the contents of a directory.</p>
  
  <p>Is this even the best approach for this kind of thing?</p>