/// <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(); }
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() { InitializeComponent(); Suspending += OnSuspending; UnhandledException += ExceptionHelper.UnhandledExceptionLogger; 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 += 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; } }
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(); }
/// <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) { } }