示例#1
0
        private static void ConfigureServices(IServiceCollection services)
        {
            services
            .Configure <ApiConfiguration>(configuration =>
            {
#if DEBUG
                configuration.ApiUrl = new Uri("http://localhost:63803", UriKind.Absolute);
#else
                configuration.ApiUrl = new Uri("https://api.money.neptuo.com", UriKind.Absolute);
#endif
            })
            .AddAuthorizationCore()
            .AddSingleton(p => new HttpClient()
            {
                BaseAddress = p.GetRequiredService <IOptions <ApiConfiguration> >().Value.ApiUrl
            })
            .AddSingleton <ServerConnectionState>()
            .AddScoped <ApiAuthenticationStateProvider>()
            .AddScoped <AuthenticationStateProvider>(provider => provider.GetRequiredService <ApiAuthenticationStateProvider>())
            .AddTransient <ApiTokenValidator>()
            .AddSingleton <SignalRListener>()
            .AddSingleton <ApiHubService>()
            .AddTransient <IApiHubState>(provider => provider.GetRequiredService <ApiHubService>())
            .AddSingleton <ApiVersionChecker>()
            .AddTransient <Interop>()
            .AddSingleton <PwaInstallInterop>()
            .AddTransient <NetworkStateInterop>()
            .AddSingleton <NetworkState>()
            .AddTransient <VisibilityStateInterop>()
            .AddSingleton <VisibilityState>()
            .AddSingleton <PullToRefreshInterop>()
            .AddTransient <CurrencyStorage>()
            .AddTransient <CategoryStorage>()
            .AddTransient <ProfileStorage>()
            .AddTransient <UserPropertyStorage>()
            .AddTransient <NavigatorUrl>()
            .AddSingleton <Navigator>()
            .AddSingleton <Navigator.ModalContainer>()
            .AddScoped <ApiClient>()
            .AddSingleton <ModalInterop>()
            .AddSingleton <TokenContainer>()
            .AddSingleton <QueryString>()
            .AddSingleton <CommandMapper>()
            .AddSingleton <QueryMapper>()
            .AddSingleton <ColorCollection>()
            .AddSingleton <IconCollection>();

            services
            .AddTransient <TokenStorage>()
            .AddBlazoredLocalStorage()
            .AddBlazoredSessionStorage();

            services
            .AddSingleton <TemplateService>();

            bootstrapTask = new Bootstrap.BootstrapTask(services);
            bootstrapTask.Initialize();
        }
示例#2
0
        private bool TryBootstrap(string launchArguments)
        {
            if (BootstrapTask == null)
            {
                BootstrapTask = new Bootstrap.BootstrapTask(this, launchArguments);
                BootstrapTask.Initialize();
                return(true);
            }

            return(false);
        }
示例#3
0
        private bool TryBootstrap()
        {
            if (BootstrapTask == null)
            {
                BootstrapTask = new Bootstrap.BootstrapTask();
                BootstrapTask.Initialize();
                return(true);
            }

            return(false);
        }
示例#4
0
        private static void Main(string[] args)
        {
            serviceProvider = new BrowserServiceProvider(services =>
            {
                services.AddTransient <ApiClient>();

                Bootstrap.BootstrapTask bootstrapTask = new Bootstrap.BootstrapTask(services);
                bootstrapTask.Initialize();
            });

            new BrowserRenderer(serviceProvider).AddComponent <App>("app");

            RegisteredFunction.Invoke <object>("ApplicationStarted", new object[0]);
        }