public AppLinkController() { // DI ready var serviceLocator = ServiceLocator.Current; _host = serviceLocator.GetService <IApplicationHost>(); _dbContext = serviceLocator.GetService <IDbContext>(); _localizer = serviceLocator.GetService <ILocalizer>(); _userLocale = serviceLocator.GetService <IUserLocale>(); _baseController = new A2v10.Request.BaseController(); _host.StartApplication(false); }
public AccountController() { // DI ready var serviceLocator = ServiceLocator.Current; _host = serviceLocator.GetService <IApplicationHost>(); _dbContext = serviceLocator.GetService <IDbContext>(); _localizer = serviceLocator.GetService <ILocalizer>(); _userStateManager = serviceLocator.GetService <IUserStateManager>(); _userLocale = serviceLocator.GetService <IUserLocale>(); _host.StartApplication(false); }
public WebApplicationHost(IProfiler profiler, IUserLocale userLocale) { _profiler = profiler; _userLocale = userLocale; _emulateBox = IsAppSettingsIsTrue("emulateBox"); var conf = ConfigurationManager.AppSettings["configuration"]; _debug = String.IsNullOrEmpty(conf) || conf == "debug"; // after _debug! _profiler.Enabled = _debug; _environment = ConfigurationManager.AppSettings["environment"]; }
public BaseController(IServiceLocator currentLocator = null) { // DI ready _locator = currentLocator ?? ServiceLocator.Current; _host = _locator.GetService <IApplicationHost>(); _dbContext = _locator.GetService <IDbContext>(); _renderer = _locator.GetServiceOrNull <IRenderer>(); _workflowEngine = _locator.GetServiceOrNull <IWorkflowEngine>(); _localizer = _locator.GetService <ILocalizer>(); _scripter = _locator.GetService <IDataScripter>(); _messageService = _locator.GetServiceOrNull <IMessageService>(); _userStateManager = _locator.GetServiceOrNull <IUserStateManager>(); _externalDataProvider = _locator.GetServiceOrNull <IExternalDataProvider>(); _tokenProvider = _locator.GetService <ITokenProvider>(); _userLocale = _locator.GetService <IUserLocale>(); }
public void Inject(IServiceLocator loc) { _userLocale = loc.GetService <IUserLocale>(); }
public WebLocalizer(IApplicationHost host, IUserLocale userLocale) : base(userLocale) { _host = host; }
public static String GetAppData(this IApplicationHost host, ILocalizer localizer, IUserLocale userLocale) { var appJson = host.ApplicationReader.ReadTextFile(String.Empty, "app.json"); if (appJson != null) { if (appJson.Contains("$(")) { var sb = new StringBuilder(appJson); sb.Replace("$(lang)", userLocale.Language) .Replace("$(lang2)", userLocale.Language2); appJson = sb.ToString(); } // with validation ExpandoObject app = JsonConvert.DeserializeObject <ExpandoObject>(appJson); app.Set("embedded", host.Embedded); return(localizer.Localize(null, JsonConvert.SerializeObject(app))); } ExpandoObject defAppData = new ExpandoObject(); defAppData.Set("version", host.AppVersion); defAppData.Set("title", "A2v10 Web Application"); defAppData.Set("copyright", host.Copyright); defAppData.Set("embedded", host.Embedded); return(JsonConvert.SerializeObject(defAppData)); }
public BaseLocalizer(IUserLocale userLocale) { _userLocale = userLocale; }