当前位置: 首页>>代码示例>>C#>>正文


C# Autofac.Resolve方法代码示例

本文整理汇总了C#中Autofac.Resolve方法的典型用法代码示例。如果您正苦于以下问题:C# Autofac.Resolve方法的具体用法?C# Autofac.Resolve怎么用?C# Autofac.Resolve使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Autofac的用法示例。


在下文中一共展示了Autofac.Resolve方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetupServerDb

        public static void SetupServerDb(DB_TestingHelper dbTestingHelper, Autofac.IContainer autofacContainer)
        {
//server sql dist
            TI.trace("Remove all tables from Server distributr");
            dbTestingHelper.RemoveAllServerTables();
            IInsertTestData td = autofacContainer.Resolve<IInsertTestData>();
            CokeDataContext ctxServer = autofacContainer.Resolve<CokeDataContext>();
            TI.trace("Run scripts and add data to server");
            dbTestingHelper.SetupServerSql(true, ctxServer, td);
        }
开发者ID:asanyaga,项目名称:BuildTest,代码行数:10,代码来源:DbSetupHelper.cs

示例2: InitializePhysics

        public override void InitializePhysics(bool force, Autofac.IComponentContext engineRegistrations)
        {
            if (force || !initialized)
            {
                var world = engineRegistrations.Resolve<PhysicsManager>().World;
                Physics = BodyFactory.CreateBody(world, Position, this);

                float spriteWidthMeters = PhysicsConstants.PixelsToMeters(Width);
                float spriteHeightMeters = PhysicsConstants.PixelsToMeters(Height);

                var rect = FixtureFactory.AttachRectangle(
                    spriteWidthMeters,
                    spriteHeightMeters,
                    1.4f,
                    Vector2.Zero,
                    Physics);

                var sensorHeight = Math.Min(spriteHeightMeters / 8, PhysicsConstants.PixelsToMeters(10));

                var detachSensor = FixtureFactory.AttachRectangle(
                    spriteWidthMeters,
                    sensorHeight,
                    1,
                    new Vector2(0, spriteHeightMeters / 2),
                    Physics);

                detachSensor.UserData = "detach";

                detachSensor.IsSensor = true;

                detachSensor.RegisterOnCollidedListener<UserControlledCharacter>(OnCollidedWithDetachSensor);

                Physics.Friction = .2f;
                Physics.FixedRotation = true;
                Physics.BodyType = BodyType.Static;
                Physics.UserData = this;

                //TODO -- Figure out Steve's collison logic for passable collision detection

                // Possible logic for passthrough collision detection
                Physics.IsSensor = true;

                Physics.RegisterOnCollidedListener<UserControlledCharacter>(OnCollidedWith);
                Physics.RegisterOnSeparatedListener<UserControlledCharacter>(OnSeparation);
                Physics.RegisterOnCollidedListener<Entity>(OnCollidedWith);

                initialized = true;
            }

            base.InitializePhysics(false, engineRegistrations);
        }
开发者ID:pquinn,项目名称:time-sink,代码行数:51,代码来源:Ladder.cs

示例3: InitializePhysics

        public override void InitializePhysics(bool force, Autofac.IComponentContext engineRegistrations)
        {
            if (!initialized || force)
            {
                var world = engineRegistrations.Resolve<PhysicsManager>().World;

                float spriteWidthMeters = PhysicsConstants.PixelsToMeters(Width);
                float spriteHeightMeters = PhysicsConstants.PixelsToMeters(Height);

                Physics = BodyFactory.CreateRectangle(
                          world,
                          spriteWidthMeters, spriteHeightMeters,
                          1.4f, Position);
                Physics.BodyType = BodyType.Dynamic;
                Physics.IsSensor = false;
                Physics.UserData = this;
                Physics.Mass = 75f;
                Physics.Friction = 0.01f;

                Physics.CollisionCategories = Category.All;
                Physics.CollidesWith = Category.All;

                initialized = true;
            }
            base.InitializePhysics(force, engineRegistrations);
        }
开发者ID:pquinn,项目名称:time-sink,代码行数:26,代码来源:PushableBox.cs

示例4: InitializePhysics

        public override void InitializePhysics(bool force, Autofac.IComponentContext engineRegistrations)
        {
            if (force || !initialized)
            {
                var world = engineRegistrations.Resolve<PhysicsManager>().World;
                Physics = BodyFactory.CreateBody(world, Position, this);

                float spriteWidthMeters = PhysicsConstants.PixelsToMeters(Width);
                float spriteHeightMeters = PhysicsConstants.PixelsToMeters(Height);

                var rect = FixtureFactory.AttachRectangle(
                    spriteWidthMeters,
                    spriteHeightMeters,
                    1.4f,
                    Vector2.Zero,
                    Physics);

                Physics.BodyType = BodyType.Static;
                Physics.IsSensor = true;

                initialized = true;
            }

            base.InitializePhysics(false, engineRegistrations);
        }
