Example #1
0
        public void Duplicate(int n)
        {
            this._client.Application.AssertApplicationAvailable();
            this._client.Document.AssertDocumentAvailable();

            if (n < 1)
            {
                throw new System.ArgumentOutOfRangeException(nameof(n));
            }
            if (!this._client.Selection.HasShapes())
            {
                return;
            }

            // TODO: Add ability to duplicate all the selected shapes, not just the first one
            // this dupicates exactly 1 shape N - times what it
            // it should do is duplicate all M selected shapes N times so that M*N shapes are created

            var application = this._client.Application.Get();

            using (var undoscope = this._client.Application.NewUndoScope(string.Format("Duplicate Shape {0} Times", n)))
            {
                var active_window = application.ActiveWindow;
                var selection     = active_window.Selection;
                var active_page   = application.ActivePage;
                var new_shapes    = DrawCommands.CreateDuplicates(active_page, selection[1], n);
            }
        }
        public void DuplicateShapes(int n)
        {
            var cmdtarget = this._client.GetCommandTargetDocument();

            if (n < 1)
            {
                throw new System.ArgumentOutOfRangeException(nameof(n));
            }

            var window    = cmdtarget.Application.ActiveWindow;
            var selection = window.Selection;

            if (selection.Count < 1)
            {
                return;
            }

            // TODO: Add ability to duplicate all the selected shapes, not just the first one
            // this dupicates exactly 1 shape N - times what it
            // it should do is duplicate all M selected shapes N times so that M*N shapes are created

            var application = cmdtarget.Application;

            using (var undoscope = this._client.Undo.NewUndoScope(nameof(DuplicateShapes)))
            {
                var active_page = application.ActivePage;
                var new_shapes  = DrawCommands._create_duplicates(active_page, selection[1], n);
            }
        }
Example #3
0
        public void Duplicate(VisioScripting.TargetSelection targetselection, int n)
        {
            if (n < 1)
            {
                throw new System.ArgumentOutOfRangeException(nameof(n));
            }

            targetselection = targetselection.ResolveToSelection(this._client);

            // TODO: Add ability to duplicate all the selected shapes, not just the first one
            // this dupicates exactly 1 shape N - times what it
            // it should do is duplicate all M selected shapes N times so that M*N shapes are created

            using (var undoscope = this._client.Undo.NewUndoScope(nameof(Duplicate)))
            {
                var app         = targetselection.Selection.Application;
                var active_page = app.ActivePage;
                var new_shapes  = DrawCommands._create_duplicates(active_page, targetselection.Selection[1], n);
            }
        }