/// <summary> /// Draw the overlay on one specific imagevieweraddon /// </summary> /// <param name="addOn"></param> private void drawGraphOverlay(ImageViewerAddOn addOn) { try { AssociatedProperties associatedProperties; if (!_cameraAssociatedProperties.TryGetValue(addOn.CameraFQID.ObjectId, out associatedProperties)) { var cameraItem = Configuration.Instance.GetItem(addOn.CameraFQID); associatedProperties = Configuration.Instance.GetAssociatedProperties(cameraItem, AdminTabPluginDefinition.AdminTabPluginTabPlugin); _cameraAssociatedProperties[addOn.CameraFQID.ObjectId] = associatedProperties; } string property1 = associatedProperties.Properties.ContainsKey("Property1") ? associatedProperties.Properties["Property1"] : null; string property2 = associatedProperties.Properties.ContainsKey("Property2") ? associatedProperties.Properties["Property2"] : null; List <Shape> shapes = new List <Shape>(); Size size = new Size(320, 240); if (property1 != null) { shapes.Add(CreateTextShape(size, "Property1=" + property1, 100, 0, 100, System.Windows.Media.Colors.Red)); } if (property2 != null) { shapes.Add(CreateTextShape(size, "Property2=" + property2, 100, 100, 100, System.Windows.Media.Colors.Red)); } if (!_dicShapes.ContainsKey(addOn)) { _dicShapes.Add(addOn, addOn.ShapesOverlayAdd(shapes, new ShapesOverlayRenderParameters() { ZOrder = 100 })); } else { addOn.ShapesOverlayUpdate(_dicShapes[addOn], shapes, new ShapesOverlayRenderParameters() { ZOrder = 100 }); } } catch (Exception ex) { EnvironmentManager.Instance.Log(true, "AdminTabBackgrounPlugin", "DrawOverlay(UI):" + ex.Message); } }
private void UpdateShapeOverlay(ImageViewerAddOn addOn, List <Shape> shapes) { if (!_dicShapes.ContainsKey(addOn)) { _dicShapes.Add(addOn, addOn.ShapesOverlayAdd(shapes, new ShapesOverlayRenderParameters() { ZOrder = 100 })); } else { addOn.ShapesOverlayUpdate(_dicShapes[addOn], shapes, new ShapesOverlayRenderParameters() { ZOrder = 100 }); } }
private void UI_DrawOverlay(ImageViewerAddOn addOn, DateTime dateTime) { try { if (_activeImageViewerAddOns.Contains(addOn)) // check if the ImageViewerAddOn might have been removed { List <Shape> shapes = new List <Shape>(); shapes.Add(CreateTextShape(addOn.PaintSize, addOn.CameraName, 10, 0, 100, Colors.Red)); for (int i = 0; i <= 2; i++) { shapes.Add(CreateTextShape( addOn.PaintSize, _AnalyticsEventObjectString[i], 10, 200 + 60 * i, 50, colorIndicateSameCamera(_AnalyticsEventCameraFQID[i], addOn.CameraFQID.ObjectId))); shapes.Add(CreateTextShape( addOn.PaintSize, _AlarmObjectString[i], 10, 400 + 60 * i, 50, colorIndicateSameCamera(_AlarmCameraFQID[i], addOn.CameraFQID.ObjectId))); shapes.Add(CreateTextShape( addOn.PaintSize, _EventName[i], 2, 600 + 60 * i, 50, colorIndicateSameCamera(_EventCameraFQID[i], addOn.CameraFQID.ObjectId))); } if (!_dictShapes.ContainsKey(addOn)) { _dictShapes.Add(addOn, addOn.ShapesOverlayAdd(shapes, new ShapesOverlayRenderParameters() { ZOrder = 100 })); } else { addOn.ShapesOverlayUpdate(_dictShapes[addOn], shapes, new ShapesOverlayRenderParameters() { ZOrder = 100 }); } } } catch (Exception ex) // Ignore exceptions during close { Debug.WriteLine("DrawOverlay(UI):" + ex.Message); } }