public void Scripting_Drop_Many()
        {
            var pagesize = new VA.Geometry.Size(10, 10);
            var client   = this.GetScriptingClient();

            // Create the Page
            client.Document.NewDocument();
            client.Page.NewPage(pagesize, false);

            // Load the stencils and find the masters
            var basic_stencil = client.Document.OpenStencilDocument("Basic_U.VSS");
            var stencil_tdoc  = new VisioScripting.TargetDocument(basic_stencil);
            var m1            = client.Master.GetMaster(stencil_tdoc, "Rectangle");
            var m2            = client.Master.GetMaster(stencil_tdoc, "Ellipse");

            // Drop the Shapes
            var masters = new[] { m1, m2 };
            var xys     = new[] { 1.0, 2.0, 3.0, 4.0, 1.5, 4.5, 5.7, 2.4 };
            var points  = VA.Geometry.Point.FromDoubles(xys).ToList();

            var targetpage = new VisioScripting.TargetPage();

            client.Master.DropMasters(targetpage, masters, points);

            // Verify
            var application = client.Application.GetAttachedApplication();

            Assert.AreEqual(4, application.ActivePage.Shapes.Count);

            // Cleanup
            var targetdoc = new VisioScripting.TargetDocument();

            client.Document.CloseDocument(targetdoc, true);
        }
        public void Scripting_Drop_Container_Master_Object()
        {
            var pagesize = new VA.Geometry.Size(4, 4);
            var client   = this.GetScriptingClient();

            // Create the page
            client.Document.NewDocument();
            client.Page.NewPage(pagesize, false);

            var application = client.Application.GetAttachedApplication();
            var active_page = application.ActivePage;

            // Load the stencils and find the masters
            var basic_stencil = client.Document.OpenStencilDocument("Basic_U.VSS");
            var stencil_tdoc  = new VisioScripting.TargetDocument(basic_stencil);
            var master        = client.Master.GetMaster(stencil_tdoc, "Rectangle");

            // Drop the rectangle
            var targetpage = new VisioScripting.TargetPage();

            client.Master.DropMaster(targetpage, master, new VA.Geometry.Point(2, 2));

            // Select the rectangle... it should already be selected, but just make sure
            client.Selection.SelectAllShapes();

            // Drop the container... since the rectangle is selected... it will automatically make it a member of the container
            var app = active_page.Application;

            var ver = client.Application.ApplicationVersion;
            var cont_master_name = ver.Major >= 15 ? "Plain" : "Container 1";

            var stencil_type       = IVisio.VisBuiltInStencilTypes.visBuiltInStencilContainers;
            var measurement_system = IVisio.VisMeasurementSystem.visMSUS;
            var containers_file    = app.GetBuiltInStencilFile(stencil_type, measurement_system);
            var containers_doc     = app.Documents.OpenStencil(containers_file);
            var masters            = containers_doc.Masters;
            var container_master   = masters.ItemU[cont_master_name];

            var dropped_container = client.Master.DropContainerMaster(targetpage, container_master);

            // Verify
            var shapes = active_page.Shapes;

            // There should be two shapes... the rectangle and the container
            Assert.AreEqual(2, shapes.Count);

            // Verify that we did indeed drop a container

            var results_dic = VisioAutomation.Shapes.UserDefinedCellHelper.GetCellsAsDictionary(dropped_container, VA.ShapeSheet.CellValueType.Result);

            Assert.IsTrue(results_dic.ContainsKey("msvStructureType"));
            var prop = results_dic["msvStructureType"];

            Assert.AreEqual("Container", prop.Value.Value);

            // cleanup
            var targetdoc = new VisioScripting.TargetDocument();

            client.Document.CloseDocument(targetdoc, true);
        }
        public void Scripting_Drop_Master()
        {
            var pagesize = new VA.Geometry.Size(4, 4);
            var client   = this.GetScriptingClient();

            // Create the page
            client.Document.NewDocument();
            client.Page.NewPage(pagesize, false);

            // Load the stencils and find the masters
            var basic_stencil = client.Document.OpenStencilDocument("Basic_U.VSS");
            var stencil_tdoc  = new VisioScripting.TargetDocument(basic_stencil);
            var master        = client.Master.GetMaster(stencil_tdoc, "Rectangle");

            // Frop the Shapes

            var targetpage = new VisioScripting.TargetPage();

            client.Master.DropMaster(targetpage, master, new VA.Geometry.Point(2, 2));

            // Verify
            var application = client.Application.GetAttachedApplication();
            var active_page = application.ActivePage;
            var shapes      = active_page.Shapes;

            Assert.AreEqual(1, shapes.Count);

            // cleanup
            var targetdoc = new VisioScripting.TargetDocument();

            client.Document.CloseDocument(targetdoc, true);
        }