Exemplo n.º 1
0
 public ViewModels()
 {
     if (DesignMode.DesignModeEnabled)
     {
         App.Container = AutoFacConfiguration.Configure();
     }
 }
Exemplo n.º 2
0
 public Locator()
 {
     if (Windows.ApplicationModel.DesignMode.DesignModeEnabled)
     {
         App.Container = AutoFacConfiguration.Configure();
     }
 }
Exemplo n.º 3
0
        /// <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();
        }
Exemplo n.º 4
0
 /// <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();
 }
Exemplo n.º 5
0
 static void Main()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     //注册IOC依赖
     AutoFacConfiguration.RegisterDependencies();
     Application.Run(new TaskMainFrm());
 }
Exemplo n.º 6
0
 /// <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();
 }
Exemplo n.º 7
0
 public App()
 {
     InitializeComponent();
     Suspending += OnSuspending;
     Container   = AutoFacConfiguration.Configure();
     if (DeviceTypeHelper.GetDeviceType() == DeviceTypeEnum.Xbox)
     {
         this.RequiresPointerMode           = ApplicationRequiresPointerMode.WhenRequested;
         Locator.SettingsVM.MediaCenterMode = true;
     }
 }
Exemplo n.º 8
0
        static App()
        {
            Container = AutoFacConfiguration.RegisterAutoFac();

            Log = typeof(App).GetLogger();

            AppDomain.CurrentDomain.FirstChanceException += CurrentDomain_FirstChanceException;
            AppDomain.CurrentDomain.UnhandledException   += CurrentDomain_UnhandledException;

            Log.Info("Starting...");
        }
Exemplo n.º 9
0
        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;
            }
        }
Exemplo n.º 10
0
        /// <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();
        }
Exemplo n.º 11
0
        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);
        }
Exemplo n.º 12
0
        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();
        }
Exemplo n.º 13
0
        /// <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();
        }
Exemplo n.º 14
0
        // 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()));
        }
Exemplo n.º 15
0
        /// <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)
            {
            }
        }
Exemplo n.º 16
0
        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();
        }
Exemplo n.º 17
0
 static Program()
 {
     AutoMapperConfiguration.Configure();
     AutoFacConfiguration.RegisterDependencies();
 }