Ejemplo n.º 1
0
        public IVisio.Document Resolve(VisioScripting.Client client)
        {
            if (this.Document == null)
            {
                var cmdtarget = client.GetCommandTarget(
                    Commands.CommandTargetFlags.Application |
                    Commands.CommandTargetFlags.ActiveDocument |
                    Commands.CommandTargetFlags.ActivePage);
                this.Document = cmdtarget.ActiveDocument;
            }

            return(this.Document);
        }
Ejemplo n.º 2
0
        public TargetWindow ResolveToWindow(VisioScripting.Client client)
        {
            if (this.Resolved)
            {
                return(this);
            }

            var cmdtarget     = client.GetCommandTarget(CommandTargetFlags.RequireDocument);
            var active_window = cmdtarget.Application.ActiveWindow;

            client.Output.WriteVerbose("Resolving to active window (caption=\"{0}\")", active_window.Caption);

            return(new TargetWindow(active_window));
        }
Ejemplo n.º 3
0
        public TargetShapes ResolveToShapes(VisioScripting.Client client)
        {
            if (this.Resolved)
            {
                return(this);
            }

            var cmdtarget = client.GetCommandTarget(CommandTargetFlags.RequireDocument); var active_window = cmdtarget.Application.ActiveWindow;
            var selection    = active_window.Selection;
            var shapes       = selection.ToList();
            var targetshapes = new TargetShapes(shapes);

            client.Output.WriteVerbose("Resolving to selection (numshapes={0}) from active window (caption=\"{1}\")", shapes.Count, active_window.Caption);

            return(targetshapes);
        }
Ejemplo n.º 4
0
        public TargetPages ResolveToPages(VisioScripting.Client client)
        {
            // Handle the case where the object is already resolved

            if (this.Resolved)
            {
                return(this);
            }

            // Otherwise perform resolution
            // Try to use the active page as the default target for the operation

            var cmdtarget = client.GetCommandTarget(CommandTargetFlags.RequirePage);

            if (cmdtarget.ActivePage == null)
            {
                throw new VisioAutomation.Exceptions.AutomationException("Resolving failed: No active page available");
            }

            client.Output.WriteVerbose("Resolving to active page (name={0})", cmdtarget.ActivePage.Name);

            return(new TargetPages(cmdtarget.ActivePage));
        }