Ejemplo n.º 1
0
 private void Start()
 {
     dataBinding = CoreServicesInstaller.Resolve <DataBindingService>();
     dataBinding.Bind <float>(Constants.DATABINDING_CAMERA_ZOOM, this);
     dataBinding.Bind <Vector3>(Constants.DATABINDING_CAMERA_POSITON, this);
     dataBinding.Bind <bool>(cameraInstancePath, this);
 }
Ejemplo n.º 2
0
 // This method gets called by the runtime. Use this method to add services to the container.
 public void ConfigureServices(IServiceCollection services)
 {
     services.AddMvc();
     ApplicationServicesInstaller.ConfigureApplicationServices(services, Configuration);
     CoreServicesInstaller.ConfigureCoreServices(services, Configuration);
     ServiceLocator.SetLocatorProvider(services.BuildServiceProvider);
 }
Ejemplo n.º 3
0
 private void InstallDIContainer()
 {
     // initialise the di container and installers
     container = new DiContainer();
     CoreServicesInstaller.Install(container);
     GameServiceInstaller.Install(container);
     GameSystemInstaller.Install(container);
 }
Ejemplo n.º 4
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            ApplicationServicesInstaller.ConfigureApplicationServices(services, Configuration);
            AuthServicesInstaller.ConfigureServicesAuth(services, Configuration);
            CoreServicesInstaller.ConfigCoreService(services, Configuration);

            ServiceLocator.SetLocatorProvider(services.BuildServiceProvider);

            services.AddControllers();

            services.AddSession();

            services.AddMvc(option => option.EnableEndpointRouting = false);

            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new OpenApiInfo {
                    Title = "Aquaculture api", Version = "v1"
                });

                c.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
                {
                    Name   = "Authorization",
                    In     = ParameterLocation.Header,
                    Type   = SecuritySchemeType.ApiKey,
                    Scheme = "Bearer"
                });

                c.AddSecurityRequirement(new OpenApiSecurityRequirement()
                {
                    {
                        new OpenApiSecurityScheme
                        {
                            Reference = new OpenApiReference
                            {
                                Type = ReferenceType.SecurityScheme,
                                Id   = "Bearer"
                            },
                            Scheme = "oauth2",
                            Name   = "Bearer",
                            In     = ParameterLocation.Header,
                        },
                        new List <string>()
                    }
                });

                var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
                var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
                c.IncludeXmlComments(xmlPath);
                c.CustomSchemaIds(x => x.FullName);
            });

            services.AddCronJob <JobService>(c =>
            {
                c.TimeZoneInfo   = TimeZoneInfo.Local;
                c.CronExpression = @"*/1 * * * *";
            });
        }
Ejemplo n.º 5
0
 public void OnValueChanged(string branch, KeyValuePair <string, string> value)
 {
     if (!string.IsNullOrEmpty(value.Key) && !string.IsNullOrEmpty(value.Value))
     {
         var guiService    = CoreServicesInstaller.Resolve <GUIService>();
         var rectTransform = guiService.GetPanelView(value.Key).GetView <MonoBehaviour>(value.Value).GetComponent <RectTransform>();
         mask        = rectTransform.rect.ToServiceRect();
         mask.width *= Utils.GetUIScaleFactor();
         mask.x      = -mask.width / 2f;
         mask.x     += rectTransform.position.x / Screen.width * Constants.SCREEN_WIDTH;
         mask.y     += rectTransform.position.y / Screen.height * Constants.SCREEN_HEIGHT;
     }
 }
Ejemplo n.º 6
0
        protected override void OnStartup(StartupEventArgs e)
        {
            Framework.Construct(builder =>
            {
                builder.RegisterInstance(ApplicationViewModel.Instance).ExternallyOwned().SingleInstance();
                builder.RegisterType <MainPageViewModel>().AsSelf();
                builder.RegisterType <FileDialogService>().As <IFileDialogService>();
                builder.RegisterType <UIManager>().As <IUIManager>();

                DataIOServiceInstaller.Install(builder);
                AlgorithmServiceInstaller.Install(builder);
                CoreServicesInstaller.Install(builder);
            });
            ExcelPackage.LicenseContext = LicenseContext.NonCommercial;

            base.OnStartup(e);
        }
Ejemplo n.º 7
0
        public void ConfigureServices(IServiceCollection services)
        {
            CoreServicesInstaller.ConfigureCoreServices(services, Configuration);
            AuthServicesInstaller.ConfigureServicesAuth(services, Configuration);
            ApplicationServicesInstaller.ConfigureApplicationServices(services, Configuration);

            //Auto Mapper Configurations
            services.AddSingleton(provider => new MapperConfiguration(mc =>
            {
                mc.AddProfile(new DtoToSchemaMappingProfile());
                mc.AddProfile(new SchemaToDtoMappingProfile());
                mc.AddProfile(new DtoToResultMappingProfile());
                mc.AddProfile(new ModelToDtoMappingProfile());
            }).CreateMapper());

            // Add Hangfire services
            services.AddHangfire(Configuration.GetConnectionString("HangfireConnection"));
        }
Ejemplo n.º 8
0
 // This method gets called by the runtime. Use this method to add services to the container.
 public void ConfigureServices(IServiceCollection services)
 {
     ApplicationServicesInstaller.ConfigureApplicationServices(services, Configuration);
     AuthServicesInstaller.ConfigureServicesAuth(services, Configuration);
     CoreServicesInstaller.ConfigureCoreServices(services, Configuration);
     ServiceLocator.SetLocatorProvider(services.BuildServiceProvider);
     services.AddControllers().AddNewtonsoftJson(options =>
                                                 options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore
                                                 );
     services.AddControllers();
     services.AddSwaggerGen(c =>
     {
         c.SwaggerDoc("v1", new Microsoft.OpenApi.Models.OpenApiInfo {
             Title = "My API", Version = "v1"
         });
     }
                            );
 }
