/// <summary> /// Invokes all applicable callback scripts. /// </summary> /// <param name="Data">Data to send to the callback scriptblocks</param> /// <param name="EnableException">Whether a failed callback scriptblock fails this command in fire and terminating exception.</param> public void InvokeCallback(object Data, bool EnableException = true) { try { CallbackHost.Invoke(new Meta.CallerInfo(GetCaller()), this, Data); } catch (CallbackException e) { StopLocalizedCommand("PSFramework.Assembly.Callback.Failed", new object[] { e.Callback.Name }, e, null, MyInvocation.MyCommand.Name, MyInvocation.MyCommand.ModuleName, "<unknown>", 0, new string[] { "callback", "error" }, EnableException); } }
/// <summary> /// Invoke callbacks /// </summary> protected override void ProcessRecord() { try { CallbackHost.Invoke(GetCallerInfo(1), PSCmdlet, Data); } catch (CallbackException e) { Terminate(e); } }