Example #1
0
        private void timer1_Tick(object sender, System.EventArgs e)
        {
            timer1.Enabled = false;
            label1.Text    = "";
            try
            {
                switch (action)
                {
                case 0:
                    UserChoice();
                    stage = 0;
                    break;

                case 1:
                    newOrder1.Single(ref stage);
                    if (stage >= 90)
                    {
                        action          = 0;
                        timer1.Interval = 15000;
                    }
                    break;

                case 2:
                    orderStatus1.Single();
                    timer1.Interval = 10000;
                    action          = 0;
                    break;

                case 3:
                    payment1.Single();
                    timer1.Interval = 3000;
                    action          = 0;
                    break;

                case 4:
                    delivery1.Single();
                    timer1.Interval = 2000;
                    action          = 0;
                    break;

                case 5:
                    stockLevel1.Single();
                    timer1.Interval = 2000;
                    action          = 0;
                    break;
                }
            }
            catch (Exception ex)
            {
                label1.Text = ex.Message;
                lock (_lock)
                {
                    RecordResponse(ex, fid, 0);
                    wconflicts++;
                }
                action = 0;
            }
            timer1.Enabled = true;
        }
        private void timer1_Tick(object sender, System.EventArgs e)
        {
            timer1.Enabled = false;
            while (maxloaded < maxfid)
            {
                Thread.Sleep(1000);
            }
            label1.Text = "";
            try
            {
                switch (action)
                {
                case 0:
                    UserChoice();
                    stage = 0;
                    break;

                case 1:
                    newOrder1.Single(ref stage);
                    if (stage >= 90)
                    {
                        action          = 0;
                        timer1.Interval = 15000;
                    }
                    break;

                case 2:
                    orderStatus1.Single();
                    timer1.Interval = 10000;
                    action          = 0;
                    break;

                case 3:
                    payment1.Single();
                    timer1.Interval = 3000;
                    action          = 0;
                    break;

                case 4:
                    delivery1.Single();
                    timer1.Interval = 2000;
                    action          = 0;
                    break;

                case 5:
                    stockLevel1.Single();
                    timer1.Interval = 2000;
                    action          = 0;
                    break;
                }
            }
            catch (Exception ex)
            {
                label1.Text = ex.Message;
                lock (_lock)
                {
                    Console.WriteLine("" + fid + " " + conn.lastreq);
                    Console.WriteLine("   " + ex.Message);
                }
                action = 0;
            }
            timer1.Enabled = true;
        }