本文整理汇总了C#中Factory类的典型用法代码示例。如果您正苦于以下问题:C# Factory类的具体用法?C# Factory怎么用?C# Factory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Factory类属于命名空间,在下文中一共展示了Factory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
Factory factory = new Factory();
IVehicle car = factory.CreateVehicle(VehicleType.Car);
IVehicle bike = factory.CreateVehicle(VehicleType.Bike);
IVehicle cycle = factory.CreateVehicle(VehicleType.Cycle);
}
开发者ID:tushartyagi,项目名称:design-patterns-csharp,代码行数:7,代码来源:Program.cs
示例2: Get
public static Response<Servicio> Get(this Servicio request,
Factory factory,
IHttpRequest httpRequest)
{
return factory.Execute(proxy=>{
long? totalCount=null;
var paginador= new Paginador(httpRequest);
var predicate = PredicateBuilder.True<Servicio>();
var visitor = ReadExtensions.CreateExpression<Servicio>();
if(!request.Nombre.IsNullOrEmpty()){
predicate = predicate.AndAlso(q=> q.Nombre.Contains(request.Nombre));
}
visitor.Where(predicate).OrderBy(f=>f.Nombre);
if(paginador.PageNumber.HasValue)
{
visitor.Select(r=> Sql.Count(r.Id));
totalCount= proxy.Count(visitor);
visitor.Select();
int rows= paginador.PageSize.HasValue? paginador.PageSize.Value:BL.ResponsePageSize;
visitor.Limit(paginador.PageNumber.Value*rows, rows);
}
return new Response<Servicio>(){
Data=proxy.Get(visitor),
TotalCount=totalCount
};
});
}
开发者ID:angelcolmenares,项目名称:Aicl.Delfin,代码行数:35,代码来源:BL.Servicio.cs
示例3: ToIntPtr
public static IntPtr ToIntPtr(Factory factory, FontCollectionLoader fontFileEnumerator)
{
var shadowPtr = ToIntPtr(fontFileEnumerator);
var shadow = ToShadow<FontCollectionLoaderShadow>(shadowPtr);
shadow._factory = factory;
return shadowPtr;
}
开发者ID:rbwhitaker,项目名称:SharpDX,代码行数:7,代码来源:FontCollectionLoaderShadow.cs
示例4: RunTask
public static void RunTask(Factory factory)
{
TaskContextImpl context = new TaskContextImpl(factory);
Protocol connection;
string port = Environment.GetEnvironmentVariable("hadoop.pipes.command.port");
if (port != null)
{
TcpClient client = new TcpClient("localhost", Convert.ToInt32(port));
NetworkStream stream = client.GetStream();
connection = new BinaryProtocol(stream, context, stream);
}
else
{
throw new Exception("No pipes command port variable found");
}
context.SetProtocol(connection, connection.Uplink);
context.WaitForTask();
while (!context.Done)
{
context.NextKey();
}
context.Close();
connection.Uplink.Done();
}
开发者ID:behzad888,项目名称:hadoop-sharp,代码行数:31,代码来源:Driver.cs
示例5: GetFonts
// Code taken straight from SharpDX\Samples\DirectWrite\FontEnumeration\Program.cs
public static List<InstalledFont> GetFonts()
{
var fontList = new List<InstalledFont>();
var factory = new Factory();
var fontCollection = factory.GetSystemFontCollection(false);
var familyCount = fontCollection.FontFamilyCount;
for (int i = 0; i < familyCount; i++)
{
var fontFamily = fontCollection.GetFontFamily(i);
var familyNames = fontFamily.FamilyNames;
int index;
if (!familyNames.FindLocaleName(CultureInfo.CurrentCulture.Name, out index))
familyNames.FindLocaleName("en-us", out index);
string name = familyNames.GetString(index);
fontList.Add(new InstalledFont()
{
Name = name,
});
}
return fontList;
}
开发者ID:robert-virkus,项目名称:winrt-snippets,代码行数:27,代码来源:InstalledFont.cs
示例6: Get
public static Response<RolePermission> Get(this RolePermission request,
Factory factory,
IHttpRequest httpRequest)
{
return factory.Execute(proxy=>{
long? totalCount=null;
var paginador= new Paginador(httpRequest);
var visitor = ReadExtensions.CreateExpression<RolePermission>();
var predicate = PredicateBuilder.True<RolePermission>();
predicate= q=>q.AuthRoleId==request.AuthRoleId;
visitor.Where(predicate).OrderBy(f=>f.Name) ;
if(paginador.PageNumber.HasValue)
{
visitor.Select(r=> Sql.Count(r.Id));
totalCount= proxy.Count(visitor);
visitor.Select();
int rows= paginador.PageSize.HasValue? paginador.PageSize.Value:BL.ResponsePageSize;
visitor.Limit(paginador.PageNumber.Value*rows, rows);
}
return new Response<RolePermission>(){
Data=proxy.Get(visitor),
TotalCount=totalCount
};
});
}
开发者ID:angelcolmenares,项目名称:Aicl.Delfin,代码行数:33,代码来源:BL.RolePermission.cs
示例7: ToDirect2DPathGeometry
public PathGeometry ToDirect2DPathGeometry(Factory factory, System.Windows.Media.MatrixTransform graphToCanvas)
{
double xScale, xOffset, yScale, yOffset;
xScale = graphToCanvas.Matrix.M11;
xOffset = graphToCanvas.Matrix.OffsetX;
yScale = graphToCanvas.Matrix.M22;
yOffset = graphToCanvas.Matrix.OffsetY;
PathGeometry geometry = new PathGeometry(factory);
using (GeometrySink sink = geometry.Open())
{
float xCanvas = (float)(xTransformed[0] * xScale + xOffset);
float yCanvas = (float)(yTransformed[0] * yScale + yOffset);
Vector2 p0 = new Vector2(xCanvas, yCanvas);
sink.BeginFigure(p0, FigureBegin.Hollow);
for (int i = 1; i < x.Count(); ++i)
{
if (includeLinePoint[i])
{
xCanvas = (float)(xTransformed[i] * xScale + xOffset);
yCanvas = (float)(yTransformed[i] * yScale + yOffset);
sink.AddLine(new Vector2(xCanvas, yCanvas));
}
}
sink.EndFigure(FigureEnd.Open);
sink.Close();
}
return geometry;
}
开发者ID:irriss,项目名称:IronPlot.net,代码行数:33,代码来源:CurveIDirect2D.cs
示例8: Main
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
String[] args = Environment.GetCommandLineArgs();
//Register application for too lauch when application start
RegisteryMethod.addApplicationOnComputerStart();
//download Registery Manager
DowloadRegistryManager();
if (args.Length == 1)
{
Factory factory = new Factory();
Form1 form = factory.Form1;
Application.Run(form);
//no saved authentification
/* if (!factory.AuthentificationDataManager.IsDefine)
{
factory.ObserverAuthentification.NotifieUnauthorizedException();
}
* */
}
else
{
ConsoleManager consoleManager = new ConsoleManager(args);
consoleManager.Run();
}
}
开发者ID:krack,项目名称:notifier,代码行数:30,代码来源:Program.cs
示例9: TestAddInBase
public TestAddInBase(Factory factory)
: base(factory, null, null, null)
{
this.factory = (TestFactory) factory;
Globals.Factory = factory;
CustomTaskPanes = new CustomTaskPaneCollectionDouble();
}
开发者ID:JoyPeterson,项目名称:VSTOContrib,代码行数:7,代码来源:TestAddInBase.cs
示例10: SetUp
protected void SetUp()
{
factory = Factory.getInstance();
o = new Order(1, new List<Burrito>(), DateTime.Now, false, false, Decimal.Parse("17.00"));
b = new Burrito(1, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, Decimal.Parse("3.00"));
o.burritos.Add(b);
}
开发者ID:bloomj,项目名称:BurritoPOS_CSharp,代码行数:7,代码来源:OrderSvcImplTestCase.cs
示例11: Form1
public Form1(Factory factory, SharpDX.Direct3D11.Device device, Object renderLock)
{
InitializeComponent();
this.factory = factory;
this.device = device;
this.renderLock = renderLock;
}
开发者ID:Dallemanden,项目名称:RoomAliveToolkit,代码行数:7,代码来源:Form1.cs
示例12: Direct2D1DrawingContext
public Direct2D1DrawingContext(Factory factory, RenderTarget target)
{
this.factory = factory;
this.target = target;
this.target.BeginDraw();
this.stack = new Stack<object>();
}
开发者ID:modulexcite,项目名称:Avalonia,代码行数:7,代码来源:Direct2D1DrawingContext.cs
示例13: CreateMech
public ActionResult CreateMech()
{
int userId = WebSecurity.GetUserId(User.Identity.Name);
Gamer gamer = gamerRepository.Gamers.FirstOrDefault(x => x.type == "human" && x.UserId == userId);
Game game = Session["Game"] as Game;
if (game == null) {
game = new Game();
game.selectedCountry = countryRepository.Countries.FirstOrDefault(x => x.ridgamer == gamer.rid && x.UserId == userId);
}
if (game.selectedCountry == null){
game.selectedCountry = countryRepository.Countries.FirstOrDefault(x => x.ridgamer == gamer.rid && x.UserId == userId);
}
Country country = game.selectedCountry;
Gamer owner = gamerRepository.Gamers.FirstOrDefault(x => x.rid == country.ridgamer && x.UserId == userId);
Boolean our = false;
if (gamer.rid == owner.rid) { our = true; }
Factory factory = new Factory
{
designes = designRepository.Designs.Where(x => x.UserId == userId && x.ridgamer == gamer.rid).ToList(),
qnt = 0,
ours = our
};
return View(factory);
}
开发者ID:OlegKlimenkoGitHub,项目名称:earth,代码行数:28,代码来源:FactoryController.cs
示例14: PrivateFontLoader
/// <summary>
/// Initializes a new instance of the <see cref="PrivateFontLoader"/> class.
/// </summary>
/// <param name="factory">The factory.</param>
public PrivateFontLoader(Factory factory)
{
_factory = factory;
foreach (var name in System.Reflection.Assembly.GetEntryAssembly().GetManifestResourceNames())
{
if (name.ToLower().EndsWith(".ttf"))
{
var fontBytes = Utilities.ReadStream(System.Reflection.Assembly.GetEntryAssembly().GetManifestResourceStream(name));
var stream = new DataStream(fontBytes.Length, true, true);
stream.Write(fontBytes, 0, fontBytes.Length);
stream.Position = 0;
_fontStreams.Add(new PrivateFontFileStream(stream));
}
}
// Build a Key storage that stores the index of the font
_keyStream = new DataStream(sizeof(int) * _fontStreams.Count, true, true);
for (int i = 0; i < _fontStreams.Count; i++)
_keyStream.Write((int)i);
_keyStream.Position = 0;
// Register the
_factory.RegisterFontFileLoader(this);
_factory.RegisterFontCollectionLoader(this);
}
开发者ID:songfulin,项目名称:CocosSharp,代码行数:30,代码来源:CCLabel-FontUtilities-Windows.cs
示例15: T60_Factory_Dump
public void T60_Factory_Dump()
{
Factory f = new Factory();
f.Name = "Factory 1";
NamedObjectMaint mt = new NamedObjectMaint();
Assert.IsTrue(mt.Dump(f));
}
开发者ID:Eric-Guo,项目名称:uo-mes,代码行数:7,代码来源:NamedObjectMaint.cs
示例16: FontLoader
public FontLoader(Factory factory)
{
_factory = factory;
foreach (var name in typeof(FontLoader).Assembly.GetManifestResourceNames())
{
if (name.EndsWith(".ttf"))
{
var fontBytes = Utilities.ReadStream(typeof(FontLoader).Assembly.GetManifestResourceStream(name));
var stream = new DataStream(fontBytes.Length, true, true);
stream.Write(fontBytes, 0, fontBytes.Length);
stream.Position = 0;
_fontStreams.Add(new ResourceFontFileStream(stream));
}
}
// Build a Key storage
_keyStream = new DataStream(sizeof(int) * _fontStreams.Count, true, true);
for (int i = 0; i < _fontStreams.Count; i++)
_keyStream.Write((int)i);
_keyStream.Position = 0;
// Register
_factory.RegisterFontFileLoader(this);
_factory.RegisterFontCollectionLoader(this);
}
开发者ID:jonathandlo,项目名称:deep-space-dive,代码行数:25,代码来源:FontLoader.cs
示例17: GetFactory
public static Factory GetFactory() {
if (factory == null)
{
factory = new Factory();
}
return factory;
}
开发者ID:Tiakiana,项目名称:ProjectMarmelade,代码行数:7,代码来源:Factory.cs
示例18: ResourceFontFileEnumerator
FontFileEnumerator FontCollectionLoader.CreateEnumeratorFromKey(Factory factory, DataPointer collectionKey)
{
var enumerator = new ResourceFontFileEnumerator(factory, this, collectionKey);
_enumerators.Add(enumerator);
return enumerator;
}
开发者ID:jonathandlo,项目名称:deep-space-dive,代码行数:7,代码来源:FontLoader.cs
示例19: TypeDeclaration
public TypeDeclaration(Factory factory, string className, Type baseType)
{
this.factory = factory;
name = className;
this.baseType = baseType;
Initialize();
}
开发者ID:hoffmannj,项目名称:wrapandcast,代码行数:7,代码来源:TypeDeclaration.cs
示例20: CreateBuilding
/// <summary>
/// Creates a unit.
/// </summary>
/// <param name="playerID">The player ID.</param>
/// <param name="serverID">Server ID.</param>
/// <param name="type">The type of the unit.</param>
public void CreateBuilding(int playerID, int serverID, int type, int byID)
{
Building building = null;
Player p = Game1.GetInstance().GetPlayerByMultiplayerID(playerID);
Engineer engineer = (Engineer)((UnitMultiplayerData)MultiplayerDataManager.GetInstance().GetDataByServerID(byID)).unit;
switch (type)
{
case BuildingHeaders.TYPE_BARRACKS:
{
building = new Barracks(p, p.color);
break;
}
case BuildingHeaders.TYPE_FACTORY:
{
building = new Factory(p, p.color);
break;
}
case BuildingHeaders.TYPE_FORTRESS:
{
building = new Fortress(p, p.color);
break;
}
case BuildingHeaders.TYPE_RESOURCES_GATHER:
{
building = new ResourceGather(p, p.color);
break;
}
}
building.constructedBy = engineer;
building.multiplayerData.serverID = serverID;
}
开发者ID:R3coil,项目名称:RTS_XNA_v2,代码行数:37,代码来源:BuildingPacketProcessor.cs
注:本文中的Factory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论