Example #1
0
        public App()
        {
            bool createdNew = true;

            mutex = new Mutex(true, "Workstation", out createdNew);

            if (createdNew)
            {
                //create System Configuration Manager with default System configuration and user profile.
                SysConfigMgr = new SysConfigManager();

                //create Data Access Layer with System Configuration Manager Interface
                dataSource = new DataSource(SysConfigMgr.SysConfigAccess);

                //create system manager with Data Access Layer Interface and System Configuration Manager Interface
                SysMgr = new SystemManager(SysConfigMgr.SysConfigAccess, dataSource.SourceAccess);

                //create Presentation Layer with System configuration manager interface and system manager interface
                defaultUI = new Presentation(SysConfigMgr.SysConfigAccess, SysMgr.SysMgrAccess);
                defaultUI.Show();
            }
            else
            {
                Process current = Process.GetCurrentProcess();
                foreach (Process process in Process.GetProcessesByName(current.ProcessName))
                {
                    SetForegroundWindow(process.MainWindowHandle);
                }

                Application.Current.Shutdown();
            }
        }
Example #2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app,
                              IHostingEnvironment env,
                              ILoggerFactory factory,
                              IDistributedCache cache,
                              SysConfigManager sysConfig,
                              ProConfigManager proConfig,
                              IApplicationLifetime lifetime)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }
            app.UseStaticFiles();
            app.UseTomatoLog(this.Configuration, cache, sysConfig, proConfig, lifetime);

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });
        }
Example #3
0
        public static IApplicationBuilder UseTomatoLog(this IApplicationBuilder app,
                                                       IConfiguration configuration,
                                                       IDistributedCache cache,
                                                       SysConfigManager sysManager,
                                                       ProConfigManager proManager,
                                                       IApplicationLifetime lifetime)
        {
            lifeTime         = lifetime;
            sysConfigManager = sysManager;
            filterService    = new FilterService(configuration, cache, sysManager, proManager, logger);
            var flowType = configuration.GetSection("TomatoLog:Flow:Type").Get <FlowType>();

            switch (flowType)
            {
            default:
                UseRedis(configuration, cache);
                break;

            case FlowType.RabbitMQ:
                UseRabbitMQ(configuration);
                break;

            case FlowType.Kafka:
                UseKafka(configuration);
                break;
            }
            return(app);
        }
Example #4
0
 // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
 public void Configure(IApplicationBuilder app, IWebHostEnvironment env, HttpClient httpClient, IDistributedCache cache,
                       SysConfigManager sysConfig,
                       ProConfigManager proConfig,
                       IHostApplicationLifetime lifetime)
 {
     if (env.IsDevelopment())
     {
         app.UseDeveloperExceptionPage();
     }
     else
     {
         app.UseExceptionHandler("/Home/Error");
     }
     app.UseStaticFiles();
     app.UseRouting();
     app.UseAuthorization();
     app.UseTomatoLog(this.Configuration, cache, sysConfig, proConfig, lifetime, httpClient);
     app.UseEndpoints(endpoints =>
     {
         endpoints.MapControllerRoute(
             name: "default",
             pattern: "{controller=Home}/{action=Index}/{id?}");
     });
 }
Example #5
0
 public ConfigController(SysConfigManager sysConfigManager, IConfiguration cfg, ILogger <ConfigController> logger) : base(cfg, logger)
 {
     this.sysConfigManager = sysConfigManager;
 }