本文整理汇总了C#中Factory类的典型用法代码示例。如果您正苦于以下问题:C# Factory类的具体用法?C# Factory怎么用?C# Factory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Factory类属于命名空间,在下文中一共展示了Factory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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
};
});
}
示例3: ToIntPtr
public static IntPtr ToIntPtr(Factory factory, FontCollectionLoader fontFileEnumerator)
{
var shadowPtr = ToIntPtr(fontFileEnumerator);
var shadow = ToShadow<FontCollectionLoaderShadow>(shadowPtr);
shadow._factory = factory;
return shadowPtr;
}
示例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();
}
示例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;
}
示例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
};
});
}
示例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;
}
示例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();
}
}
示例9: TestAddInBase
public TestAddInBase(Factory factory)
: base(factory, null, null, null)
{
this.factory = (TestFactory) factory;
Globals.Factory = factory;
CustomTaskPanes = new CustomTaskPaneCollectionDouble();
}
示例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);
}
示例11: Form1
public Form1(Factory factory, SharpDX.Direct3D11.Device device, Object renderLock)
{
InitializeComponent();
this.factory = factory;
this.device = device;
this.renderLock = renderLock;
}
示例12: Direct2D1DrawingContext
public Direct2D1DrawingContext(Factory factory, RenderTarget target)
{
this.factory = factory;
this.target = target;
this.target.BeginDraw();
this.stack = new Stack<object>();
}
示例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);
}
示例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);
}
示例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));
}