public void Function() { var handle = new ManualResetEvent(false); Context.RaisePause(new PauseEventArgs(handle)); handle.WaitOne(); }