Esempio n. 1
0
        protected override void ProcessRecord()
        {
            var target_page = new VisioScripting.Models.TargetPage();
            var page        = target_page.Resolve(this.Client);

            IVisio.Page newpage;
            if (this.ToDocument == null)
            {
                newpage = this.Client.Page.DuplicateActivePage();
            }
            else
            {
                newpage = this.Client.Page.DuplicatePageToDocument(target_page, this.ToDocument);
            }

            this.WriteObject(newpage);
        }
        protected override void ProcessRecord()
        {
            var target_page = new VisioScripting.Models.TargetPage(null);
            var page        = target_page.Resolve(this.Client);

            // Handle the case where neither names nor ids where passed
            if (this.Name == null && this.Id == null)
            {
                // return selected shapes

                if (this.Recursive)
                {
                    this.WriteVerbose("Returning selected shapes (nested)");
                    var shapes = this.Client.Selection.GetShapesInSelectionRecursive();
                    this.WriteObject(shapes, true);
                }
                if (this.SubSelected)
                {
                    this.WriteVerbose("Returning selected shapes (subselecte)");
                    var shapes = this.Client.Selection.GetSubSelectedShapes();
                    this.WriteObject(shapes, true);
                }
                else
                {
                    this.WriteVerbose("Returning selected shapes ");
                    var shapes = this.Client.Selection.GetShapesInSelection();
                    this.WriteObject(shapes, true);
                }

                return;
            }

            // Handle the case where names where passed
            if (this.Name != null)
            {
                string str_asterisk = "*";
                if (this.Name.Contains(str_asterisk))
                {
                    var shapes = this.Client.Draw.GetAllShapesOnActiveDrawingSurface();
                    this.WriteObject(shapes, true);
                }
                else
                {
                    var strings = this.Name.OfType <string>().ToArray();
                    var shapes  = this.Client.Page.GetShapesOnPageByName(target_page, strings);
                    this.WriteObject(shapes, true);
                }

                return;
            }

            // Handle the case where ids where passed
            if (this.Id != null)
            {
                var shapes = this.Client.Page.GetShapesOnPageByID(target_page, this.Id);
                this.WriteObject(shapes, true);

                return;
            }

            throw new System.ArgumentOutOfRangeException();
        }