public void Start()
        {
            IsRunning = true;

            _worker = new BackgroundWorker();
            _worker.DoWork += (sender, args) => { args.Result = CaptureAndSleep(); };
            _worker.RunWorkerCompleted += (sender, args) =>
            {
                var capturedEventArgs = new ScreenCapturedEventArgs(args.Result as BitmapSource);
                OnScreenCaptured(capturedEventArgs);
                if (IsRunning)
                {
                    _worker.RunWorkerAsync();
                }
            };

            _worker.RunWorkerAsync();
        }
 void OnScreenCaptured(ScreenCapturedEventArgs e)
 {
     EventHandler<ScreenCapturedEventArgs> handler = ScreenCaptured;
     if (handler != null)
     {
         handler(this, e);
     }
 }