本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例5: WireupNavigation
private static void WireupNavigation(Autofac.IContainer container)
{
var navController = container.Resolve<YunTai.NavigationController>();
navController.Start();
}
示例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);
}
}
}
示例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;
}
示例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);
}
示例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);
}