Exemple #1
0
        public void updateUI(CGRWorker e)
        {
            // We have finished gracefully
            if (e.running)
            {
                // Update Progress Indicator
                lblProgress.Text = "" + e.getProgress();

                // Show maximum if Fixed
                if (e.repeat == CGRWorker.RepeatType.Fixed)
                {
                    lblProgress.Text = lblProgress.Text + "/" + e.repeatTimes;

                    // Get a percentage value
                    // http://stackoverflow.com/questions/2124283/whats-the-best-way-to-create-a-percentage-value-from-two-integers-in-c
                    barProgress.Value = (100 * e.getProgress()) / e.repeatTimes;
                }

            }
            else
            {
                lblProgress.Text = "Finished!";
                barProgress.Value = 100;
            }

            startCheck();
        }
Exemple #2
0
        public Form1()
        {
            InitializeComponent();

            cgr = new CGRWorker();
            ui = new updateUIDelegate(updateUI);

            cgr.repeat = CGRWorker.RepeatType.Indefinite;
            rdbIndefinite.Checked = true;
            rdbSetNumber_CheckedChanged(null, null);

            startCheck();
        }