本文整理汇总了C#中System.Factory类的典型用法代码示例。如果您正苦于以下问题:C# Factory类的具体用法?C# Factory怎么用?C# Factory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Factory类属于System命名空间,在下文中一共展示了Factory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: TheFactoryReturnsTheMessage
public void TheFactoryReturnsTheMessage()
{
var sut = new Factory(new FakeMessageTypeProvider(), new ObjectCreatorActivator());
var message = sut.GetMessage(1);
Assert.IsType<SimpleMessage>(message);
}
开发者ID:keithbloom,项目名称:RuntimeFactory,代码行数:7,代码来源:FactoryTests.cs
示例2: Initialize
public override void Initialize()
{
using (var fac = new Factory())
{
using (var tmpDevice = new Device(fac.GetAdapter(0), DriverType.Hardware, DeviceCreationFlags.None))
{
using (var rf = new RenderForm())
{
var desc = new SwapChainDescription
{
BufferCount = 1,
Flags = SwapChainFlags.None,
IsWindowed = true,
ModeDescription = new ModeDescription(100, 100, new Rational(60, 1), Format.R8G8B8A8_UNorm),
OutputHandle = rf.Handle,
SampleDescription = new SampleDescription(1, 0),
SwapEffect = SwapEffect.Discard,
Usage = Usage.RenderTargetOutput
};
using (var sc = new SwapChain(fac, tmpDevice, desc))
{
PresentPointer = Pulse.Magic.GetObjectVtableFunction(sc.ComPointer, VMT_PRESENT);
ResetTargetPointer = Pulse.Magic.GetObjectVtableFunction(sc.ComPointer, VMT_RESIZETARGET);
}
}
}
}
_presentDelegate = Pulse.Magic.RegisterDelegate<Direct3D10Present>(PresentPointer);
_presentHook = Pulse.Magic.Detours.CreateAndApply(_presentDelegate, new Direct3D10Present(Callback), "D10Present");
}
开发者ID:miceiken,项目名称:D3DDetour,代码行数:31,代码来源:D3D10.cs
示例3: ClassProperties
protected override void ClassProperties(Factory factory)
{
factory.RegisterInt("number", "Number");
factory.RegisterString("flag", "Flag");
base.ClassProperties(factory);
}
开发者ID:Imortilize,项目名称:Psynergy-Engine,代码行数:7,代码来源:IfSquare.cs
示例4: MeshCompiler
public MeshCompiler()
{
ImporterFactory = new Factory<string, IMeshImporter>();
ImporterFactory.Add(".xml", () => new Meshes.Converters.OgreXmlConverter());
ImporterFactory.Add(".dae", () => new Meshes.Converters.AssimpConverter());
ImporterFactory.Add(".fbx", () => new Meshes.Converters.AssimpConverter());
}
开发者ID:johang88,项目名称:triton,代码行数:7,代码来源:MeshCompiler.cs
示例5: ClassProperties
protected override void ClassProperties(Factory factory)
{
factory.RegisterInt("number", "Number");
factory.RegisterInt("subtractrollnumber", "SubtractRollNumber");
base.ClassProperties(factory);
}
开发者ID:Imortilize,项目名称:Psynergy-Engine,代码行数:7,代码来源:SubtractionSquare.cs
示例6: GetBestAdapter
/// <summary>
///
/// </summary>
/// <returns></returns>
private static Adapter GetBestAdapter()
{
using (var f = new Factory())
{
Adapter bestAdapter = null;
long bestVideoMemory = 0;
long bestSystemMemory = 0;
foreach (var item in f.Adapters)
{
var level = global::SharpDX.Direct3D11.Device.GetSupportedFeatureLevel(item);
if (level < DefaultEffectsManager.MinimumFeatureLevel)
{
continue;
}
long videoMemory = item.Description.DedicatedVideoMemory;
long systemMemory = item.Description.DedicatedSystemMemory;
if ((bestAdapter == null) || (videoMemory > bestVideoMemory) || ((videoMemory == bestVideoMemory) && (systemMemory > bestSystemMemory)))
{
bestAdapter = item;
bestVideoMemory = videoMemory;
bestSystemMemory = systemMemory;
}
}
return bestAdapter;
}
}
开发者ID:ORRNY66,项目名称:helix-toolkit,代码行数:35,代码来源:Effects.cs
示例7: D3D11RenderingPane
public D3D11RenderingPane( Factory dxgiFactory, SlimDX.Direct3D11.Device d3D11Device, DeviceContext d3D11DeviceContext, D3D11HwndDescription d3D11HwndDescription )
{
mDxgiFactory = dxgiFactory;
mD3D11Device = d3D11Device;
mD3D11DeviceContext = d3D11DeviceContext;
var swapChainDescription = new SwapChainDescription
{
BufferCount = 1,
ModeDescription =
new ModeDescription( d3D11HwndDescription.Width,
d3D11HwndDescription.Height,
new Rational( 60, 1 ),
Format.R8G8B8A8_UNorm ),
IsWindowed = true,
OutputHandle = d3D11HwndDescription.Handle,
SampleDescription = new SampleDescription( 1, 0 ),
SwapEffect = SwapEffect.Discard,
Usage = Usage.RenderTargetOutput
};
mSwapChain = new SwapChain( mDxgiFactory, mD3D11Device, swapChainDescription );
mDxgiFactory.SetWindowAssociation( d3D11HwndDescription.Handle, WindowAssociationFlags.IgnoreAll );
CreateD3D11Resources( d3D11HwndDescription.Width, d3D11HwndDescription.Height );
PauseRendering = false;
}
开发者ID:Rhoana,项目名称:Mojo,代码行数:28,代码来源:D3D11RenderingPane.cs
示例8: TopToRight
public TopToRight()
{
var f = new Factory(KnownAssets.Path.Pipe.TopToRight, this.Container);
this.Outline = f.ToImage("outline");
this.Brown = f.ToImage("brown");
this.Brown.Visibility = Visibility.Hidden;
this.Green = f.ToImage("green");
this.Green.Visibility = Visibility.Hidden;
this.Yellow = f.ToImage("yellow");
this.Water = f.ToWaterImages(
"0_8",
"8_16",
"16_24",
"24_32",
"32_40",
"40_48",
"48_56",
"56_64"
);
this.OverlayBlack = f.ToImage("black");
this.OverlayBlack.Visibility = Visibility.Hidden;
this.Glow = f.ToImage("glow");
}
开发者ID:skdhayal,项目名称:avalonpipemania,代码行数:30,代码来源:Pipe.TopToRight.cs
示例9: CollapsesPreviousWhiteSpace
public void CollapsesPreviousWhiteSpace()
{
var factory = new Factory();
// "Hello {{~test}}"
var document = factory.Document(
factory.Text("Hello"),
factory.WhiteSpace(1),
factory.Expression(
factory.MetaCode("{{", T.OpenTag),
factory.MetaCode("~", T.Tilde),
factory.Span(SpanKind.Expression, factory.Symbol("this", T.Identifier)),
factory.MetaCode("}}", T.CloseTag)));
factory = new Factory();
// "Hello{{~test}}"
var expected = factory.Document(
factory.Text("Hello"),
factory.WhiteSpace(1, collapsed: true),
factory.Expression(
factory.MetaCode("{{", T.OpenTag),
factory.MetaCode("~", T.Tilde),
factory.Span(SpanKind.Expression, factory.Symbol("this", T.Identifier)),
factory.MetaCode("}}", T.CloseTag)));
var visitor = new WhiteSpaceCollapsingParserVisitor();
visitor.VisitBlock(document);
var builder = new StringBuilder();
var comparer = new EquivalanceComparer(builder, 0);
Assert.True(comparer.Equals(expected, document), builder.ToString());
}
开发者ID:furesoft,项目名称:FuManchu,代码行数:34,代码来源:WhiteSpaceCollapsingParserVisitorFacts.cs
示例10: VTSListPresenter
public VTSListPresenter (Factory factory, ILocalizeService localaize)
{
_vtsListViewModel = factory.Get<VTSViewModel> ();
_vtsListViewModel.Server = ConfigurationManager.SERVER;
Label header = new Label {
Text = localaize.Data.vacations,// "Vacations",
Font = Font.SystemFontOfSize (30),
TextColor = Color.FromHex ("#000"),
HorizontalOptions = LayoutOptions.Center
};
_listView = new ListView {
ItemsSource = null,
ItemTemplate = new DataTemplate (typeof(VTSListViewTemplate))
};
this.Padding = new Thickness (10, Device.OnPlatform (20, 0, 0), 10, 5);
this.Content = new StackLayout {
BackgroundColor = Color.FromHex ("#FFF"),
Children = {
header,
_listView
}
};
changeListView();
}
开发者ID:dtimyr,项目名称:xamarin,代码行数:29,代码来源:VTSListPresenter.cs
示例11: FactoryPropertiesAreInitializedWhenFactryIsCreated
public void FactoryPropertiesAreInitializedWhenFactryIsCreated()
{
var factory = new Factory();
Assert.IsNotNull(factory.CommandLineParser);
Assert.IsNotNull(factory.FileSystem);
Assert.IsNotNull(factory.ConsoleService);
}
开发者ID:sambrambs,项目名称:1-800CodingChallangeAconex,代码行数:7,代码来源:FactoryTest.cs
示例12: Load
public Order Load(int id)
{
var record = _context.Orders.Include(p => p.Lines)
.Include(p => p.BillingContact)
.Include(p => p.ShippingContact)
.Include(p => p.ShippingMethod)
.FirstOrDefault(o => o.OrderID == id);
if (record == null)
return null;
var shippingMethodRepository = new ShippingMethodRepository(_context);
var factory = new Factory(shippingMethodRepository);
var shippingMethods = shippingMethodRepository.LoadAll().Select(sm => {
var shippingMethod = sm.MapTo<ShippingMethod>();
shippingMethod.SetPrivatePropertyValue("ShippingZone", sm.ShippingZone.MapTo<ShippingZone>());
return shippingMethod;
});
var entity = record.MapTo<Order>(factory, shippingMethods);
var lines = record.Lines.Select(l => {
var line = l.MapTo<OrderLine>(factory);
line.SetPrivatePropertyValue("ProductOption", l.ProductOption.MapTo<ProductOption>());
return line;
});
entity.SetPrivateFieldValue("_lines", lines.ToList());
return entity;
}
开发者ID:markashleybell,项目名称:StoreSpike,代码行数:33,代码来源:OrderRepository.cs
示例13: Post
public static Response<Infante> Post(this Infante request, Factory factory,IHttpRequest httpRequest)
{
request.CheckId(Operaciones.Create);
factory.Execute(proxy=>{
if(request.IdTerceroFactura.HasValue && request.IdTerceroFactura.Value!=default(int))
{
var tercero= proxy.FirstOrDefault<Tercero>(q=>q.Id==request.IdTerceroFactura.Value);
tercero.AssertExists(request.IdTerceroFactura.Value);
request.NombreTercero=tercero.Nombre;
request.DocumentoTercero=tercero.Documento;
request.DVTercero=tercero.DigitoVerificacion;
request.TelefonoTercero= tercero.Telefono;
request.MailTercero= tercero.Mail;
}
proxy.Create<Infante>(request);
});
List<Infante> data = new List<Infante>();
data.Add(request);
return new Response<Infante>(){
Data=data
};
}
开发者ID:aicl,项目名称:Aicl.Galapago,代码行数:27,代码来源:BL.Infante.cs
示例14: Get
public static Response<PedidoItem> Get(this PedidoItem request,Factory factory,
IAuthSession authSession)
{
try{
var data = factory.Execute(proxy=>{
var visitor = ReadExtensions.CreateExpression<PedidoItem>();
visitor.Where(r=>r.IdPedido==request.IdPedido);
return proxy.Get(visitor);
});
return new Response<PedidoItem>(){
Data=data
};
}
catch(Exception e){
ResponseStatus rs = new ResponseStatus(){
Message= e.Message,
StackTrace=e.StackTrace,
ErrorCode= e.ToString()
};
return new Response<PedidoItem>(){
ResponseStatus=rs
};
}
}
开发者ID:angelcolmenares,项目名称:Aicl.Colmetrik,代码行数:26,代码来源:BL.PedidoItem.cs
示例15: LeftToRight
public LeftToRight()
{
var f = new Factory(KnownAssets.Path.Pipe.LeftToRight, this.Container);
this.Outline = f.ToImage("outline");
this.Brown = f.ToImage("brown");
this.Brown.Visibility = Visibility.Hidden;
this.Green = f.ToImage("green");
this.Green.Visibility = Visibility.Hidden;
this.Yellow = f.ToImage("yellow");
this.Water = f.ToWaterImages(
"water",
"water"
);
this.OverlayBlack = f.ToImage("black");
this.OverlayBlack.Visibility = Visibility.Hidden;
this.Glow = f.ToImage("glow");
}
开发者ID:skdhayal,项目名称:avalonpipemania,代码行数:29,代码来源:Pipe.LeftToRight.cs
示例16: CreateNew_ShouldInvokePassedCallbackWithNewEntity
public void CreateNew_ShouldInvokePassedCallbackWithNewEntity()
{
var factory = new Factory();
var entity = factory.Create<TestEntity>(e => e.Name = "Explicit Value");
Assert.Equal("Explicit Value", entity.Name);
}
开发者ID:davidwalker,项目名称:GuineaPig,代码行数:7,代码来源:FactoryTests.cs
示例17: Initialize
public static void Initialize( out Factory dxgiFactory, out SlimDX.Direct3D11.Device d3d11Device )
{
dxgiFactory = new Factory();
Adapter adapter = null;
long videoMemory = 0;
for ( var i = 0; i < dxgiFactory.GetAdapterCount(); i++ )
{
var tmpAdapter = dxgiFactory.GetAdapter( i );
if ( tmpAdapter.Description.DedicatedVideoMemory > videoMemory )
{
adapter = tmpAdapter;
videoMemory = tmpAdapter.Description.DedicatedVideoMemory;
}
}
d3d11Device = null;
try
{
d3d11Device = Constants.DEBUG_D3D11_DEVICE
? new SlimDX.Direct3D11.Device( adapter,
DeviceCreationFlags.Debug,
new[] { FeatureLevel.Level_11_0, FeatureLevel.Level_10_1, FeatureLevel.Level_10_0 } )
: new SlimDX.Direct3D11.Device( adapter,
DeviceCreationFlags.None,
new[] { FeatureLevel.Level_11_0, FeatureLevel.Level_10_1, FeatureLevel.Level_10_0 } );
}
catch ( Exception e )
{
Console.WriteLine( "\nError: Couldn't create Direct3D 11 device (exception: " + e.Source + ", " + e.Message + ").\n" );
}
}
开发者ID:Rhoana,项目名称:Mojo,代码行数:35,代码来源:D3D11.cs
示例18: DeviceContext10
/// <summary>
/// Initializes a new instance of the <see cref="DeviceContext10"/> class.
/// </summary>
/// <param name="handle">The window handle to associate with the device.</param>
/// <param name="settings">The settings used to configure the device.</param>
internal DeviceContext10(IntPtr handle, DeviceSettings10 settings)
{
if (handle == IntPtr.Zero)
throw new ArgumentException("Value must be a valid window handle.", "handle");
if (settings == null)
throw new ArgumentNullException("settings");
this.settings = settings;
factory = new Factory();
device = new Direct3D10.Device(factory.GetAdapter(settings.AdapterOrdinal), Direct3D10.DriverType.Hardware, settings.CreationFlags);
swapChain = new SwapChain(factory, device, new SwapChainDescription
{
BufferCount = 1,
Flags = SwapChainFlags.None,
IsWindowed = true,
ModeDescription = new ModeDescription(settings.Width, settings.Height, new Rational(60, 1), Format.R8G8B8A8_UNorm),
OutputHandle = handle,
SampleDescription = new SampleDescription(1, 0),
SwapEffect = SwapEffect.Discard,
Usage = Usage.RenderTargetOutput
});
factory.SetWindowAssociation(handle, WindowAssociationFlags.IgnoreAll | WindowAssociationFlags.IgnoreAltEnter);
}
开发者ID:zhandb,项目名称:slimdx,代码行数:31,代码来源:DeviceContext10.cs
示例19: Form1
public Form1()
{
InitializeComponent();
f = new Factory();
f.toCompile = "C:\\lavoro-temp\\p.exe";
f.CompilerPath = DodoPseudoCompiler.Properties.Resources.NetPath;
}
开发者ID:Hook25,项目名称:DodoCompiler,代码行数:7,代码来源:MainForm.cs
示例20: ConjugationTable
void ILoader.loadDico(LanguageDictionary dico, Factory factory)
{
// chargement du dico à partir d'une base SQLite
// -- chargement des mots ---------------------------------------
List<Dictionary<string, object>> words = this.db.select("words", new string[] { "word", "type", "attributs", "definition" });
for (int i = 0; i < words.Count; i++)
{
string w = (string)words[i]["word"];
string t = (string)words[i]["type"];
string a = (string)words[i]["attributs"];
string d = (string)words[i]["definition"];
if (a == null) a = "";
if (d == null) d = "";
Word word = factory.create(w, t, a.Split(new char[] {','}, StringSplitOptions.RemoveEmptyEntries), d);
if (word.IsTypeOf(typeof(VerbType)))
{
//charger la table de conjugaison
Word[] verbsConjugated = this.getConjugatedVerbsFor(word.word, factory);
ConjugationTable table = new ConjugationTable(word);
table.AddRange(verbsConjugated); // ajout des verbes à la table de conjugaison
dico.conjugaisonTables.Add(table); // ajout de la table de conjugaison au dictionnaire
dico.AddRange(verbsConjugated); // ajout des verbes au dictionnaire
}
dico.Add(word);
}
}
开发者ID:Gigatrappeur,项目名称:NLE,代码行数:32,代码来源:SQLiteLoader.cs
注:本文中的System.Factory类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论