Ejemplo n.º 9
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            CoreServicesInstaller.ConfigureCoreServices(services, Configuration);
            AuthServicesInstaller.ConfigureServicesAuth(services, Configuration);
            ApplicationServicesInstaller.ConfigureApplicationServices(services, Configuration);

            services
            .AddControllersWithViews()
            .AddNewtonsoftJson(options =>
                               options.SerializerSettings.Converters.Add(new StringEnumConverter()));

            services.AddHangfire(config =>
            {
                config.UsePostgreSqlStorage(Configuration.GetConnectionString("ReactConnectionString"));
            });

            services.AddSwaggerGen(
                c =>
            {
                c.SwaggerDoc(
                    "v5",
                    new OpenApiInfo
                {
                    Title       = "Glotech React API",
                    Version     = "v5",
                    Description = "ASP.NET Core Web API",
                    Contact     = new OpenApiContact
                    {
                        Name  = "Nguyen Dinh Binh",
                        Email = "*****@*****.**",
                    },
                    License = new OpenApiLicense
                    {
                        Name = "Copyright by Binh Nguyen",
                    }
                });

                c.OrderActionsBy((apiDesc) => $"{apiDesc.ActionDescriptor.RouteValues["controller"]}_{apiDesc.HttpMethod}");
                var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
                var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
                c.IncludeXmlComments(xmlPath);
            });
        }
Ejemplo n.º 10
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            CoreServicesInstaller.ConfigureCoreServices(services, Configuration);
            AuthServicesInstaller.ConfigureServicesAuth(services, Configuration);
            ApplicationServicesInstaller.ConfigureApplicationServices(services, Configuration);

            ServiceLocator.SetLocatorProvider(services.BuildServiceProvider);

            // Register the Swagger generator, defining one or more Swagger documents
            services.AddSwaggerGen(
                c =>
            {
                c.DescribeAllEnumsAsStrings();
                c.SwaggerDoc(
                    "v1",
                    new Info
                {
                    Title          = "Wedding.PROJECT API",
                    Version        = "v1",
                    Description    = "ASP.NET Core Web API 2",
                    TermsOfService = "None",
                    Contact        = new Contact
                    {
                        Name  = "Bui Thi Ngoc Phuc",
                        Email = "*****@*****.**",
                        Url   = "*****@*****.**"
                    },
                    License = new License
                    {
                        Name = "Copyright by The 41 Wedding Team",
                        Url  = ""
                    }
                });

                c.OrderActionsBy((apiDesc) => $"{apiDesc.ActionDescriptor.RouteValues["controller"]}_{apiDesc.HttpMethod}");

                var filePath = Path.Combine(PlatformServices.Default.Application.ApplicationBasePath, "Wedding.WebApi.xml");
                c.IncludeXmlComments(filePath);
            });

            services.AddSignalR();
        }
Ejemplo n.º 11
0
 protected override void Awake()
 {
     base.Awake();
     spriteAtlas = CoreServicesInstaller.Resolve <SpriteAtlasService>();
 }
Ejemplo n.º 12
0
 protected virtual void Awake()
 {
     component   = GetComponent <T>();
     databinding = CoreServicesInstaller.Resolve <DataBindingService>();
 }
Ejemplo n.º 13
0
 protected override void Bind()
 {
     base.Bind();
     CoreServicesInstaller.Resolve <DataBindingService>().Bind <Services.Core.Rect>(Constants.DATABINDING_TUTORIAL_DIALOG_SIZE_PATH, this);
 }
Ejemplo n.º 14
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            CoreServicesInstaller.ConfigureCoreServices(services, Configuration);
            AuthServicesInstaller.ConfigureServicesAuth(services, Configuration);
            ApplicationServicesInstaller.ConfigureApplicationServices(services, Configuration);

            ServiceLocator.SetLocatorProvider(services.BuildServiceProvider);

            services.AddMvcCore()
            .AddApiExplorer();

            // Add the embedded file provider
            var viewAssembly = typeof(RazorViewRenderService).GetTypeInfo().Assembly;
            var fileProvider = new EmbeddedFileProvider(viewAssembly);

            services.Configure <RazorViewEngineOptions>(
                options =>
            {
                options.FileProviders.Add(fileProvider);
            });

            services.AddHangfire(
                config =>
                config.UseSqlServerStorage(Configuration["ConnectionStrings:ErpConnection"]));

            services.Configure <FormOptions>(options =>
            {
                options.MultipartBodyLengthLimit = 52428800;
            });

            // Register the Swagger generator, defining one or more Swagger documents
            services.AddSwaggerGen(
                c =>
            {
                c.EnableAnnotations();
                c.DescribeAllEnumsAsStrings();
                c.SwaggerDoc(
                    "v1",
                    new Info
                {
                    Title          = "HAWA API",
                    Version        = "v1",
                    Description    = "ASP.NET Core Web API 2",
                    TermsOfService = "None",
                    Contact        = new Contact
                    {
                        Name  = "Nguyen Khanh Huy",
                        Email = "*****@*****.**",
                        Url   = "*****@*****.**"
                    },
                    License = new License
                    {
                        Name = "Copyright by BYS JSC",
                        Url  = "https://wwww.bys.vn"
                    }
                });

                c.OrderActionsBy((apiDesc) => $"{apiDesc.ActionDescriptor.RouteValues["controller"]}_{apiDesc.HttpMethod}");

                var filePath = Path.Combine(PlatformServices.Default.Application.ApplicationBasePath, "HawaDDS.xml");
                c.IncludeXmlComments(filePath);
            });
        }