Esempio n. 1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            //base.OnStartup(e);
            //MainWindow = new MainWindow();
            //MainWindow.Closing += MainWindow_Closing;

            //_notifyIcon = new System.Windows.Forms.NotifyIcon();
            //_notifyIcon.DoubleClick += (s, args) => ShowMainWindow();
            //_notifyIcon.Icon = GormWpf.Properties.Resources.Gorm;
            //_notifyIcon.Visible = true;

            //CreateContextMenu();

            //log4net.Config.XmlConfigurator.Configure();
            LoggerConfig.Setup(StringHelper.AppName);
        }
Esempio n. 2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public IServiceProvider ConfigureServices(IServiceCollection services)
        {
            // Add framework services.
            services.AddMvc();

            var builder = DiConfig.Setup();

            builder.Register(c => LoggerConfig.Setup(c.Resolve <ConfigTokenHandler <SeqUriToken> >(), c.Resolve <ConfigTokenHandler <LogFilePath> >(), c.Resolve <ConfigTokenHandler <LogToFile> >())).As <Serilog.ILogger>().SingleInstance();
            builder.Register(c => Configuration).As <IConfigurationRoot>().SingleInstance();

            builder.Populate(services);
            ApplicationContainer = builder.Build();
            using (var lifetimeScope = ApplicationContainer.BeginLifetimeScope())
            {
                var logger = lifetimeScope.Resolve <Serilog.ILogger>();
                logger.Information("Application Starting..");
            }

            return(new AutofacServiceProvider(ApplicationContainer));
        }