protected void Schedule() { if (isScheduled) { throw Fx.Exception.AsError(new InvalidOperationException(CommonResources.ActionItemIsAlreadyScheduled)); } this.isScheduled = true; if (PartialTrustHelpers.ShouldFlowSecurityContext) { this.context = PartialTrustHelpers.CaptureSecurityContextNoIdentityFlow(); } if (this.context != null) { ScheduleCallback(CallbackHelper.InvokeWithContextCallback); } else { ScheduleCallback(CallbackHelper.InvokeWithoutContextCallback); } }