Exemplo n.º 1
0
        private IShapeHandler GetShapeHandler(Hashtable dictionary, Shape shape, string shapeName, string mode)
        {
            IShapeHandler shapeHandler = (IShapeHandler)dictionary[shape];

            if (shapeHandler != null)
            {
                return(shapeHandler);
            }

            XmlForm form = new XmlForm();

            form.LoadDefinition(shapeName, shape);
            form.SkipDesign = _skip;

            if (!_skip)
            {
                form.Design(mode);
            }

            shapeHandler = (IShapeHandler)form.Tag;
            shapeHandler.LoadProperties();

            dictionary[shape] = shapeHandler;

            return(shapeHandler);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Handles the marker events.
        /// </summary>
        /// <param name="context">Parsed event context.</param>
        private void HandleMarkerEvent(NameValueCollection context)
        {
            Shape shape = VisioUtils.GetShape(_application, context);

            if (shape == null)
            {
                return;
            }

            string shapeName = VisioUtils.GetProperty(shape, "User", "Midgard");

            if (shapeName == null)
            {
                // se for um visio desenhado com a versão antiga (sem os layers)
                shapeName = VisioUtils.GetShapeType(shape);
                if (shapeName == null)
                {
                    return;
                }
            }
            string command = context["cmd"];

            if (command == null)
            {
                return;
            }

            /*
             *
             */
            string mode = "live";// GetMode();

            using (XmlForm form = new XmlForm())
            {
                form.LoadDefinition(shapeName, shape);
                form.Design(mode, Application.ActivePage);

                IShapeHandler   shapeHandler = (IShapeHandler)form.Tag;
                DisplaySettings newSettings  = shapeHandler.Execute(command, context, _displaySettings, _forceFormChange);
                if (newSettings != null)
                {
                    _displaySettings = newSettings;
                }
            }
        }