public PersistentInterest(AsyncRef asyncRef)
		{
			this.interestList = new InterestList();
			this.interestList.Add(asyncRef);
			this.interestList.Activate();
			asyncRef.AddCallback(new AsyncRecord.CompleteCallback(this.AsyncCompleteCallback));
		}
		public void Configure(Legend legend, IDisplayableSource displayableSource)
		{
			Monitor.Enter(this);
			try
			{
				if (this.previewInterest != null)
				{
					this.previewInterest.Dispose();
					this.previewInterest = null;
					this.waitingForCI = null;
				}
			}
			finally
			{
				Monitor.Exit(this);
			}
			if (this._legend == legend)
			{
				return;
			}
			if (this._legend != null)
			{
				this._legend.dirtyEvent.Remove(new DirtyListener(this.LegendChanged));
			}
			this._legend = legend;
			this.displayableSource = displayableSource;
			if (this._legend != null)
			{
				this._legend.dirtyEvent.Add(new DirtyListener(this.LegendChanged));
				this.LegendChanged();
			}
			base.Enabled = (this._legend != null);
			this.UpdatePreviewImage(null);
			this.UpdatePreviewPanel();
		}
		private void HandleUpdate()
		{
			if (!this.needUpdate)
			{
				return;
			}
			this.needUpdate = false;
			Monitor.Enter(this);
			try
			{
				if (this.previewInterest != null)
				{
					this.previewInterest.Dispose();
					this.previewInterest = null;
					this.waitingForCI = null;
				}
				if (this._legend != null)
				{
					try
					{
						IFuture renderedLegendFuture = this._legend.GetRenderedLegendFuture(this.displayableSource, (FutureFeatures)5);
						if (this.previewFuture != renderedLegendFuture)
						{
							this.previewFuture = renderedLegendFuture;
							AsyncRef asyncRef = (AsyncRef)renderedLegendFuture.Realize("LegendOptionsPanel.UpdatePreviewPanel");
							if (asyncRef.present == null)
							{
								this.waitingForCI = new LegendOptionsPanel.CallbackIgnorinator(this);
								asyncRef.AddCallback(new AsyncRecord.CompleteCallback(this.waitingForCI.Callback));
								asyncRef.SetInterest(524296);
								this.previewInterest = new InterestList();
								this.previewInterest.Add(asyncRef);
								this.previewInterest.Activate();
								this.UpdatePreviewImage(null);
							}
							else
							{
								if (asyncRef.present is ImageRef)
								{
									this.UpdatePreviewImage((ImageRef)asyncRef.present);
								}
							}
						}
					}
					catch (Legend.RenderFailedException)
					{
					}
				}
			}
			finally
			{
				Monitor.Exit(this);
			}
		}
Beispiel #4
0
 private void PaintGraphics(PaintSpecification e, LatLonZoom llz)
 {
     this.tilesRequired = 0;
     this.tilesAvailable = 0;
     this.asyncRequestGeneration++;
     if (this.baseLayer == null)
     {
         return;
     }
     InterestList interestList = this.activeTiles;
     this.activeTiles = new InterestList();
     e.ResetClip();
     e.Graphics.FillRectangle(new SolidBrush(Color.LightPink), new Rectangle(new Point(0, 0), e.Size));
     List<ViewerControl.PaintKit> list = new List<ViewerControl.PaintKit>();
     list.AddRange(this.AssembleLayer(e, llz, this.baseLayer, 0));
     int num = 1;
     foreach (IDisplayableSource current in this.alphaLayers)
     {
         list.AddRange(this.AssembleLayer(e, llz, current, num));
         num++;
     }
     this.activeTiles.Activate();
     this.PaintKits(e.Graphics, list);
     e.ResetClip();
     if (this.userRegionViewController != null)
     {
         e.ResetClip();
         this.userRegionViewController.Paint(e, llz, base.Size);
     }
     if (MapDrawingOption.IsEnabled(this.ShowCrosshairs))
     {
         Pen pen = new Pen(Color.Yellow);
         Pen[] array = new Pen[]
         {
             pen,
             new Pen(Color.Black)
             {
                 DashStyle = DashStyle.Dash
             }
         };
         for (int i = 0; i < array.Length; i++)
         {
             Pen pen2 = array[i];
             e.Graphics.DrawLine(pen2, 0, base.Size.Height / 2, base.Size.Width, base.Size.Height / 2);
             e.Graphics.DrawLine(pen2, base.Size.Width / 2, 0, base.Size.Width / 2, base.Size.Height);
         }
     }
     if (MapDrawingOption.IsEnabled(this.ShowPushPins) && this.pinList != null)
     {
         List<PositionAssociationView> list2 = new List<PositionAssociationView>();
         list2.AddRange(this.pinList);
         list2.Sort(delegate(PositionAssociationView p0, PositionAssociationView p1)
         {
             double num2 = p1.position.pinPosition.lat - p0.position.pinPosition.lat;
             if (num2 != 0.0)
             {
                 if (num2 <= 0.0)
                 {
                     return -1;
                 }
                 return 1;
             }
             else
             {
                 double num3 = p1.position.pinPosition.lon - p0.position.pinPosition.lon;
                 if (num3 == 0.0)
                 {
                     return 0;
                 }
                 if (num3 <= 0.0)
                 {
                     return -1;
                 }
                 return 1;
             }
         });
         foreach (PositionAssociationView current2 in list2)
         {
             this.DrawMarker(current2, e);
         }
     }
     if (interestList != null)
     {
         interestList.Dispose();
     }
     if (this.tilesRequired == 0 || this.tilesAvailable == this.tilesRequired)
     {
         this.displayProgressBar.Visible = false;
         return;
     }
     this.displayProgressBar.Visible = true;
     this.displayProgressBar.Minimum = 0;
     this.displayProgressBar.Maximum = this.tilesRequired;
     this.displayProgressBar.Value = this.tilesAvailable;
 }