Exemple #1
0
        public static IComputedState <T> NewComputed <T>(
            this IStateFactory factory,
            Func <IComputedState <T>, CancellationToken, Task <T> > computer)
        {
            var options = new ComputedState <T> .Options();

            return(factory.NewComputed(options, computer));
        }
Exemple #2
0
        public static IComputedState <T> NewComputed <T>(
            this IStateFactory factory,
            Action <ComputedState <T> .Options> optionsBuilder,
            Func <IComputedState <T>, CancellationToken, Task <T> > computer,
            object?argument = null)
        {
            var options = new ComputedState <T> .Options();

            optionsBuilder.Invoke(options);
            return(factory.NewComputed(options, computer, argument));
        }
Exemple #3
0
    public static IComputedState <T> NewComputed <T>(
        this IStateFactory factory,
        Result <T> initialOutput,
        Func <IComputedState <T>, CancellationToken, Task <T> > computer)
    {
        var options = new ComputedState <T> .Options()
        {
            InitialOutput = initialOutput,
        };

        return(factory.NewComputed(options, computer));
    }
Exemple #4
0
    public static IComputedState <T> NewComputed <T>(
        this IStateFactory factory,
        T initialValue,
        IUpdateDelayer updateDelayer,
        Func <IComputedState <T>, CancellationToken, Task <T> > computer)
    {
        var options = new ComputedState <T> .Options()
        {
            InitialValue  = initialValue,
            UpdateDelayer = updateDelayer,
        };

        return(factory.NewComputed(options, computer));
    }
Exemple #5
0
 public static Exception WrongComputedState(ComputedState state)
 => new InvalidOperationException(
     $"Wrong Computed.State: {state}.");
Exemple #6
0
 public static Exception WrongComputedState(
     ComputedState expectedState, ComputedState state)
 => new InvalidOperationException(
     $"Wrong Computed.State: expected {expectedState}, was {state}.");
Exemple #7
0
 protected virtual void ConfigureState(ComputedState <TState> .Options options)
 {
 }
Exemple #8
0
 public static void DefaultAuthStateOptionsBuilder(ComputedState <AuthState> .Options options)
 => options.UpdateDelayer =
     UpdateDelayer.MinUpdateDelay with
Exemple #9
0
 protected override void ConfigureState(ComputedState <PainelComposedValue> .Options options)
 {
     options.UpdateDelayer = UpdateDelayer.MinDelay;
 }