// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, IApiVersionDescriptionProvider apiVersionProvider) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Home/Error"); app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseSpaStaticFiles(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller}/{action=Index}/{id?}"); }); app.UseSwagger(); app.UseSwaggerUI(c => { c.ConfigureSwaggerVersions(apiVersionProvider, new SwaggerVersionOptions { DescriptionTemplate = "Version {0} docs", RouteTemplate = "/swagger/{0}/swagger.json", }); c.RoutePrefix = "docs"; }); app.UseSpa(spa => { // To learn more about options for serving an Angular SPA from ASP.NET Core, // see https://go.microsoft.com/fwlink/?linkid=864501 spa.Options.SourcePath = "ClientApp"; if (env.IsDevelopment()) { spa.UseAngularCliServer(npmScript: "start"); } }); using (var serviceScope = app.ApplicationServices.GetRequiredService <IServiceScopeFactory>().CreateScope()) { serviceScope.ServiceProvider.GetService <LiteForumDbContext>().Database.Migrate(); StartupHelper.CreateRolesAndAdminUser(serviceScope.ServiceProvider, Configuration).Wait(); serviceScope.ServiceProvider.GetService <LiteForumDbContext>().EnsureSeeded(Configuration).Wait(); } }
protected override async void OnResume() { // Handle when your app resumes var applicationState = Container.Resolve <IApplicationState>(); var databaseService = Container.Resolve <IDatabaseService>(); // update the settings if we're logged in if (!String.IsNullOrEmpty(applicationState.CurrentUser?.Username)) { await UpdateSettings(); } // get the current session var currentlyActiveValidation = await databaseService.GetActiveCaseValidation(); if (currentlyActiveValidation != null) { // we have an active session, but should we abandon it? var abandonedSession = await StartupHelper.CheckForAbandonedSession(currentlyActiveValidation); if (abandonedSession != null) { // we have abandoned the session, so inform the user var pageDialogService = Container.Resolve <Prism.Services.IPageDialogService>(); await pageDialogService.DisplayAlertAsync("Session", $"Your currently active session with {abandonedSession.Case.Patient.PatientFirstName} {abandonedSession.Case.Patient.PatientLastName} has been abandoned", "OK"); } // redirect if we've abandoned the session and we're logged in if (abandonedSession != null) { // we've abandoned the session, so we can check for an update if (await StartupHelper.IsAnUpdateRequired()) { // we require an update, so redirect to the correct page await NavigationService.NavigateAsync("file:///UpdatePage"); } else if (!String.IsNullOrEmpty(applicationState.CurrentUser.Username)) { // we've abandoned the session and we're logged in so we can need to go to the TabbedNavigationPage await NavigationService.NavigateAsync("file:///TabbedNavigationPage", animated : false); } } } else { // we don't have an active session, so do we need to do an update? if (await StartupHelper.IsAnUpdateRequired()) { // we require an update, so redirect to the correct page await NavigationService.NavigateAsync("file:///UpdatePage"); } } }
public void ConfigureContainer(ContainerBuilder containerBuilder) { //containerBuilder.Populate(_services); //获取核心配置 var coreConfiguration = ConfigurationContainer.Get <CoreConfiguration>(ConfigurationNames.Application); //初始化DI容器 StartupHelper.InitDI(_services, containerBuilder, coreConfiguration.DISetting); }
#pragma warning restore CS8618 // Non-nullable field is uninitialized. public IServiceProvider ConfigureServices(IServiceCollection services) { services.AddCors(); var builder = StartupHelper.CreateContainerBuilder(); builder.Populate(services); _container = builder.Build(); return(new AutofacServiceProvider(_container)); }
/// <summary> /// Check if it needs to set the launch at startup from the config /// </summary> private void ResetStartup() { if (Config.Instance.UseLaunchAtStartup) { StartupHelper.CheckAddedToStartup(true); } else { StartupHelper.RemoveFromStartup(); } }
public virtual Task <IAppUser> Create() { var crmService = StartupHelper.CreateCrmService(); IUserRepository userrepository = new UserRepository(); IConfigRepository configpository = new ConfigRepository(); IUserService userservice = new UserService(crmService, userrepository, configpository); IUserNoticeRepository userNoticerepository = new UserNoticeRepository(); IUserNoticeService userNoticeservice = new UserNoticeService(crmService, userNoticerepository); IAppUser app = new AppUser(userservice, userNoticeservice); return(Task.FromResult(app));; }
private void Application_Start(object sender, EventArgs e) { try { ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls; var logger = StartupHelper.BootstrapLogger; var config = StartupHelper.Configuration; var builder = new ContainerBuilder(); builder.RegisterConfiguration(config); builder.RegisterOptions(); builder.RegisterOption <FunnyQuotesConfiguration>(config.GetSection("FunnyQuotes")); builder.RegisterDiscoveryClient(config); builder.RegisterLogging(config); // allow loggers to be injectable by AutoFac builder.RegisterType <DynamicConsoleLoggerProvider>().As <ILoggerProvider>().AsSelf(); // via management endpoints builder.RegisterHystrixMetricsStream(config); builder.RegisterCloudFoundryActuators(config); builder.RegisterType <ConfigServerHealthContributor>().As <IHealthContributor>(); // builder.RegisterType<EurekaApplicationsHealthContributor>().As<IHealthContributor>(); builder.RegisterType <EurekaServerHealthContributor>().As <IHealthContributor>(); // register 4 different implementations of IFunnyQuoteService and assign them unique names builder.RegisterType <AsmxFunnyQuotesClient>().Named <IFunnyQuoteService>("asmx"); builder.RegisterType <WcfFunnyQuotesClient>().Named <IFunnyQuoteService>("wcf"); builder.RegisterType <LocalFunnyQuoteService>().Named <IFunnyQuoteService>("local"); builder.RegisterType <RestFunnyQuotesClient>().Named <IFunnyQuoteService>("rest"); // register dynamic resolution of implementation of IFunnyQuoteService based on named implementation defined in the config builder.Register(c => { var quotesConfig = c.Resolve <IOptionsSnapshot <FunnyQuotesConfiguration> >(); return(c.ResolveNamed <IFunnyQuoteService>(quotesConfig.Value.ClientType)); }); var container = builder.Build(); container.StartDiscoveryClient(); // start eureka client and add current app into the registry container.StartHystrixMetricsStream(); // start publishing hystrix stream StartupHelper.StartActuators(container); // container.StartActuators(); // map routes for actuator endpoints _containerProvider = new ContainerProvider(container); // setup autofac WebForms integration logger.LogInformation(">> FunnyQuotesLegacyUI Started <<"); } catch (Exception exception) { Console.Error.WriteLine(exception); throw; } }
public void ConfigureSettings() { var collection = new ServiceCollection(); var configuration = new Mock <IConfiguration>(); configuration.Setup(c => c.GetSection("AppSettings")).Returns(Mock.Of <IConfigurationSection>()); StartupHelper.ConfigureAppSettings(collection, configuration.Object); using (var provider = collection.BuildServiceProvider()) { Assert.IsNotNull(provider.GetService <IConfigureOptions <AppSettings> >()); } }
public void ConfigureServices(IServiceCollection services) { StartupHelper.AddMvcService(services); services.AddPiranha(); services.AddPiranhaApplication(); StartupHelper.AddFileOrBlobStorage(services); services.AddPiranhaImageSharp(); StartupHelper.AddDatabase(Configuration, services); services.AddPiranhaManager(); services.AddMemoryCache(); services.AddPiranhaMemoryCache(); StartupHelper.AddEmailService(services); }
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); StartupHelper.SetupApiDocumentation(app); }
public App() { if (Settings.Default.Keys == null) { Settings.Default.Keys = new StringCollection(); RegistryHelper.RestoreApps(); RegistryHelper.RestoreUi(); } var themeSwitchService = new ThemeSwitchService(); var startupHelper = new StartupHelper(); new TrayIconHelper(themeSwitchService, startupHelper, this); }
protected void Application_Start() { StartupHelper.Seed(); AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); ModelBinders.Binders.DefaultBinder = new DevExpress.Web.Mvc.DevExpressEditorsBinder(); DevExpress.Web.ASPxWebControl.CallbackError += Application_Error; }
private void Application_Startup(object sender, StartupEventArgs e) { try { StartupHelper.InitializeAppDomain(FolderConstants.FEEDER_BRIDGE_APP_DATA_FOLDER); SimpleIoc.Default.Register <INavigationService, NavigationService>(); SimpleIoc.Default.Register <IUnitOfWorkFactory, UnitOfWorkFactory>(); } catch (Exception exc) { Logging.Logger.Log(exc); Logging.Logger.CleanUp(); } }
public TickerIntegrationTest() { _httpRequestHandlerMock = new Mock <IHttpRequestHandler>(); var services = new StartupHelper().BuildService(); services.AddSingleton <ITickerService, TickerService>(); services.AddSingleton(_httpRequestHandlerMock.Object); var serviceProvider = services.BuildServiceProvider(); var tickesService = serviceProvider.GetService <ITickerService>(); var mapper = serviceProvider.GetService <IMapper>(); _tickerController = new TickerController(tickesService, mapper); }
public async Task <IAppVehorder> Create() { try { var crmService = StartupHelper.CreateCrmService(); IVehorderRepository vehorderRepository = new VehorderRepository(); IVehorderService VehorderService = new VehorderService(crmService, vehorderRepository); IAppVehorder app = new AppVehorder(VehorderService); return(app); } catch (Exception ex) { throw ex; } }
public DaySummaryIntegrationTest() { _httpRequestHandlerMock = new Mock <IHttpRequestHandler>(); var services = new StartupHelper().BuildService(); services.AddSingleton <IDaySummaryService, DaySummaryService>(); services.AddSingleton(_httpRequestHandlerMock.Object); var serviceProvider = services.BuildServiceProvider(); var daySummaryService = serviceProvider.GetService <IDaySummaryService>(); var mapper = serviceProvider.GetService <IMapper>(); _daySummaryController = new DaySummaryController(mapper, daySummaryService); }
public async Task <IAppAttachment> Create() { try { var crmService = StartupHelper.CreateCrmService(); IAttachmentService AttachmentService = new AttachmentService(crmService); IAppAttachment app = new AppAttachment(AttachmentService); return(app); } catch (Exception ex) { throw ex; } }
public static Task Main(string[] args) { if (OSInfo.Kind != OSKind.WebAssembly) { throw new ApplicationException("This app runs only in browser."); } var builder = WebAssemblyHostBuilder.CreateDefault(args); StartupHelper.ConfigureServices(builder.Services, builder); var host = builder.Build(); host.Services.HostedServices().Start(); return(host.RunAsync()); }
public async Task <IAppDelivery> Create() { try { var crmService = StartupHelper.CreateCrmService(); IDeliveryRepository deliveryRepository = new DeliveryRepository(); IDeliveryService deliveryService = new DeliveryService(crmService, deliveryRepository); IAppDelivery app = new AppDelivery(deliveryService); return(app); } catch (Exception ex) { throw ex; } }
public async Task <IAppActivity> Create() { try { var crmService = StartupHelper.CreateCrmService(); IActivityRepository repository = new ActivityRepository(); IActivityService service = new ActivityService(crmService, repository); IAppActivity app = new AppActivity(service); return(app); } catch (Exception ex) { throw ex; } }
public OrderbookIntegrationTest() { _httpRequestHandlerMock = new Mock <IHttpRequestHandler>(); var services = new StartupHelper().BuildService(); services.AddSingleton <IOrderbookService, OrderbookService>(); services.AddSingleton(_httpRequestHandlerMock.Object); var serviceProvider = services.BuildServiceProvider(); var orderbookService = serviceProvider.GetService <IOrderbookService>(); var mapper = serviceProvider.GetService <IMapper>(); _orderbookController = new OrderbookController(orderbookService, mapper); }
private void ButtonOK_Click(object sender, EventArgs e) { var prefs = this.UserPrefsProvider.LoadPreferences(); prefs.StartWithWindows = this.WindowsStartField.Value; prefs.StartServerAutomatically = this.ServerStartField.Value; prefs.StartMinimized = this.StartMinimizedField.Value; prefs.CheckServerRunning = this.CheckServerRunningField.Value; prefs.CheckForUpdates = this.CheckForUpdatesField.Value; StartupHelper.ApplyStartupSetting(prefs.StartWithWindows, this.Logger); this.UserPrefsProvider.SavePreferences(prefs); this.Close(); }
public async Task <IAppVehnetwork> Create() { try { var crmService = StartupHelper.CreateCrmService(); IVehnetworkRepository repository = new VehnetworkRepository(); IVehnetworkService service = new VehnetworkService(crmService, repository); IAppVehnetwork app = new AppVehnetwork(service); return(app); } catch (Exception ex) { throw ex; } }
public TradesIntegrationTest() { _httpRequestHandlerMock = new Mock <IHttpRequestHandler>(); var services = new StartupHelper().BuildService(); services.AddSingleton <ITradesService, TradesService>(); services.AddSingleton(_httpRequestHandlerMock.Object); var serviceProvider = services.BuildServiceProvider(); var tradeService = serviceProvider.GetService <ITradesService>(); var mapper = serviceProvider.GetService <IMapper>(); _tradesController = new TradesController(mapper, tradeService); }
public async Task <IAppAccount> Create() { try { var crmService = StartupHelper.CreateCrmService(); IAccountRepository accountRepository = new AccountRepository(); IAccountService accountService = new AccountService(crmService, accountRepository); IAppAccount app = new AppAccount(accountService); return(app); } catch (Exception ex) { throw ex; } }
public App() { StartupHelper.Initialize(); DataConnectionHelper.InitDataConnection(); InitializeComponent(); Task.Run(GeoLocationHelper.SetGeoLocation).ConfigureAwait(false); var mainpage = new MainPageModel(CelestialObjectSeedHelper.GetSun()); mainpage.SetModel(null); MainPage = mainpage; }
public async Task <IAppAppointmentInfo> Create() { try { var crmService = StartupHelper.CreateCrmService(); IAppointmentInfoRepository appointmentInfoRepository = new AppointmentInfoRepository(); IAppointmentInfoService appointmentInfoService = new AppointmentInfoService(crmService, appointmentInfoRepository); IAppAppointmentInfo app = new AppAppointmentInfo(appointmentInfoService); return(app); } catch (Exception ex) { throw ex; } }
public async Task <IAppInstallation> Create() { try { var crmService = StartupHelper.CreateCrmService(); IInstallationRepository installationRepository = new InstallationRepository(); IInstallationService installationService = new InstallationService(crmService, installationRepository); IAppInstallation app = new AppInstallation(installationService); return(app); } catch (Exception ex) { throw ex; } }
public async Task <IAppBaseData> Create() { try { var crmService = StartupHelper.CreateCrmService(); IBaseDataRepository baseDataRepository = new BaseDataRepository(); IBaseDataService baseDataService = new BaseDataService(crmService, baseDataRepository); IAppBaseData app = new AppBaseData(baseDataService); return(app); } catch (Exception ex) { throw ex; } }
public async Task <IAppDriveRecord> Create() { try { var crmService = StartupHelper.CreateCrmService(); IDriveRecordRepository driveRecordRepository = new DriveRecordRepository(); IDriveRecordService driveRecordService = new DriveRecordService(crmService, driveRecordRepository); IAppDriveRecord app = new AppDriveRecord(driveRecordService); return(app); } catch (Exception ex) { throw ex; } }