예제 #1
0
        public void Set(IList <IVisio.Shape> target_shapes, UserDefinedCell userdefinedcell)
        {
            this.AssertApplicationAvailable();
            this.AssertDocumentAvailable();

            var shapes = GetTargetShapes(target_shapes);

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

            if (userdefinedcell == null)
            {
                throw new System.ArgumentNullException("userdefinedcell");
            }

            var application = this.Client.VisioApplication;

            using (var undoscope = new VA.Application.UndoScope(this.Client.VisioApplication, "Set User-Defined Cell"))
            {
                foreach (var shape in shapes)
                {
                    UserDefinedCellsHelper.Set(shape, userdefinedcell.Name, userdefinedcell.Value.Formula.Value, userdefinedcell.Prompt.Formula.Value);
                }
            }
        }
예제 #2
0
        protected override void ProcessRecord()
        {
            var targets = new TargetShapes(this.Shapes);
            var dic     = this.Client.UserDefinedCell.Get(targets);

            if (this.GetCells)
            {
                this.WriteObject(dic);
                return;
            }

            foreach (var kv in dic)
            {
                int shapeid = kv.Key.ID;
                foreach (var udc in kv.Value)
                {
                    var udcell_vals = new UserDefinedCell(shapeid, udc.Name, udc.Value.Formula.Value, udc.Prompt.Formula.Value);
                    this.WriteObject(udcell_vals);
                }
            }
        }