public void Init(ITaskEvent task)
        {
            bool?flag = (bool?)this.context.InvocationInfo.Fields["CmdletLogEntriesEnabled"];

            if (flag != null && flag.Value)
            {
                ExchangePropertyContainer.EnableCmdletLog(this.context.SessionState);
            }
            if ((flag != null && flag.Value) || ExchangePropertyContainer.IsCmdletLogEnabled(this.context.SessionState))
            {
                task.PreInit += this.Task_PreInit;
                task.Stop    += this.DisableCmdletLog;
                task.Release += this.DisableCmdletLog;
                this.context.CommandShell.PrependTaskIOPipelineHandler(this);
            }
        }
 private void Task_PreInit(object sender, EventArgs e)
 {
     ExchangePropertyContainer.EnableCmdletLog(this.context.SessionState);
     this.cmdletLogEntries = ExchangePropertyContainer.GetCmdletLogEntries(this.context.SessionState);
     this.context.InvocationInfo.IsVerboseOn = true;
 }