本文整理汇总了C#中Engine.Start方法的典型用法代码示例。如果您正苦于以下问题:C# Engine.Start方法的具体用法?C# Engine.Start怎么用?C# Engine.Start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Engine
的用法示例。
在下文中一共展示了Engine.Start方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
// public static void PlayerTurn(Player player, Tile[] tiles, int firstRoll, int secondRoll)
// {
// Tile currentTile;
// player.Move(firstRoll + secondRoll, tiles.Length);
// if (tiles[player.Position] != null)
// {
// currentTile = tiles[player.Position];
// currentTile.Action(player);
// }
// Delegates.PrintingMethodInstance(player);
// }
public static void Main(string[] args)
{
IEngine engine = new Engine();
engine.Start();
Console.WriteLine("Game over");
// while (board.PlayerCount > 1)
// {
// foreach (Player player in board.Players)
// {
// int firstRoll = Dice.Roll();
// int secondRoll = Dice.Roll();
// Delegates.PrintingMethodInstance(String.Format("{0} rolls dice...", player.Name));
// Delegates.PrintingMethodInstance(String.Format("first dice rolled: {0} second dice rolled: {1}", firstRoll, secondRoll));
// PlayerTurn(player, board.Tiles, firstRoll, secondRoll);
// if (player.IsBankrupt)
// {
// board.RemovePlayer(player);
// if (board.PlayerCount <= 1)
// {
// Delegates.PrintingMethodInstance(String.Format("{0} Wins !", board.Players[0].Name));
// break;
// }
// }
// }
// }
}
示例2: TestPerformAttemptPopSuccessful
public void TestPerformAttemptPopSuccessful()
{
string inputCommand = "" + Environment.NewLine + "3 3" + Environment.NewLine + "exit" + Environment.NewLine;
StringBuilder stringBuilder = new StringBuilder();
using (StringReader stringReader = new StringReader(inputCommand))
{
Console.SetIn(stringReader);
using (StringWriter stringWriter = new StringWriter(stringBuilder))
{
Console.SetOut(stringWriter);
IRenderer consoleRenderer = new ConsoleRenderer();
Engine engine = new Engine(consoleRenderer);
engine.Start();
}
}
string gameData = stringBuilder.ToString();
string actual = gameData.Substring(gameData.Length - 55);
string expected = "Thank you for playing Balloons Pop! Have a great day!" + Environment.NewLine;
Assert.AreEqual(expected, actual);
}
示例3: Main
static void Main(string[] args)
{
// ei go na pochva
Engine game = new Engine();
game.Start();
// i do tuka ne stigam
}
示例4: Main
public static void Main(string[] args)
{
var eng = new Engine();
eng.Start();
Process.Start("http://localhost:9999/index.html");
eng.WaitForExit();
Console.WriteLine("Finished!");
}
示例5: StartEngine
public virtual void StartEngine(Engine engine)
{
try
{
engine.WarmUp();
engine.Start();
}
catch (InvalidOperationException e)
{
Console.WriteLine(e.Message + "engine number: " + Engines.IndexOf(engine));
}
}
示例6: Main
static void Main(string[] args)
{
try
{
Console.WriteLine("Starting Cosmos CI Engine");
var xEngine = new Engine();
xEngine.HandleError = e => Console.WriteLine("Error occurred in engine: " + e.ToString());
xEngine.Start();
Console.WriteLine("Started. Press enter to exit");
xEngine.Stop();
}
catch (Exception E)
{
Console.WriteLine("Error occurred: " + E.ToString());
}
}
示例7: Run
public void Run()
{
var engine = new Engine();
this.RegisterHandlers(engine);
engine.Init();
engine.Start();
while (true)
{
var input = Console.ReadLine().ToLower();
if (input.Equals("exit"))
{
break;
}
}
}
示例8: GameOverMessageTest
public void GameOverMessageTest()
{
string inputFile = "EngineConsoleInput.txt";
string command = "2\n0 0\n0 1\n1 0\n1 1\n";
StreamWriter writer = new StreamWriter(inputFile);
using (writer)
{
writer.WriteLine(command);
}
IEngine engine = new Engine();
StreamReader consoleInput = new StreamReader(inputFile);
string outputFile = "EngineConsoleOutput.txt";
StreamWriter consoleOutput = new StreamWriter(outputFile);
using (consoleInput)
{
Console.SetIn(consoleInput);
using (consoleOutput)
{
Console.SetOut(consoleOutput);
engine.Start();
}
}
StreamReader consoleResult = new StreamReader(outputFile);
string gameFieldLastLine = string.Empty;
string expectedResult = @"Game over. Detonated mines: ";
using (consoleResult)
{
string[] outputResult = consoleResult.ReadToEnd().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
gameFieldLastLine = outputResult[outputResult.Length - 1].Substring(0, expectedResult.Length);
}
Assert.AreEqual(expectedResult, gameFieldLastLine);
}
示例9: StartIntroMessageTest
public void StartIntroMessageTest()
{
string inputFile = "EngineConsoleInput.txt";
string command = "2\n0 0\n0 1\n1 0\n1 1\n";
StreamWriter writer = new StreamWriter(inputFile);
using (writer)
{
writer.WriteLine(command);
}
IEngine engine = new Engine();
StreamReader consoleInput = new StreamReader(inputFile);
string outputFile = "EngineConsoleOutput.txt";
StreamWriter consoleOutput = new StreamWriter(outputFile);
using (consoleInput)
{
Console.SetIn(consoleInput);
using (consoleOutput)
{
Console.SetOut(consoleOutput);
engine.Start();
}
}
StreamReader consoleResult = new StreamReader(outputFile);
string gameFieldFirstLine = string.Empty;
using (consoleResult)
{
gameFieldFirstLine = consoleResult.ReadLine();
}
string expectedResult = @"Welcome to ""Battle Field"" game.";
Assert.AreEqual(expectedResult, gameFieldFirstLine);
}
示例10: Main
static void Main()
{
IInputReader consoleReader = new ConsoleReader();
var consoleWriter = new ConsoleWriter
{
AutoFlush = true
};
IUnitContainer unitMatrix = new MatrixContainer(MatrixRows, MatrixCols);
ICommandDispatcher commandDispatcher = new ExtendedCommandDispatcher(); //CommandDispatcher();
IUnitEffector unitEffector = new HealthEffector(); // EmptyUnitEffector();
var engine = new Engine(unitMatrix,
consoleReader,
consoleWriter,
commandDispatcher,
unitEffector);
engine.Start();
}
示例11: Main
static void Main(string[] args)
{
try
{
Console.WriteLine("Starting Cosmos CI Engine");
var xEngine = new Engine();
// for now hardcode configuration:
xEngine.GithubOrganisation = "CosmosOS";
xEngine.GithubRepository = "CIEngine";
//xEngine.GithubRepository = "Cosmos";
xEngine.HandleError = e => Console.WriteLine("Error occurred in engine: " + e.ToString());
xEngine.Start();
//Console.WriteLine("Started. Press enter to exit");
//xEngine.Stop();
}
catch (Exception E)
{
Console.WriteLine("Error occurred: " + E.ToString());
}
}
示例12: Main
public static void Main()
{
Engine game = new Engine();
game.Start();
}
示例13: btnPrintSelected_Click
private void btnPrintSelected_Click(object sender, RoutedEventArgs e)
{
try
{
// Open a label format specifying a different printer
if (cmbPrinterSelection.SelectedValue == null)
{
Helper.ShowErrorMessageBox("Please select printer!");
return;
}
if (cbPrintQueue.IsChecked.Value)
{
// Print queue barcode
BarcodeLabel selectedJob = dgPrintQueue.SelectedItem as BarcodeLabel;
if (selectedJob == null)
{
return;
}
PrintLineItemFromQueue(selectedJob.ID, selectedJob.WSNumber, selectedJob.LineID, selectedJob.ItemID - 1);
Helper.ShowInformationMessageBox("Label has been printed successfully!");
}
else
{
// Print selected worksheet barcodes
using (Engine btEngine = new Engine())
{
btEngine.Start();
string fileName = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + @"\" + BarCodeConstants.BarcodeTemplateFileName;
List<BarcodeEntity> allBarcodeData = BusinessLogic.GetBarcodeDetails(txtQuoteNumber.Text);
if (allBarcodeData == null)
{
Helper.ShowErrorMessageBox("No data found for printing barcode!");
return;
}
foreach (QuoteGridEntity item in dgQuoteItems.SelectedItems)
{
if (item != null)
{
BarcodeEntity barcode = allBarcodeData.FirstOrDefault(x => int.Parse(x.Line) == item.LineID);
if (barcode == null)
{
continue;
}
PrintLineItem(btEngine, fileName, barcode);
}
}
}
}
}
catch (Exception ex)
{
Logger.LogException(ex);
}
}
示例14: Debugger
public void Debugger()
{
var engine = new Engine(typeof(EngineTester).GetMethod("DebuggerTest"));
engine.Start();
}
示例15: bw_DoWork
private void bw_DoWork(object sender, DoWorkEventArgs e)
{
LabelFormatDocument format = null; // The currently open Format
Messages messages;
//int waitForCompletionTimeout = 10000; // 10 seconds
Result result;
string strLabelFile;
using (Engine engine = new Engine())
{
engine.Start();
strLabelFile = Settings.GetLabelPath() + mobjSelectedLabel.LabelFile;
//strLabelFile = Settings.GetLabelPath() + "John_Deere.btw";
format = engine.Documents.Open(strLabelFile);
if (chkMultiple.Checked)
{
if (format.PrintSetup.SupportsIdenticalCopies)
{
//format.SubStrings["Print Count"].Value = int.Parse(txtQty.Text);
format.PrintSetup.IdenticalCopiesOfLabel = int.Parse(udCopies.Value.ToString());
}
if (format.PrintSetup.SupportsSerializedLabels)
{
/*For the below to work, you need to define serialization on the transforms tab of the barcode properties in Bartender*/
//format.SubStrings["Duplicate Count"].Value = udCopies.Value;
format.PrintSetup.NumberOfSerializedLabels = int.Parse(txtQty.Text);
}
}
else
{
mobjItem.LabelSequence = mobjSelectedLabel.GetNextSequence();
try{ format.SubStrings["customerlabel.Sequence"].Value = mobjItem.LabelSequence.ToString(); }catch{}
}
foreach (var objSubString in format.SubStrings)
{
switch (objSubString.Name)
{
/*I had to make all the text uppercase on "item.Item" or else barcoded labels in bartender wouldn't recognize the text
UPDATED - made "item.Item" uppercase by using the bartender software instead of code here*/
case "item.Item":
format.SubStrings[objSubString.Name].Value = mobjItem.ItemID.Trim();
break;
case "item.Description":
format.SubStrings[objSubString.Name].Value = mobjItem.Description.Trim();
break;
case "item.DrawingNmbr":
format.SubStrings[objSubString.Name].Value = mobjItem.DrawingNumber.Trim();
break;
case "item.ShippingAppItemNo":
format.SubStrings[objSubString.Name].Value = mobjItem.ShippingAppItemNo.Trim();
break;
case "item.Revision":
format.SubStrings[objSubString.Name].Value = mobjItem.Revision.Trim();
break;
case "co.MfgOrder":
format.SubStrings[objSubString.Name].Value = mobjItem.SelectedOrder.CustomerOrderNumber.Trim() + mobjItem.SelectedJob.JobNumber.Trim();
break;
case "co.Order":
format.SubStrings[objSubString.Name].Value = mobjItem.SelectedOrder.CustomerOrderNumber.Trim();
break;
case "co.CustPartNo":
format.SubStrings[objSubString.Name].Value = mobjItem.CustomerItem.Trim(); //.Replace("#", "")
break;
case "co.Supplier":
format.SubStrings[objSubString.Name].Value = txtSupplier.Text.Trim();
break;
case "co.CustNo":
format.SubStrings[objSubString.Name].Value = txtCustomer.Text;
break;
case "co.CustPO":
format.SubStrings[objSubString.Name].Value = mobjItem.SelectedOrder.CustomerPO.Trim();
break;
case "bol.GrossWeight":
format.SubStrings[objSubString.Name].Value = mobjBOL.GrossWeight.ToString();
break;
case "bol.TareWeight":
format.SubStrings[objSubString.Name].Value = mobjBOL.TareWeight.ToString();
break;
case "bol.NetWeight":
format.SubStrings[objSubString.Name].Value = mobjBOL.NetWeight.ToString();
break;
case "bol.PieceCt":
format.SubStrings[objSubString.Name].Value = mobjBOL.Quantity.ToString();
break;
case "bol.AvgPcWeight":
format.SubStrings[objSubString.Name].Value = mobjBOL.AveragePieceWeight.ToString("F3");
break;
case "bol.Cartons":
format.SubStrings[objSubString.Name].Value = txtCartons.Text.Trim();
break;
case "customeraddress.Address":
format.SubStrings[objSubString.Name].Value = txtAddress.Text.Trim();
break;
}
}
format.PrintSetup.PrinterName = e.Argument.GetValueFromAnonymousType<string>("PrinterName");
//.........这里部分代码省略.........