Ejemplo n.º 1
0
 /// <summary>
 /// An event handler called after a marker is removed.
 /// </summary>
 /// <param name="sender">The sender object.</param>
 /// <param name="e">The event arguments.</param>
 private void OnAfterMarkerRemoved(object sender, ConcurrentComponentCollection<MapMarker>.ItemChangedEventArgs e)
 {
     // If the marker is null, do nothing.
     if (null == e.Item) return;
     // Remove the marker event handlers.
     this.OnRemoveMarkerEventHandlers(e.Item);
     // Refresh the marker.
     this.Invalidate(e.Item.Bounds.Add(this.bitmapLocation));
     // If this marker equals the highlighted marker.
     if (e.Item == this.highlightMarker)
     {
         if (null != this.emphasizedMarker)
         {
             this.OnShowAnnotation(this.annotationInfo, this.emphasizedMarker.Name, this.emphasizedMarker);
         }
         else if (null != this.highlightRegion)
         {
             this.OnShowAnnotation(this.annotationInfo, this.highlightRegion.Name, this.highlightRegion);
         }
         else
         {
             this.OnHideAnnotation(this.annotationInfo);
         }
     }
     else if (e.Item == this.emphasizedMarker)
     {
         if (null != this.highlightRegion)
         {
             this.OnShowAnnotation(this.annotationInfo, this.highlightRegion.Name, this.highlightRegion);
         }
         else
         {
             this.OnHideAnnotation(this.annotationInfo);
         }
     }
     // Dispose the marker.
     if (this.markerAutoDispose)
     {
         e.Item.Dispose();
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// An event handler called when a marker is set.
 /// </summary>
 /// <param name="sender">The sender object.</param>
 /// <param name="e">The event arguments.</param>
 private void OnAfterMarkerSet(object sender, ConcurrentComponentCollection<MapMarker>.ItemSetEventArgs e)
 {
     // If the old marker is different from the new marker.
     if (e.OldItem != e.NewItem)
     {
         this.OnAfterMarkerRemoved(sender, new ConcurrentComponentCollection<MapMarker>.ItemChangedEventArgs(e.Index, e.OldItem));
         this.OnAfterMarkerInserted(sender, new ConcurrentComponentCollection<MapMarker>.ItemChangedEventArgs(e.Index, e.NewItem));
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// An event handler called after a marker is inserted.
 /// </summary>
 /// <param name="sender">The sender object.</param>
 /// <param name="e">The event arguments.</param>
 private void OnAfterMarkerInserted(object sender, ConcurrentComponentCollection<MapMarker>.ItemChangedEventArgs e)
 {
     // If the marker is null, do nothing.
     if (null == e.Item) return;
     // Add the marker event handlers.
     this.OnAddMarkerEventHandlers(e.Item);
     // Update the marker.
     e.Item.Update(this.mapBounds, this.mapScale);
     // Refresh the marker.
     this.Invalidate(e.Item.Bounds.Add(this.bitmapLocation));
 }