private void StartBitmapCompleteWaiter() { Task <bool> onCompleted = new Task <bool>( delegate() { BitmapCompletedDelegate localBitmapCompleted = this.BitmapCompleted; Task <ManagedBitmap> bitmap = this.bitmap; if (bitmap == null) // object disposed before task started { return(false); } bitmap.Wait(); if (localBitmapCompleted != null) { localBitmapCompleted.Invoke(this, EventArgs.Empty); } return(false); }); onCompleted.Start(); }
private void StartBitmapCompleteWaiter() { Task <bool> onCompleted = new Task <bool>( delegate() { this.bitmap.Wait(); BitmapCompletedDelegate localBitmapCompleted = this.BitmapCompleted; if (localBitmapCompleted != null) { localBitmapCompleted.Invoke(this, EventArgs.Empty); } return(false); }); onCompleted.Start(); }