private void OnThumbnailReady(IThumbnailProvider dw, ThumbnailReadyHandler callback, Surface thumb) { Pair <IThumbnailProvider, Surface> data = Pair.Create(dw, thumb); ThumbnailReadyArgs e = new ThumbnailReadyArgs(data); lock (this.thumbnailReadyInvokeList) { this.thumbnailReadyInvokeList.Add(new ThumbnailReadyEventDetails(callback, this, e)); } try { this.syncContext.BeginInvoke(new Procedure(DrainThumbnailReadyInvokeList), null); } catch (ObjectDisposedException) { // Ignore this error } catch (InvalidOperationException) { // If syncContext was destroyed, then ignore } }
private void OnThumbnailReady(IThumbnailProvider dw, ThumbnailReadyHandler callback, Surface thumb) { Pair <IThumbnailProvider, Surface> data = new Pair <IThumbnailProvider, Surface>(dw, thumb); ThumbnailReadyArgs e = new ThumbnailReadyArgs(data); lock (this.thumbnailReadyInvokeList) { this.thumbnailReadyInvokeList.Add(new Triple <ThumbnailReadyHandler, object, ThumbnailReadyArgs>(callback, this, e)); } try { //this.syncContext.BeginInvoke(callback, new object[] { this, e }); this.syncContext.BeginInvoke(new Procedure(DrainThumbnailReadyInvokeList), null); } catch (InvalidOperationException) { // If syncContext was destroyed, then ignore } }
public void QueueThumbnailUpdate(IThumbnailProvider updateMe, int thumbSideLength, ThumbnailReadyHandler callback) { if (thumbSideLength < 1) { throw new ArgumentOutOfRangeException("thumbSideLength", "must be greater than or equal to 1"); } lock (this.updateLock) { bool doIt = false; ThumbnailStackItem addMe = new ThumbnailStackItem(updateMe, callback, thumbSideLength); if (this.renderQueue.Count == 0) { doIt = true; } else { ThumbnailStackItem top = this.renderQueue.Peek(); if (addMe != top) { doIt = true; } } // Only add this item to the queue if the item is not already at the top of the queue if (doIt) { this.renderQueue.Push(addMe); } Monitor.Pulse(this.updateLock); } }
private void OnThumbnailReady(IThumbnailProvider dw, ThumbnailReadyHandler callback, Surface thumb) { Pair<IThumbnailProvider, Surface> data = Pair.Create(dw, thumb); ThumbnailReadyArgs e = new ThumbnailReadyArgs(data); lock (this.thumbnailReadyInvokeList) { this.thumbnailReadyInvokeList.Add(new ThumbnailReadyEventDetails(callback, this, e)); } try { this.syncContext.BeginInvoke(new Procedure(DrainThumbnailReadyInvokeList), null); } catch (ObjectDisposedException) { // Ignore this error } catch (InvalidOperationException) { // If syncContext was destroyed, then ignore } }