Exemplo n.º 1
0
        /// <summary>
        /// Gets the surface area.
        /// </summary>
        /// <param name="provider">The provider.</param>
        /// <returns></returns>
        public static bool IsDiagramSelected(IServiceProvider provider)
        {
            DiagramDocView docView = DesignerHelper.GetDiagramDocView(provider);

            if (docView != null)
            {
                if (docView.SelectionCount == 1)
                {
                    foreach (object component in docView.GetSelectedComponents())
                    {
                        return(component is Diagram);
                    }
                }
            }

            return(false);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets the selected shape.
        /// </summary>
        /// <param name="provider">The provider.</param>
        /// <returns></returns>
        public static ShapeElement GetSelectedShape(IServiceProvider provider)
        {
            Guard.ArgumentNotNull(provider, "provider");

            DiagramDocView docView = DesignerHelper.GetDiagramDocView(provider);

            if (docView != null)
            {
                if (docView.SelectionCount == 1)
                {
                    foreach (object component in docView.GetSelectedComponents())
                    {
                        ShapeElement selectedShape = component as ShapeElement;
                        if (selectedShape != null)
                        {
                            return(selectedShape);
                        }
                    }
                }
            }

            return(null);
        }