Esempio n. 1
0
        static void Main()
        {
            mainAction action = mainAction.
                                normal;


            if (action == mainAction.normal)
            {
                Interperator interp = new PrimInterperator(new DefaultLoginInfo());
                Display.Welcome();

                while (true)
                {
                    String cmd = Console.ReadLine();
                    Console.WriteLine(interp.Interperate(cmd));
                }
            }
            else if (action == mainAction.test)
            {
                /** AMA test **/

                Console.WriteLine("We are a'go!");
                AMA testAMA = new DefaultAMA(new Communicator());
                //AMA testAMA = new DefaultAMA(new TestMarketCommunicator());
                testAMA.enable(true);

                System.Threading.Thread.Sleep(10000 * 3);
                testAMA.enable(false);
                Console.WriteLine("Done");
            }
            else
            {
                /** Comm test**/

                ICommunicator comm = new TestMarketCommunicator();
                //ICommunicator comm = new Communicator();


                IMarketResponse resp = comm.SendQueryUserRequest();
                Console.WriteLine(resp.ToString());


                resp = comm.SendQueryMarketRequest(1);
                Console.WriteLine(resp.ToString());



                String cmd = Console.ReadLine();
            }
        }
Esempio n. 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            QueryUserRequest req = new QueryUserRequest();
            IMarketResponse  res = InterperatorPB.sendRequest(req);

            textBox1.Text = res.ToString().Replace("\n", "\r\n");
            myLogger.Info("User clicked UPDATE STATUS");
        }
Esempio n. 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            int commodity          = (int)numericUpDown1.Value;
            QueryMarketRequest req = new QueryMarketRequest(commodity);
            IMarketResponse    res = InterperatorPB.sendRequest(req);

            MessageBox.Show(this, res.ToString());

            myLogger.Info("User clicked QUERY COMMODITY: {commodity: " + commodity + "}");
        }
Esempio n. 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            //show status
            int id = (int)numericUpDown1.Value;
            QueryBuySellRequest req = new QueryBuySellRequest(id);
            IMarketResponse     res = InterperatorPB.sendRequest(req);

            MessageBox.Show(this, res.ToString());

            myLogger.Info("User clicked QUERY REQUEST: {ID: " + id + "}");
        }
Esempio n. 5
0
        private void button1_Click(object sender, EventArgs e)
        {
            //cancel
            int             id  = (int)numericUpDown1.Value;
            CancelRequest   req = new CancelRequest(id);
            IMarketResponse res = InterperatorPB.sendRequest(req);

            MessageBox.Show(this, res.ToString());

            myLogger.Info("User clicked CANCEL: {ID: " + id + "}");
        }
Esempio n. 6
0
        private void button1_Click(object sender, EventArgs e)
        {
            //send

            int             commodity = (int)numericUpDown1.Value;
            int             amount    = (int)numericUpDown2.Value;
            int             price     = (int)numericUpDown3.Value;
            BuyRequest      req       = new BuyRequest(commodity, amount, price);
            IMarketResponse res       = InterperatorPB.sendRequest(req);

            MessageBox.Show(this, res.ToString());

            myLogger.Info("User clicked BUY: {commodity: " + commodity + ", price: " + price + ", amount: " + amount + "}");
        }
Esempio n. 7
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            Microsoft.Win32.SaveFileDialog dialog = new Microsoft.Win32.SaveFileDialog();
            dialog.FileName   = "Current Status";             // Default file name
            dialog.DefaultExt = ".pdf";                       // Default file extension
            dialog.Filter     = "PDF documents (.pdf)|*.pdf"; // Filter files by extension

            // Show open file dialog box
            Nullable <bool> result = dialog.ShowDialog();

            // Process open file dialog box results
            if (result == true)
            {
                // Open document
                string res = dialog.FileName;

                var doc1 = new Document();
                PdfWriter.GetInstance(doc1, new FileStream(res, FileMode.Create));

                QueryUserRequest       req1  = new QueryUserRequest();
                IMarketResponse        resp1 = InterperatorPB.sendRequest(req1);
                QueryAllBuySellRequest req2  = new QueryAllBuySellRequest();
                List <MQReqWrapper>    resp2 = InterperatorPB.sendAllUserRequest();

                doc1.Open();
                doc1.Add(new iTextSharp.text.Paragraph("CURRENT USER STATUS:"));
                doc1.Add(new iTextSharp.text.Paragraph("\n"));
                doc1.Add(new iTextSharp.text.Paragraph(resp1.ToString()));
                doc1.Add(new iTextSharp.text.Paragraph("\n"));

                if (!(resp2 == null))
                {
                    foreach (var element in resp2)
                    {
                        doc1.Add(new iTextSharp.text.Paragraph(element.ToString()));
                    }
                }

                doc1.Close();

                myLogger.Info("User Export status report");
            }
        }