コード例 #1
0
        /// <inheritdoc />
        protected override void ProcessRecord()
        {
            IWebPart webPart = null;

            switch (this.ParameterSetName)
            {
            case PATH:
                webPart = this.BusinessLayer.CreateWebPart(this.Path, this.FileName, this.DisplayName);
                break;

            case CATEGORY:
                webPart = this.BusinessLayer.CreateWebPart(this.Name, this.FileName, this.DisplayName, this.WebPartCategory.ActLike <IWebPartCategory>());
                break;
            }

            if (this.PassThru.ToBool())
            {
                this.WriteObject(webPart.UndoActLike());
            }
        }
コード例 #2
0
 /// <summary>
 /// When overridden in a child class, operates on the specified web part.
 /// </summary>
 /// <param name="webPart">The web part to operate on.</param>
 protected virtual void ActOnObject(IWebPart webPart)
 {
     this.WriteObject(webPart?.UndoActLike());
 }