internal void AsyncReadyCallback(CallbackIgnorinator ci) { if (ci == waitingForCI) { UpdatePreviewPanel(); } }
private void HandleUpdate() { if (!needUpdate) { return; } needUpdate = false; Monitor.Enter(this); try { if (previewInterest != null) { previewInterest.Dispose(); previewInterest = null; waitingForCI = null; } if (_legend != null) { try { IFuture renderedLegendFuture = _legend.GetRenderedLegendFuture(displayableSource, (FutureFeatures)5); if (previewFuture != renderedLegendFuture) { previewFuture = renderedLegendFuture; AsyncRef asyncRef = (AsyncRef)renderedLegendFuture.Realize("LegendOptionsPanel.UpdatePreviewPanel"); if (asyncRef.present == null) { waitingForCI = new CallbackIgnorinator(this); asyncRef.AddCallback(waitingForCI.Callback); asyncRef.SetInterest(524296); previewInterest = new InterestList(); previewInterest.Add(asyncRef); previewInterest.Activate(); UpdatePreviewImage(null); } else { if (asyncRef.present is ImageRef) { UpdatePreviewImage((ImageRef)asyncRef.present); } } } } catch (Legend.RenderFailedException) { } } } finally { Monitor.Exit(this); } }
public void Configure(Legend legend, IDisplayableSource displayableSource) { Monitor.Enter(this); try { if (previewInterest != null) { previewInterest.Dispose(); previewInterest = null; waitingForCI = null; } } finally { Monitor.Exit(this); } if (_legend == legend) { return; } if (_legend != null) { _legend.dirtyEvent.Remove(LegendChanged); } _legend = legend; this.displayableSource = displayableSource; if (_legend != null) { _legend.dirtyEvent.Add(LegendChanged); LegendChanged(); } Enabled = _legend != null; UpdatePreviewImage(null); UpdatePreviewPanel(); }