public ViewModels() { if (DesignMode.DesignModeEnabled) { App.Container = AutoFacConfiguration.Configure(); } }
public Locator() { if (Windows.ApplicationModel.DesignMode.DesignModeEnabled) { App.Container = AutoFacConfiguration.Configure(); } }
/// <summary> /// Initializes the singleton application object. This is the first line of authored code /// executed, and as such is the logical equivalent of main() or WinMain(). /// </summary> public App() { this.InitializeComponent(); this.Suspending += OnSuspending; Container = AutoFacConfiguration.Configure(); }
/// <summary> /// Initializes the singleton application object. This is the first line of authored code /// executed, and as such is the logical equivalent of main() or WinMain(). /// </summary> public App() { InitializeComponent(); Suspending += OnSuspending; UnhandledException += ExceptionHelper.UnhandledExceptionLogger; Container = AutoFacConfiguration.Configure(); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //注册IOC依赖 AutoFacConfiguration.RegisterDependencies(); Application.Run(new TaskMainFrm()); }
/// <summary> /// Initializes the singleton application object. This is the first line of authored code /// executed, and as such is the logical equivalent of main() or WinMain(). /// </summary> public App() { this.InitializeComponent(); this.Suspending += this.OnSuspending; Windows.Phone.UI.Input.HardwareButtons.BackPressed += HardwareButtons_BackPressed; //RegisterVoiceCommands(); Container = AutoFacConfiguration.Configure(); }
public App() { InitializeComponent(); Suspending += OnSuspending; Container = AutoFacConfiguration.Configure(); if (DeviceTypeHelper.GetDeviceType() == DeviceTypeEnum.Xbox) { this.RequiresPointerMode = ApplicationRequiresPointerMode.WhenRequested; Locator.SettingsVM.MediaCenterMode = true; } }
static App() { Container = AutoFacConfiguration.RegisterAutoFac(); Log = typeof(App).GetLogger(); AppDomain.CurrentDomain.FirstChanceException += CurrentDomain_FirstChanceException; AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; Log.Info("Starting..."); }
public App() { InitializeComponent(); Suspending += OnSuspending; Container = AutoFacConfiguration.Configure(); if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 3) && DeviceHelper.GetDeviceType() == DeviceTypeEnum.Xbox) { RequiresPointerMode = ApplicationRequiresPointerMode.WhenRequested; EnteredBackground += OnEnteredBackground; LeavingBackground += OnLeavingBackground; } }
/// <summary> /// Initializes the singleton Application object. This is the first line of authored code /// executed, and as such is the logical equivalent of main() or WinMain(). /// </summary> public App() { InitializeComponent(); Suspending += OnSuspending; using (var db = new FavoriteForumContext()) { // Migrations are not yet enabled in EF7, so use an // API to create the database if it doesn't exist db.Database.EnsureCreated(); } Container = AutoFacConfiguration.Configure(); }
protected override void Configure() { var logPath = LogSetup.GetLogsFolderPath("Logs"); LogSetup.Execute(); var directPath = Path.Combine(logPath, "ChocolateyGui.{Date}.log"); var logConfig = new LoggerConfiguration() .WriteTo.Async(config => config.RollingFile(directPath, retainedFileCountLimit: 10, fileSizeLimitBytes: 150 * 1000 * 1000)) .SetDefaultLevel(); Logger = Log.Logger = logConfig.CreateLogger(); Container = AutoFacConfiguration.RegisterAutoFac(LicensedChocolateyGuiAssemblySimpleName, LicensedGuiAssemblyLocation); }
internal static void Configure() { var logPath = LogSetup.GetLogsFolderPath("Logs"); LogSetup.Execute(); var directPath = Path.Combine(logPath, "ChocolateyGuiCli.{Date}.log"); var logConfig = new LoggerConfiguration() .WriteTo.Sink(new ColouredConsoleSink(), LogEventLevel.Information) .WriteTo.Async(config => config.RollingFile(directPath, retainedFileCountLimit: 10, fileSizeLimitBytes: 150 * 1000 * 1000)) .SetDefaultLevel(); Logger = Log.Logger = logConfig.CreateLogger(); Container = AutoFacConfiguration.RegisterAutoFac(); }
/// <summary> /// 単一アプリケーション オブジェクトを初期化します。これは、実行される作成したコードの ///最初の行であるため、main() または WinMain() と論理的に等価です。 /// </summary> public App() { Microsoft.ApplicationInsights.WindowsAppInitializer.InitializeAsync(); this.InitializeComponent(); this.Suspending += OnSuspending; if (_localSettings.Values.ContainsKey(Constants.ThemeDefault)) { var themeType = (ThemeTypes)_localSettings.Values[Constants.ThemeDefault]; switch (themeType) { case ThemeTypes.Light: RequestedTheme = ApplicationTheme.Light; break; case ThemeTypes.Dark: RequestedTheme = ApplicationTheme.Dark; break; case ThemeTypes.YOSPOS: RequestedTheme = ApplicationTheme.Dark; break; } } SelectedTheme = RequestedTheme; try { DataSource ds = new DataSource(); SaclopediaDataSource sds = new SaclopediaDataSource(); BookmarkDataSource bds = new BookmarkDataSource(); ds.InitDatabase(); ds.CreateDatabase(); bds.InitDatabase(); bds.CreateDatabase(); sds.InitDatabase(); sds.CreateDatabase(); } catch { } Container = AutoFacConfiguration.Configure(); }
// This method gets called by the runtime. Use this method to add services to the container. public IServiceProvider ConfigureServices(IServiceCollection services) { services.AddDbContext <AppDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("Default"))); services.AddIdentity <AppUser, IdentityRole>() .AddEntityFrameworkStores <AppDbContext>() .AddDefaultTokenProviders(); // Add application services. services.AddTransient <IEmailSender, EmailSender>(); services.AddMvc().AddControllersAsServices(); var mapper = Dto.AutoMapperConfiguration.Configure(); //register automapper into the services services.AddSingleton(mapper); //register all other services //send this assembly to register controllers and properties return(AutoFacConfiguration.Configure(services, Assembly.GetExecutingAssembly())); }
/// <summary> /// Initializes the singleton application object. This is the first line of authored code /// executed, and as such is the logical equivalent of main() or WinMain(). /// </summary> public App() { Microsoft.ApplicationInsights.WindowsAppInitializer.InitializeAsync( Microsoft.ApplicationInsights.WindowsCollectors.Metadata | Microsoft.ApplicationInsights.WindowsCollectors.Session); this.InitializeComponent(); this.Suspending += OnSuspending; Container = AutoFacConfiguration.Configure(); try { StickersDataSource bs = new StickersDataSource(); UserAccountDataSource ds = new UserAccountDataSource(); ds.InitDatabase(); ds.CreateDatabase(); bs.InitDatabase(); bs.CreateDatabase(); } catch (Exception ex) { } }
protected override void Configure() { LocalAppDataPath = Path.Combine( Environment.GetFolderPath( Environment.SpecialFolder.LocalApplicationData, Environment.SpecialFolderOption.DoNotVerify), ApplicationName); if (!Directory.Exists(LocalAppDataPath)) { Directory.CreateDirectory(LocalAppDataPath); } AppDataPath = Path.Combine( Environment.GetFolderPath( Environment.SpecialFolder.CommonApplicationData, Environment.SpecialFolderOption.DoNotVerify), ApplicationName); Container = AutoFacConfiguration.RegisterAutoFac(); var logPath = Path.Combine(AppDataPath, "Logs"); if (!Directory.Exists(logPath)) { Directory.CreateDirectory(logPath); } var directPath = Path.Combine(logPath, "ChocolateyGui.{Date}.log"); var logConfig = new LoggerConfiguration() .WriteTo.Async(config => config.LiterateConsole()) .WriteTo.Async(config => config.RollingFile(directPath, retainedFileCountLimit: 10, fileSizeLimitBytes: 150 * 1000 * 1000)) .SetDefaultLevel(); Logger = Log.Logger = logConfig.CreateLogger(); Internationalization.Initialize(); }
static Program() { AutoMapperConfiguration.Configure(); AutoFacConfiguration.RegisterDependencies(); }