本文整理汇总了C#中IFactory.Create方法的典型用法代码示例。如果您正苦于以下问题:C# IFactory.Create方法的具体用法?C# IFactory.Create怎么用?C# IFactory.Create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IFactory
的用法示例。
在下文中一共展示了IFactory.Create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FromIDictionary
public static IPrimaryModel FromIDictionary(IDictionary source, IFactory factory)
{
if (source == null) return null;
var itypeName = factory.Create<ITypeName>(source,null);
if (itypeName != null)
{
var typeName = itypeName.TypeName;
if (!IgnoreTypes.Contains(typeName))
{
var model3D = factory.Create<Model3D>(typeName, null);
if (model3D != null)
{
var material = GetMaterial(source, factory);
if (material != null)
{
var geoModel = model3D as GeometryModel3D;
if (geoModel != null)
{
geoModel.Material = material;
}
}
var model3DGroup = new Model3DGroup { Transform = GetTransform(source, factory) };
model3DGroup.Children.Add(model3D);
return new PrimaryModel { Model3D = model3DGroup };
}
}
}
return null;
}
示例2: Initialize
public void Initialize(IFactory factory)
{
this.Boolean = factory.Create<bool>();
this.Integer = factory.Create<int>();
this.Float = factory.Create<float>();
this.Enumerator = factory.Create<Enumerator>();
this.String = factory.Create<string>();
}
示例3: Initialize
public virtual void Initialize(IFactory factory)
{
this.Boolean = factory.Create<bool>();
this.Integer = factory.Create<int>();
this.Float = factory.Create<float>();
this.Enumerator = factory.Create<Enumerator>();
this.Structure = factory.Create<Structure>();
}
示例4: Initialize
public void Initialize(IFactory factory)
{
this.Structures.Add(factory.Create<Structure>()).Add(factory.Create<Structure>());
this.Classes.Add(factory.Create<ComplexClass>()).Add(factory.Create<Class>());
this.Objects.Add(factory.Create<ComplexClass>()).Add(factory.Create<Class>()).Add(factory.Create<bool>()).Add(factory.Create<DateTime>());
this.Floats.Add(0.1337f).Add(1.1337f).Add(2.1337f).Add(3.1337f).Add(4.1337f).Add(5.1337f).Add(6.1337f).Add(7.1337f).Add(8.1337f).Add(9.1337f);
this.Single.Add(1337);
this.SingleObject.Add(factory.Create<Class>());
}
示例5: Initialize
public virtual void Initialize(IFactory factory)
{
this.Structures = new Structure[] { factory.Create<Structure>(), factory.Create<Structure>() };
this.Classes = new Class[] { factory.Create<ComplexClass>(), factory.Create<Class>() };
this.Objects = new object[] { factory.Create<ComplexClass>(), factory.Create<Class>(), factory.Create<bool>(), factory.Create<DateTime>() };
this.Numbers = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
this.Empty = new int[0];
}
示例6: Initialize
public void Initialize(IFactory factory)
{
this.Structures = new Collection.List<Structure>(factory.Create<Structure>(), factory.Create<Structure>());
this.Classes = new Collection.List<Class>(factory.Create<ComplexClass>(), factory.Create<Class>());
this.Objects = new Collection.List<object>(factory.Create<ComplexClass>(), factory.Create<Class>(), factory.Create<bool>(), factory.Create<DateTime>());
this.Numbers = new Collection.List<int>(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
this.Floats.Add(0.1337f).Add(1.1337f).Add(2.1337f).Add(3.1337f).Add(4.1337f).Add(5.1337f).Add(6.1337f).Add(7.1337f).Add(8.1337f).Add(9.1337f);
this.Empty = new Collection.List<int>();
this.Single = new Collection.List<int>();
this.Single.Add(1337);
this.SingleObject = new Collection.List<object>(factory.Create<Class>());
}
示例7: Initialize
public void Initialize(IFactory factory)
{
this.Structures = new Collection.Dictionary<int, Structure>(Kean.KeyValue.Create(0, factory.Create<Structure>()), Kean.KeyValue.Create(1, factory.Create<Structure>()));
this.Classes = new Collection.Dictionary<int, Class>(Kean.KeyValue.Create(0, (Class)factory.Create<ComplexClass>()), Kean.KeyValue.Create(1, factory.Create<Class>()));
this.Objects = new Collection.Dictionary<string, object>(Kean.KeyValue.Create("complex", (object)factory.Create<ComplexClass>()), Kean.KeyValue.Create("class", (object)factory.Create<Class>()), Kean.KeyValue.Create("boolean", (object)factory.Create<bool>()), Kean.KeyValue.Create("time", (object)factory.Create<DateTime>()));
this.Numbers = new Collection.Dictionary<string, int>();
for (int i = 0; i < 10; i++)
this.Numbers[this.keys[i]] = i;
this.Empty = new Collection.Dictionary<string, int>();
}
示例8: GetTransform
private static Transform3D GetTransform(IDictionary source, IFactory factory)
{
IScale iscale = factory.Create<IScale>(source,null);
if (iscale != null)
{
return new ScaleTransform3D { ScaleX = iscale.Scale.X, ScaleY = iscale.Scale.Y, ScaleZ = iscale.Scale.Z };
}
return null;
}
示例9: GetMaterial
private static Material GetMaterial(IDictionary source, IFactory factory)
{
if (factory != null)
{
return factory.Create<Material>(source,null);
}
return null;
}
示例10: FromString
public static Material FromString(string source, IFactory factory)
{
if (factory != null)
{
var icolor = factory.Create<IColor>(source,null);
if (icolor != null) return new DiffuseMaterial { Brush = new SolidColorBrush(icolor.Color) };
}
return null;
}
示例11: WidgetContainerViewModel
public WidgetContainerViewModel(IWidgetContainer widgetContainer, IFactory<IWidget, IWidgetViewModel> factory)
{
this.WidgetViewModels = new ObservableCollection<IWidgetViewModel>();
foreach (var w in widgetContainer.Widgets)
this.WidgetViewModels.Add(factory.Create(w));
//Write to console to see widgets
foreach (var wvm in this.WidgetViewModels)
Console.WriteLine(wvm);
}
示例12: GetPrimaryModel3D
private static Model3D GetPrimaryModel3D(IDictionary source, IFactory factory)
{
IPrimaryModel primaryModel = null;
if (factory != null)
{
primaryModel = factory.Create<IPrimaryModel>(source,null);
}
if (primaryModel != null) return primaryModel.Model3D;
return null;
}
示例13: FromIDictionary
public static Visual3D FromIDictionary(IDictionary source, IFactory factory)
{
if (source == null) return null;
var model3D = factory.Create<Model3D>(source, null);
if (model3D != null)
{
return new ModelVisual3D { Content = model3D };
}
return null;
}
示例14: GetModel3D
private static Model3D GetModel3D(string typeName, IFactory factory)
{
if (factory != null)
{
return factory.Create<Model3D>(typeName,null);
}
return null;
}
示例15: ServiceStub
public ServiceStub(string queueName, IFactory<IMessageStuffer> stufferFactory, IFactory<IMessagePicker> messagePickerFactory, IIExtensionBoundToStubLifecycleFactory extensionsFactory)
{
_stufferFactory = stufferFactory;
_messagePickerFactory = messagePickerFactory;
_extensionsFactory = extensionsFactory;
Queue = queueName;
MessageStuffer = _stufferFactory.Create();
MessagePicker = _messagePickerFactory.Create();
Sequences = new List<IMessageSequence>();
Extensions = _extensionsFactory.Resolve();
}