Пример #1
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            bool             Checked  = false;
            FeedBackDelegate feedBack = null;

            if (rdobtnSpinBox.Checked)
            {
                feedBack = new FeedBackDelegate(updateSpainBox);
                Checked  = true;
            }

            if (rdobtnProgressBar.Checked)
            {
                feedBack = new FeedBackDelegate(updateProgressBar);
                Checked  = true;
            }

            if (rdobtnTrackBar.Checked)
            {
                feedBack = new FeedBackDelegate(updateTrackBar);
                Checked  = true;
            }

            if (Checked)
            {
                doingHeavyWork(feedBack);
                Checked = false;
            }
        }
Пример #2
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            bool Checked = false;
            FeedBackDelegate feedBack = null;

            if (rdobtnSpinBox.Checked)
            {
                feedBack = new FeedBackDelegate(updateSpainBox);
                Checked = true;
            }

            if (rdobtnProgressBar.Checked)
            {
                feedBack = new FeedBackDelegate(updateProgressBar);
                Checked = true;
            }

            if (rdobtnTrackBar.Checked)
            {
                feedBack = new FeedBackDelegate(updateTrackBar);
                Checked = true;
            }

            if (Checked)
            {
                doingHeavyWork(feedBack);
                Checked = false;
            }
        }
Пример #3
0
 private void doingHeavyWork(FeedBackDelegate feedBack)
 {
     for (int i = 0; i < 10; i++)
     {
         Thread.Sleep(200);
         feedBack();
     }
 }
Пример #4
0
 private void doingHeavyWork(FeedBackDelegate feedBack)
 {
     for (int i = 0; i < 10; i++)
     {
         Thread.Sleep(200);
         feedBack();
     }
 }
Пример #5
0
        private void slowMethod(FeedBackDelegate feedback)
        {
            for (int i = 0; i < 10; i++)
            {
                Thread.Sleep(200);

                feedback();
            }
        }
Пример #6
0
 private void button1_Click(object sender, EventArgs e)
 {
     FeedBackDelegate feedBackDelegate = null;
     resetControls();
     if (rdo_PBar.Checked)
     {
         feedBackDelegate = new FeedBackDelegate(updateProgressBar);
     }
     if (rdo_TrackBar.Checked)
     {
         feedBackDelegate = new FeedBackDelegate(updateTrack);
     }
     if (rdo_spin.Checked)
     {
         feedBackDelegate = new FeedBackDelegate(updateSpin);
     }
     if (feedBackDelegate != null)
     {
         slowMethod(feedBackDelegate);
     }
 }
Пример #7
0
        private void btStart_Click(object sender, EventArgs e)
        {
            if(rbProgressBar.Checked)
            {
                progresDelegate = new FeedBackDelegate(updateProgressBar);
            }else if(rbSpinBox.Checked)
            {
                progresDelegate = new FeedBackDelegate(updateSpinBox);
            }else
            {
                progresDelegate = new FeedBackDelegate(updatetrackbar);
            }

            setProgressToZero();

            for( int i =0 ; i < 10; i ++)
            {
                progresDelegate();
                Thread.Sleep(500);
                Application.DoEvents();
            }
        }