private void OnThumbnailReady(IThumbnailProvider dw, ThumbnailReadyHandler callback, Surface thumb) { Pair <IThumbnailProvider, Surface> data = PairUtils.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 OnColorClicked(int index, MouseButtons buttons) { if (ColorClicked != null) { ColorClicked(this, new EventArgs <Pair <int, MouseButtons> >(PairUtils.Create(index, buttons))); } }
protected virtual void OnDocumentClicked(DocumentWorkspace dw, DocumentClickAction action) { if (DocumentClicked != null) { DocumentClicked(this, new EventArgs <Pair <DocumentWorkspace, DocumentClickAction> >( PairUtils.Create(dw, action))); } }
protected override object GetSerializablePortionOfSaveConfigToken(PropertyBasedSaveConfigToken token) { // We do not want to save the schema, just the [name, value] pairs int propCount = token.Properties.Count; Pair <string, object>[] nameValues = new Pair <string, object> [propCount]; int index = 0; foreach (string propertyName in token.PropertyNames) { Property property = token.GetProperty(propertyName); object value = property.Value; Pair <string, object> nameValue = PairUtils.Create(propertyName, value); nameValues[index] = nameValue; ++index; } return(nameValues); }