开发者ID:pquinn,项目名称:time-sink,代码行数:25,代码来源:Bramble.cs

示例5: WireupNavigation

 private static void WireupNavigation(Autofac.IContainer container)
 {
     var navController = container.Resolve<YunTai.NavigationController>();
     navController.Start();
 }
开发者ID:dalinhuang,项目名称:appcollection,代码行数:5,代码来源:Program.cs

示例6: StartLicensePlateMonitor

        private static void StartLicensePlateMonitor(Autofac.IContainer container)
        {
            var factory = container.Resolve<LicensePlate.LicensePlateUploadMonitor.Factory>();

            var manager = container.Resolve<Damany.RemoteImaging.Common.ConfigurationManager>();
            foreach (var cam in manager.GetCameras())
            {
                if (cam.LicensePlateUploadDirectory != null)
                {
                    if (!System.IO.Directory.Exists(cam.LicensePlateUploadDirectory))
                    {
                        throw new System.IO.DirectoryNotFoundException(@"车牌上传目录 """ + cam.LicensePlateUploadDirectory + "\"不存在,请重新配置系统!");
                    }

                    var m = factory.Invoke(cam.LicensePlateUploadDirectory);
                    m.CameraId = cam.Id;
                    m.Configuration = (LicenseParsingConfig)System.Configuration.ConfigurationManager.GetSection("LicenseParsingConfig");
                    m.Start();
                    GC.KeepAlive(m);
                }
            }
        }
开发者ID:dalinhuang,项目名称:appcollection,代码行数:22,代码来源:Program.cs

示例7: InitializePhysics

        public override void InitializePhysics(bool force, Autofac.IComponentContext engineRegistrations)
        {
            base.InitializePhysics(force, engineRegistrations);
            var width = PhysicsConstants.PixelsToMeters(Width);
            var height = PhysicsConstants.PixelsToMeters(Height);
            var world = engineRegistrations.Resolve<PhysicsManager>().World;

            FixtureFactory.AttachRectangle(width, height, .1f, Vector2.Zero, Physics);

            Physics.BodyType = BodyType.Dynamic;
            Physics.IsSensor = false;
            Physics.UserData = this;
            Physics.Mass = 2f;
            Physics.Friction = 0.01f;
        }
开发者ID:pquinn,项目名称:time-sink,代码行数:15,代码来源:VerticalTracker.cs

示例8: InitializePhysics

        public override void InitializePhysics(bool force, Autofac.IComponentContext engineRegistrations)
        {
            if (!initialized || force)
            {
                world = engineRegistrations.Resolve<PhysicsManager>().World;
                float spriteWidthMeters = PhysicsConstants.PixelsToMeters(Width);
                float spriteHeightMeters = PhysicsConstants.PixelsToMeters(Height / 2);

                Physics = BodyFactory.CreateRectangle(
                    world,
                    spriteWidthMeters, .2f,
                    300f, Position);
                Physics.Friction = 5f;
                Physics.Restitution = 0f;
                Physics.BodyType = BodyType.Static;
                Physics.IsSensor = true;
                Physics.UserData = this;
                Physics.CollidesWith = Category.Cat4;
                Physics.CollisionCategories = Category.Cat4;
                Physics.CollisionGroup = 1;

                Physics.RegisterOnSeparatedListener<UserControlledCharacter>(OnSeparation);
                Physics.RegisterOnCollidedListener<UserControlledCharacter>(OnCollidedWith);

                initialized = true;
            }

            base.InitializePhysics(false, engineRegistrations);
        }
开发者ID:pquinn,项目名称:time-sink,代码行数:29,代码来源:VineBridge.cs

示例9: InitializePhysics

        public override void InitializePhysics(bool force, Autofac.IComponentContext engineRegistrations)
        {
            if (force || !initialized)
            {
                var world = engineRegistrations.Resolve<PhysicsManager>().World;
                var texture = engineRegistrations.Resolve<IResourceCache<Texture2D>>().GetResource(BASE_OFF);
                Physics = BodyFactory.CreateRectangle(
                    world,
                    PhysicsConstants.PixelsToMeters(texture.Width / 2),
                    PhysicsConstants.PixelsToMeters(texture.Height),
                    0,
                    Position,
                    this);
                Physics.Friction = .2f;
                Physics.FixedRotation = true;
                Physics.BodyType = BodyType.Static;
                Physics.IgnoreGravity = true;

                Physics.RegisterOnCollidedListener<EnergyBullet>(OnCollidedWith);

                gunRotation = Rotation;

                initialized = true;
            }

            base.InitializePhysics(force, engineRegistrations);
        }
开发者ID:pquinn,项目名称:time-sink,代码行数:27,代码来源:Turret.cs


注:本文中的Autofac.Resolve方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。