コード例 #1
0
        //Event handler for order confirmation
        public void orderConfirmationEvent(OrderClass confirmedOrder)
        {
            //only attempt to move order from sent to confirmed after making sure
            //the order sender id matches the thread sender id
            //otherwise it is someonelse's order
            if (confirmedOrder.getID() == senderId.ToString())
            {
                //search for the confirmed order
                for (int s = 0; s < sentOrders.Count; s++)
                {
                    if (sentOrders.ElementAt(s).getOrderId() == confirmedOrder.getOrderId())
                    {
                        Console.WriteLine("Order ({0}) Confirmation Received", confirmedOrder.ToString());

                        orderFinish[s] = DateTime.Now;
                        //move from sent orders to confirmed orders
                        confirmedOrders.Add(confirmedOrder);


                        // trace events caught

                        //sentOrders.RemoveAt(s); i will not remove the confirmed order from s in order to
                        //maintain the correct order in which the orders were submitted so i can use
                        //that index for the finish time stamp
                        //TimeStamp for end of order s
                    }
                }
            }
        }
コード例 #2
0
        //Event handler for order confirmation
        public void orderConfirmationEvent(OrderClass confirmedOrder)
        {
            //only attempt to move order from sent to confirmed after making sure
            //the order sender id matches the thread sender id
            //otherwise it is someonelse's order
            if (confirmedOrder.getID() == senderId.ToString())
            {

                //search for the confirmed order
                for (int s = 0; s < sentOrders.Count; s++)
                {

                    if (sentOrders.ElementAt(s).getOrderId() == confirmedOrder.getOrderId())
                    {
                        Console.WriteLine("Order ({0}) Confirmation Received", confirmedOrder.ToString());

                        orderFinish[s] = DateTime.Now;
                        //move from sent orders to confirmed orders
                        confirmedOrders.Add(confirmedOrder);

                        // trace events caught

                        //sentOrders.RemoveAt(s); i will not remove the confirmed order from s in order to
                        //maintain the correct order in which the orders were submitted so i can use
                        //that index for the finish time stamp
                        //TimeStamp for end of order s
                    }

                }
            }
        }