private static CompositeScaleGraphic GetCompositeScaleGraphic(IPresentationImage image, bool createIfNull) { if (image is IApplicationGraphicsProvider) { GraphicCollection overlayGraphics = ((IApplicationGraphicsProvider)image).ApplicationGraphics; CompositeScaleGraphic scale = CollectionUtils.SelectFirst(overlayGraphics, delegate(IGraphic graphic) { return(graphic is CompositeScaleGraphic); } ) as CompositeScaleGraphic; if (scale == null && createIfNull) { overlayGraphics.Insert(0, scale = new CompositeScaleGraphic()); } return(scale); } return(null); }
private static SynchronizationToolCompositeGraphic GetSynchronizationToolCompositeGraphic(IPresentationImage image) { if (image is IApplicationGraphicsProvider) { GraphicCollection overlayGraphics = ((IApplicationGraphicsProvider)image).ApplicationGraphics; SynchronizationToolCompositeGraphic container = CollectionUtils.SelectFirst(overlayGraphics, delegate(IGraphic graphic) { return(graphic is SynchronizationToolCompositeGraphic); }) as SynchronizationToolCompositeGraphic; if (container == null) { overlayGraphics.Insert(0, container = new SynchronizationToolCompositeGraphic()); } container.Visible = true; return(container); } return(null); }