Beispiel #1
0
 private void OnTimedEvent(Object source, System.Timers.ElapsedEventArgs e)
 {
     if (this.InvokeRequired)
     {
         this.BeginInvoke((MethodInvoker) delegate() { this.Close(); r.ChangeAvailabilityOrders(user, false); });
     }
     else
     {
         r.ChangeAvailabilityOrders(user, false);
         this.Close();
     }
 }
Beispiel #2
0
        public ConfirmOrders(User user)
        {
            InitializeComponent();
            aTimer           = new System.Timers.Timer();
            aTimer.Interval  = 60000;
            aTimer.Elapsed  += OnTimedEvent;
            aTimer.AutoReset = false;

            r             = (IRegistry)RemoteNew.New(typeof(IRegistry));
            this.user     = user;
            quote         = r.GetQuote();
            pendingOrders = r.GetUserPendingOrders(user);

            foreach (Order order in pendingOrders)
            {
                ListViewItem item = new ListViewItem(order.Type.ToString());
                item.SubItems.Add(order.Quantity.ToString());
                item.SubItems.Add((order.Quantity * quote).ToString());
                confirmView.Items.Add(item);
            }

            r.ChangeAvailabilityOrders(user, false);

            //Start Timer
            aTimer.Enabled = true;
        }