static void Main(string[] args)
        {
            var printer     = new DefaultPrinter();
            var areaFactory = new AreaFactory();

            Console.WriteLine(printer.ShowGreetingAndMainMenu());
            printer.ReadAreaFromString(out var area);
            var factory = areaFactory.GetOptionsFactory(area);

            while (factory != null && !(factory is ExitCRUDMenuOptionsFactory))
            {
                Console.WriteLine(factory.GetMenu().GetConsoleOutputAsString());
                printer.ReadCRUDOptionsFromString(out var option);
                var optionFactory = factory.GetOutputBuilder(option);
                while (optionFactory != null)
                {
                    Console.WriteLine(optionFactory.GetConsoleOutputAsString());

                    Console.WriteLine("Press Enter to continue");
                    Console.ReadLine();
                    Console.WriteLine(factory.GetMenu().GetConsoleOutputAsString());
                    //New Selection Inner Menu
                    printer.ReadCRUDOptionsFromString(out option);
                    optionFactory = factory.GetOutputBuilder(option);
                }
                //Next selection Outer Menu
                Console.WriteLine(printer.ShowGreetingAndMainMenu());
                printer.ReadAreaFromString(out area);
                factory = areaFactory.GetOptionsFactory(area);
            }

            Console.WriteLine(factory == null
                ? "System Crash or Menu not implemented! Sorry"
                : factory.GetOutputBuilder(CRUDMenuOptions.Unknown).GetConsoleOutputAsString());
        }
 public ImprimeVendaVista(Venda venda)
 {
     this.venda = venda;
     this.PrinterSettings.PrinterName = DefaultPrinter.GetDefaultPrinterName();
     this.OriginAtMargins             = false;
     this.PrintPage += new PrintPageEventHandler(printPage);
 }
示例#3
0
        public void DotProduct()
        {
            // Parse
            DefaultParser         parser = new DefaultParser();
            VectorProductOperNode node   = new VectorProductOperNode(VectorProductMethod.DOT);

            parser.ParseString("<2,1,3>");
            node.AddChild(parser.Tree.Root);
            parser = new DefaultParser();
            parser.ParseString("<1,2,3>");
            node.AddChild(parser.Tree.Root);

            // Simplify
            Simplifier simplifier = new Simplifier();
            ExpNode    exp_result = node.Execute(simplifier);

            // Print
            DefaultPrinter printer    = new DefaultPrinter();
            string         str_result = exp_result.Print(printer);

            // Compare
            Assert.IsTrue(str_result == "13");
        }
示例#4
0
文件: Program.cs 项目: Avid29/Calc
        static void Main(string[] args)
        {
            while (true)
            {
                SysCon.Write("Enter an Equation (q to quit): ");
                string str = SysCon.ReadLine();

                if (str == "q")
                {
                    SysCon.Write("Done!");
                    return;
                }

                DefaultParser  parser  = new DefaultParser();
                DefaultPrinter printer = new DefaultPrinter();
                ParserStatus   status  = parser.ParseString(str);
                if (status.Failed)
                {
                    SysCon.WriteLine($"\nError: {status.ErrorType}\n");
                }
                else
                {
                    ExpNode    root       = parser.Tree.Root;
                    Simplifier simplifier = new Simplifier();
                    root = root.Execute(simplifier);

                    if (root == null)
                    {
                        SysCon.WriteLine($"\n{simplifier.Error.Message}\n");
                    }
                    else
                    {
                        SysCon.WriteLine($"\n{root.Print(printer)}\n");
                    }
                }
            }
        }
示例#5
0
        public void ReadPrefFileData()
        {
            //ActivePrinterIsDefault=1
            UsePrinter = (bool)QueryPref("UsePrinter", UsePrinter);
            ParsePrintersStatus();
            // wird nicht mehr gebraucht, Zuweisung oben auf Grund des Discriminator-Typ
            printerMargin = (int)QueryPref("MarginDefaultPrinter", printerMargin);

            bool createPrinterSuccess = false;

            if (Printer == null)
            {
                PrinterOffline();
                try
                {
                    Printer = new DefaultPrinter(270)
                    {
                        Margin = printerMargin
                    };

                    createPrinterSuccess = true;
                }
                catch (Exception ex)
                {
                    Log.Debug("In createPrinter: " + ex);
                    createPrinterSuccess = false;
                }
                if (!createPrinterSuccess)
                {
                    Log.Error(LogMessages.StationSettings10, new Exception());
                }
            }
            if (!UsePrinter)
            {
                //no warning, if no printer is found
                printerStatus = PrinterHandler.PRINTER_READY;
            }

            /*
             * checkValues("Validator1_Channel_01", 5);
             * checkValues("Validator1_Channel_02", 10);
             * checkValues("Validator1_Channel_03", 20);
             * checkValues("Validator1_Channel_04", 50);
             * checkValues("Validator1_Channel_05", 100);
             * checkValues("Validator1_Channel_06", 200);
             * checkValues("Validator1_Channel_07", 500);
             *
             * checkValues("Validator2_Channel_01", 10);
             * checkValues("Validator2_Channel_02", 20);
             * checkValues("Validator2_Channel_03", 50);
             * checkValues("Validator2_Channel_04", 100);
             * checkValues("Validator2_Channel_05", 200);
             * checkValues("Validator2_Channel_06", 0);
             *
             */
            //GMA 23.08.2010 entfernt
            //checkValues("Validator1_Type", "InnovativeTechnology.NV10");
            //checkValues("Validator2_Type", "Comestero.RM5");

            // InitializeCashIn();
        }
示例#6
0
 public TestingClass()
 {
     _printer    = new DefaultPrinter();
     _simplifier = new Simplifier();
 }