private void Overlay_DrawingException(object sender, DrawingExceptionTileOverlayEventArgs e) { Application.Current.Dispatcher.BeginInvoke(() => { GisEditor.LoggerManager.Log(LoggerLevel.Warning, e.Exception.Message, e.Exception); }); }
private void GisEditorLayerOverlay_DrawingException(object sender, DrawingExceptionTileOverlayEventArgs e) { e.Cancel = true; e.Canvas.Clear(new GeoSolidBrush(GeoColor.StandardColors.Transparent)); string text = GetWrappedText(e.Exception.Message, TileWidth); if (text.Length > 0) { DrawingQuality tempDrawingQuality = e.Canvas.DrawingQuality; e.Canvas.DrawingQuality = DrawingQuality.HighQuality; e.Canvas.DrawTextWithScreenCoordinate(text, new GeoFont("Arial", 10), new GeoSolidBrush(GeoColor.StandardColors.Black), e.Canvas.Width / 2, e.Canvas.Height / 2, DrawingLevel.LabelLevel); e.Canvas.DrawingQuality = tempDrawingQuality; } }
internal static void RaiseDrawingException <T>(string name, object sender, EventArgs e) { DrawingExceptionLayerEventArgs drawingExceptionLayerEventArgs = e as DrawingExceptionLayerEventArgs; DrawingExceptionTileOverlayEventArgs drawingExceptionTileOverlayEventArgs = e as DrawingExceptionTileOverlayEventArgs; if (!sender.Equals(default(T))) { var message = string.Format(CultureInfo.InvariantCulture, ConnectionFailed, name); var font = new GeoFont("Arial", 10, DrawingFontStyles.Italic); if (drawingExceptionLayerEventArgs != null) { if (drawingExceptionLayerEventArgs.Canvas.ClippingArea != null) { var clippingCenter = drawingExceptionLayerEventArgs.Canvas.ClippingArea.GetCenterPoint(); drawingExceptionLayerEventArgs.Canvas.DrawTextWithWorldCoordinate(message, font, new GeoSolidBrush(GeoColor.StandardColors.GrayText), clippingCenter.X, clippingCenter.Y, DrawingLevel.LabelLevel); drawingExceptionLayerEventArgs.Cancel = true; } else { var drawingArea = drawingExceptionLayerEventArgs.Canvas.MeasureText(message, font); drawingExceptionLayerEventArgs.Canvas.DrawTextWithScreenCoordinate(message, font, new GeoSolidBrush(GeoColor.StandardColors.GrayText), 20 + drawingArea.Width * .5f, 20 + drawingArea.Height * .5f, DrawingLevel.LabelLevel); drawingExceptionLayerEventArgs.Cancel = true; } } else if (drawingExceptionTileOverlayEventArgs != null) { if (drawingExceptionTileOverlayEventArgs.Canvas.ClippingArea != null) { var clippingCenter = drawingExceptionTileOverlayEventArgs.Canvas.ClippingArea.GetCenterPoint(); drawingExceptionTileOverlayEventArgs.Canvas.DrawTextWithWorldCoordinate(message, font, new GeoSolidBrush(GeoColor.StandardColors.GrayText), clippingCenter.X, clippingCenter.Y, DrawingLevel.LabelLevel); drawingExceptionTileOverlayEventArgs.Cancel = true; } else { var drawingArea = drawingExceptionTileOverlayEventArgs.Canvas.MeasureText(message, font); drawingExceptionTileOverlayEventArgs.Canvas.DrawTextWithScreenCoordinate(message, font, new GeoSolidBrush(GeoColor.StandardColors.GrayText), 20 + drawingArea.Width * .5f, 20 + drawingArea.Height * .5f, DrawingLevel.LabelLevel); drawingExceptionTileOverlayEventArgs.Cancel = true; } } } }
private static void BingOverlay_DrawingException(object sender, DrawingExceptionTileOverlayEventArgs e) { RaiseDrawingException <BingMapsOverlay>("Bing Maps", sender, e); }
private static void WmkOverlay_DrawingException(object sender, DrawingExceptionTileOverlayEventArgs e) { RaiseDrawingException <WorldMapKitMapOverlay>("WorldMapKit", sender, e); }
private static void OsmOverlay_DrawingException(object sender, DrawingExceptionTileOverlayEventArgs e) { RaiseDrawingException <OpenStreetMapOverlay>("OpenStreetMap", sender, e); }