void ReleaseDesignerOutlets()
        {
            if (OutcomeKey != null)
            {
                OutcomeKey.Dispose();
                OutcomeKey = null;
            }

            if (OutcomeValue != null)
            {
                OutcomeValue.Dispose();
                OutcomeValue = null;
            }

            if (OutcomeValueKey != null)
            {
                OutcomeValueKey.Dispose();
                OutcomeValueKey = null;
            }

            if (UniqueOutcomeKey != null)
            {
                UniqueOutcomeKey.Dispose();
                UniqueOutcomeKey = null;
            }

            if (PrivacyConsentControl != null)
            {
                PrivacyConsentControl.Dispose();
                PrivacyConsentControl = null;
            }
        }
Ejemplo n.º 2
0
        internal override void InnerInvoke(BasicCompletes completedCompletes)
        {
            if (HasException.Get())
            {
                return;
            }

            if (Action is Action invokableAction)
            {
                invokableAction();
                return;
            }

            if (Action is Action <TResult> invokableActionInput)
            {
                if (completedCompletes is AndThenContinuation <TResult, TResult> andThenContinuation)
                {
                    invokableActionInput(andThenContinuation.FailedOutcomeValue.Get());
                    OutcomeKnown.Set();
                    return;
                }
            }

            if (Action is Func <ICompletes <TAntecedentResult>, TResult> funcCompletes)
            {
                OutcomeValue.Set(funcCompletes(antecedent));
                OutcomeKnown.Set();
                return;
            }

            if (Action is Func <TAntecedentResult, TResult> function)
            {
                if (completedCompletes is AndThenContinuation <TResult, TAntecedentResult> andThenContinuation)
                {
                    OutcomeValue.Set(function(andThenContinuation.FailedOutcomeValue.Get()));
                    OutcomeKnown.Set();
                    return;
                }

                if (completedCompletes is BasicCompletes <TAntecedentResult> otherwiseContinuation)
                {
                    OutcomeValue.Set(function(otherwiseContinuation.FailedOutcomeValue.Get()));
                    OutcomeKnown.Set();
                    return;
                }
            }

            base.InnerInvoke(completedCompletes);

            throw new InvalidCastException("Cannot run 'Otherwise' function. Make sure that expecting type is the same as failedOutcomeValue type");
        }