private void PrintCheque() { CustomPrinter printer = new CustomPrinter(); printer.AddLine(" SmartSchool", new Font("Courier New", 14, System.Drawing.FontStyle.Bold)); printer.AddLine(" Столовая", new Font("Courier New", 14, System.Drawing.FontStyle.Bold)); printer.AddBlankLine(); printer.AddSeparateLine("Номер заказа:", response.Id, new Font("Courier New", 10, System.Drawing.FontStyle.Bold)); printer.AddSeparateLine("ФИО:", response.Name, new Font("Courier New", 10, System.Drawing.FontStyle.Bold)); printer.AddSeparateLine("Школа:", response.School, new Font("Courier New", 10, System.Drawing.FontStyle.Bold)); printer.AddSeparateLine("Класс:", response.Klass, new Font("Courier New", 10, System.Drawing.FontStyle.Bold)); printer.AddBlankLine(); foreach (MenuItems item in verificationOrder.Orders) { printer.AddLine(item.Name, new Font("Courier New", 10, System.Drawing.FontStyle.Bold)); printer.AddLineEnd(" =" + item.Price.ToString() + " тг.", new Font("Courier New", 10, System.Drawing.FontStyle.Bold)); printer.AddSeparateLine("x" + item.Quantity, " =" + (item.Price * item.Quantity).ToString() + " тг.", new Font("Courier New", 10, System.Drawing.FontStyle.Bold)); } printer.AddBlankLine(); printer.AddCenteredLine("СПАСИБО ЗА ЗАКАЗ!", new Font("Courier New", 10, System.Drawing.FontStyle.Bold)); printer.AddBlankLine(); printer.Print(); this.Dispatcher.Invoke(new Action(() => this.verificationOrder.Clear())); }
/// <summary> /// Retrieves the script for the given file path /// </summary> /// <param name="filePath">string filepath to a vaild file</param> /// <returns>DialogPrinter if the script is found and processed, null otherwise</returns> public IDialogPrinter GetForScript(string filePath) { IDialogPrinter printer = null; try { DialogGenerator gen = new DialogGenerator(filePath); switch (gen.GetPrinterType()) { case GENERAL: printer = new DialogPrinter(gen.GetLines()); break; case REPEATING: printer = new RepeatingPrinter(gen.GetLines()); break; case BATTLE: printer = new CustomPrinter(gen.GetLines()); break; } } catch (ScriptNotFoundException e) { Console.Out.WriteLine(e.Message); } return(printer); }
static void Main(string[] args) { string quote = CustomPrinter.QuoteIt("640k ought to be enough memory for anyone", "Bill Gate"); Console.WriteLine(quote); Console.WriteLine(CustomPrinter.CountVowel("What's up everybody ? Welcome back to channel. Hi ! How are ya !" + "?")); Console.WriteLine(CustomPrinter.UpperLower("What's up everybody ? Welcome back to channel. Hi ! How are ya !" + "?")); do { Console.WriteLine("Specify a size to a count"); long a = Convert.ToInt64(Console.ReadLine()); Console.WriteLine("Specify test type. 1 StringBuilder 2 Concetentation"); int testType = Convert.ToInt32(Console.ReadLine()); long result = CustomPrinter.StringBuildTest(a, testType == 1 ? CustomPrinter.StringBuilding.StringBuilder : CustomPrinter.StringBuilding.Conatenation); Console.WriteLine("The result is " + result + " milliseconds"); Console.WriteLine("Go again ? y/n"); } while (Console.ReadLine().ToLower() != "n"); Console.ReadLine(); }
static void Main(string[] args) { Console.WriteLine(CustomPrinter.QuoteIt("ho ho ho", "santa")); Console.WriteLine("vowels count: " + CustomPrinter.CountVowels("ho ho ho ha hu")); Console.WriteLine(CustomPrinter.UpperLower("loremipsumdolor")); Console.WriteLine("concatenation 10000: " + CustomPrinter.StringBuildTest(10000, CustomPrinter.StringBuildingType.Concatenation)); Console.WriteLine("string builder 10000: " + CustomPrinter.StringBuildTest(10000, CustomPrinter.StringBuildingType.StringBuilder)); Console.ReadLine(); }