コード例 #1
0
 public StringKeyValueModelState(IServiceProvider services)
     : base(
         new Options() { UpdateDelayer = new UpdateDelayer(0.5) },
         services)
 {
     Locals = new MutableState <string>(services);
     Locals.AddEventHandler(StateEventKind.Updated, (_, _) => this.Recompute());
 }
コード例 #2
0
 public StringKeyValueModelState(IServiceProvider services)
     : base(
         new Options() {
     UpdateDelayer = new UpdateDelayer(services.UICommandTracker(), 0.5)
 },
         services)
 {
     Locals = services.StateFactory().NewMutable("");
     Locals.AddEventHandler(StateEventKind.Updated, (_, _) => this.Recompute());
 }
コード例 #3
0
        public ClientState(AuthStateProvider authStateProvider, IStateFactory stateFactory)
        {
            AuthStateProvider = authStateProvider;
            SessionResolver   = AuthStateProvider.SessionResolver;

            User = stateFactory.NewLive <User>(
                o => o.WithUpdateDelayer(0, 1),
                async(_, cancellationToken) => {
                var authState = await AuthState.UseAsync(cancellationToken).ConfigureAwait(false);
                return(authState.User);
            });
            ChatUser = stateFactory.NewMutable(Result.Value <ChatUser?>(null));
        }
コード例 #4
0
 public StringKeyValueModelState(Options options, IServiceProvider serviceProvider, object?argument = null)
     : base(options, serviceProvider, argument)
 {
     Locals = new MutableState <string>(serviceProvider);
     Locals.AddEventHandler(StateEventKind.Updated, (s, e) => this.CancelUpdateDelay());
 }
コード例 #5
0
 public CounterService(IMutableState <int> offset)
 => _offset = offset;